Skip to content

Instantly share code, notes, and snippets.

<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
@jonathanhudak
jonathanhudak / chat-gpt.md
Last active February 10, 2023 06:25
KeyBoard to Piano Mappings

Me

Could you produce dictionary in javascript of keyboard key codes to piano keyboard following the MAX mapping?

Sure, here is an example of a JavaScript dictionary that maps keyboard key codes to piano keyboard notes following the MAX mapping:

const keyCodeToPianoKey = {
@jonathanhudak
jonathanhudak / setup_package.sh
Last active November 3, 2022 05:04
Setup NPM Package
#!/bin/bash
# This script installs and configures typescript, eslint, prettier and commitizen for a basic NodeJS package.
# If all goes well you will have precommit hooks that lint and format your code and a prompt to craft a conventional commit message. 😎
# It is largely based on https://jamesandrewwright.com/articles/commitizen-eslint-prettier-husky/
step() {
read -p "$1? " -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# https://linuxize.com/post/bash-write-to-file/
cat << EOF > file.txt
The current working directory is: $PWD
You are logged in as $(whoami)
EOF
@jonathanhudak
jonathanhudak / server.ts
Created May 22, 2022 04:56
Simple Deno Web Server for Generating QR Codes
import { qrcode } from "https://deno.land/x/qrcode/mod.ts";
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
// https://github.com/denorg/qrcode
// https://github.com/oakserver/oak
interface HTMLPageOptions {
body: string;
}
@jonathanhudak
jonathanhudak / index.ts
Created May 6, 2022 15:44
mini-playroom-idea
import lzString from "https://esm.sh/lz-string";
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const router = new Router();
router
.get("/", (ctx) => {
ctx.response.body = "Hello world!";
})
.post("/save", async (ctx) => {
const result = ctx.request.body({ type: "text" });
import mdx from "https://esm.sh/@mdx-js/mdx@2.0.0-ci.53?target=deno";
export { mdx };
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.ns.d.ts" />
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.fetchevent.d.ts" />
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.window.d.ts" />
/*
Reference
* https://strapi.io/blog/rendering-react-ssr-with-deno-and-deno-deploy
*/
import * as React from "https://esm.sh/react@17.0.2";
@jonathanhudak
jonathanhudak / strapi-demo.tsx
Last active March 15, 2022 06:21 — forked from Symbitic/strapi-demo.tsx
Strapi Deno example.
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.ns.d.ts" />
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.fetchevent.d.ts" />
/// <reference path="https://deno.land/x/deploy@0.2.0/types/deploy.window.d.ts" />
import * as React from "https://esm.sh/react@17.0.2";
import * as ReactDOMServer from "https://esm.sh/react-dom@17.0.2/server";
import { createElement as h } from "https://esm.sh/react@17.0.2";
// @ts-ignore VSCode occasionally complains that Deno is not defined.