This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encodeMessage(message: string) { | |
const enc = new TextEncoder(); | |
return enc.encode(message); | |
} | |
function decodeMessage(buffer: ArrayBuffer) { | |
const dec = new TextDecoder(); | |
return dec.decode(buffer); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:root { | |
--slate-50: #f8fafc; | |
--slate-100: #f1f5f9; | |
--slate-200: #e2e8f0; | |
--slate-300: #cbd5e1; | |
--slate-400: #94a3b8; | |
--slate-500: #64748b; | |
--slate-600: #475569; | |
--slate-700: #334155; | |
--slate-800: #1e293b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jobs = [ | |
'Genetic Counselor', | |
'Mathematician', | |
'University Professor', | |
'Occupational Therapist', | |
'Statistician', | |
'Medical Services Manager', | |
'Data Scientist', | |
'Information Security Analyst', | |
'Operations Research Analyst', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
James | |
Mary | |
Robert | |
Patricia | |
John | |
Jennifer | |
Michael | |
Linda | |
David | |
Elizabeth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div[data-autogrow]:has(textarea) { | |
display: grid; | |
} | |
div[data-autogrow]:has(textarea)::after { | |
content: attr(data-autogrow) ' '; | |
white-space: pre-wrap; | |
visibility: hidden; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A generic class that allows for the creation of events and listeners. | |
* | |
* @template T - An object type that defines the events and their data types. | |
*/ | |
export default class EventEmitter<T> { | |
private events: { [K in keyof T]: Array<(data: T[K]) => void> } = {} as unknown as { [K in keyof T]: Array<(data: T[K]) => void> }; | |
/** | |
* Adds a listener to an event. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { ConnInfo, Handler } from "https://deno.land/[email protected]/http/server.ts"; | |
type RemoveModifier<Pattern> = Pattern extends `${infer P}?` ? P | |
: Pattern; | |
type RemoveMatchingRule<Pattern> = Pattern extends `${infer P}(${infer R})` ? P | |
: Pattern; | |
type ExtractGroupName<Pattern> = RemoveModifier<RemoveMatchingRule<Pattern>>; | |
type PatternParamValue<Key> = Key extends `${infer PatternString}?` | |
? string | undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { unified } from "https://esm.sh/[email protected]"; | |
import remarkParse from "https://esm.sh/[email protected]"; | |
import remarkFrontmatter from "https://esm.sh/[email protected]"; | |
import remarkGfm from "https://esm.sh/[email protected]"; | |
import remarkRehype from "https://esm.sh/[email protected]"; | |
import rehypeStringify from "https://esm.sh/[email protected]"; | |
import rehypeSlug from "https://esm.sh/[email protected]"; | |
import rehypeAutolinkHeadings from "https://esm.sh/[email protected]"; | |
import remarkGemoji from "https://esm.sh/[email protected]"; | |
import rehypeStarryNight from "https://esm.sh/@microflash/[email protected]"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {toHashString} from 'https://deno.land/[email protected]/crypto/to_hash_string.ts'; | |
import {parse} from 'https://deno.land/[email protected]/flags/mod.ts'; | |
const args = parse(Deno.args, { | |
boolean: ['help'], | |
alias: { | |
help: 'h', | |
encoding: 'e', | |
}, | |
string: ['encoding'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Delimiter = ",\n"|"," | "." | "?" | "!" | "\n" | |
type IsTemplateTag<Word> = Word extends `{${infer TagName}}${Delimiter}${string}` ? TagName : never; | |
// type IsTemplateTag<Word> = Word extends `{${infer TagName}}` ? TagName : isTemplateTagWithComma<Word>; | |
// type isTemplateTagWithComma<Word> = Word extends `{${infer Tagname}},` ? Tagname : isTemplateTagWithPeriod<Word>; | |
// type isTemplateTagWithPeriod<Word> = Word extends `{${infer Tagname}}.` ? Tagname : never; | |
type TemplateTags<TemplateString> = TemplateString extends | |
`${infer PartA} ${infer PartB}` ? IsTemplateTag<PartA> | TemplateTags<PartB> | |
: IsTemplateTag<TemplateString>; |