some stuff

This commit is contained in:
john 2024-12-03 17:10:40 +01:00
parent 08ad294d46
commit 6cbf15b783
11 changed files with 165 additions and 5 deletions

6
.idea/deno.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DenoSettings">
<option name="useDenoValue" value="ENABLE" />
</component>
</project>

6
.vim/coc-settings.json Normal file
View file

@ -0,0 +1,6 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"tsserver.enable": false
}

View file

@ -1 +1,5 @@
<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg> <svg width="98" height="96" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z"
fill="#24292f"/>
</svg>

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 989 B

Before After
Before After

23
build.ts Normal file
View file

@ -0,0 +1,23 @@
import { startServer } from "./server.ts";
async function main() {
const server = startServer("localhost", 6969);
const chromiumCmd = new Deno.Command("chromium", {
args: [
"--headless",
"--print-to-pdf=./cv.pdf",
"--no-pdf-header-footer",
"http://localhost:6969/cv.html"
]
})
const process = chromiumCmd.spawn()
await process.status
await server.shutdown()
}
if (import.meta.main) {
await main();
}

View file

@ -17,7 +17,7 @@
<main> <main>
<section id=profile> <section id=profile>
<hgroup class="experiences-heading"> <hgroup class="experiences-heading">
<img src="/assets/icon-user.svg"/> <img src="assets/icon-user.svg"/>
<h2>About Me</h2> <h2>About Me</h2>
</hgroup> </hgroup>
<p> <p>
@ -29,7 +29,7 @@
<section id=employment-history class="experiences"> <section id=employment-history class="experiences">
<hgroup class="experiences-heading"> <hgroup class="experiences-heading">
<img src="/assets/icon-briefcase.svg"/> <img src="assets/icon-briefcase.svg"/>
<h2>Employment History</h2> <h2>Employment History</h2>
</hgroup> </hgroup>
<section id=lead-software-engineer-hyre class=experience> <section id=lead-software-engineer-hyre class=experience>
@ -125,7 +125,7 @@
<section id=education class="experiences"> <section id=education class="experiences">
<hgroup class="experiences-heading"> <hgroup class="experiences-heading">
<img src="/assets/icon-academic-cap.svg"/> <img src="assets/icon-academic-cap.svg"/>
<h2>Education</h2> <h2>Education</h2>
</hgroup> </hgroup>
@ -274,4 +274,4 @@
document.title = originalTitle; document.title = originalTitle;
}); });
</script> </script>
</html> </html>

BIN
cv.pdf Normal file

Binary file not shown.

6
deno.json Normal file
View file

@ -0,0 +1,6 @@
{
"imports": {
"@std/fs": "jsr:@std/fs@^1.0.5",
"@std/path": "jsr:@std/path@^1.0.7"
}
}

17
deno.lock generated Normal file
View file

@ -0,0 +1,17 @@
{
"version": "4",
"specifiers": {
"jsr:@std/path@^1.0.7": "1.0.7"
},
"jsr": {
"@std/path@1.0.7": {
"integrity": "76a689e07f0e15dcc6002ec39d0866797e7156629212b28f27179b8a5c3b33a1"
}
},
"workspace": {
"dependencies": [
"jsr:@std/fs@^1.0.5",
"jsr:@std/path@^1.0.7"
]
}
}

12
package.json Normal file
View file

@ -0,0 +1,12 @@
{
"name": "resume",
"version": "1.0.0",
"main": "index.js",
"repository": "gitea@git.botris.dev:john/resume.git",
"author": "john <me@johnmorr.is>",
"license": "MIT",
"private": true,
"scripts": {
"serve": "deno run --allow-read=. --allow-net server.ts"
}
}

42
serve.ts Normal file
View file

@ -0,0 +1,42 @@
let server: Deno.HttpServer | null = null;
async function runScript() {
if (server) {
await server.shutdown();
}
const { startServer } = await import((`./server.ts?cache_bust=${Date.now()}`));
server = startServer("localhost", 6969);
}
function debounced(fn: () => Promise<void>) {
let timeoutId: ReturnType<typeof setTimeout> | null;
return () => {
if (timeoutId) {
clearTimeout(timeoutId);
}
timeoutId = setTimeout(fn, 200);
};
}
// Watch for file changes
async function watchFiles(paths: string[], handler: () => void) {
const watcher = Deno.watchFs(paths);
for await (const event of watcher) {
if (event.kind === "modify" || event.kind === "create") {
handler();
}
}
}
async function startup() {
// Initial run
runScript();
await watchFiles(["."], debounced(runScript));
}
if (import.meta.main) {
await startup()
}

44
server.ts Normal file
View file

@ -0,0 +1,44 @@
import * as path from "@std/path"
export function startServer(hostname = "localhost", port = 6969) {
return Deno.serve(
{ hostname, port },
async (req) => {
const url = new URL(req.url);
const filepath = decodeURIComponent(url.pathname);
try {
const file = await Deno.open("." + filepath, { read: true });
const headers: [string, string][] = [
["Cache-Control", "no-cache"]
]
const extension = path.extname(filepath);
const contentType = {
'.svg': "image/svg+xml",
'.png': "image/png",
'.jpeg': "image/jpeg",
'.woff2': "font/woff2",
'.ttf': "font/ttf",
'.css': "text/css",
".html": "text/html"
}[extension]
if (contentType) {
headers.push(["Content-Type", contentType])
}
return new Response(file.readable, {
headers
});
} catch {
return new Response("404 Not Found", { status: 404 });
}
},
);
}
if (import.meta.main) {
startServer("localhost", 6969)
}