This file contains 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 { readLines } from "https://deno.land/[email protected]/io/mod.ts"; | |
import { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | |
import { basename } from "https://deno.land/[email protected]/path/mod.ts"; | |
export {}; | |
if (import.meta.main) { | |
const args = parse(Deno.args, { | |
boolean: ["h"], | |
alias: { |
This file contains 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 { | |
yellow, | |
cyan, | |
bold, | |
red | |
} from "https://deno.land/[email protected]/fmt/colors.ts"; | |
import { serve } from "https://deno.land/[email protected]/http/mod.ts"; | |
import { | |
MultipartReader, | |
FormFile |
This file contains 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
/** | |
* spark - https://github.com/holman/spark | |
* | |
* The MIT License | |
* Copyright (c) Zach Holman, https://zachholman.com | |
*/ | |
import { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | |
export function spark(...nums: number[]): string { | |
let min = Infinity; |
This file contains 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 { parse } from "https://deno.land/[email protected]/flags/mod.ts"; | |
import { EOL } from "https://deno.land/[email protected]/path/mod.ts"; | |
import marked from "https://raw.githubusercontent.com/denolib/marked/master/main.ts"; | |
const args = parse(Deno.args); | |
if (args.h || args.help) { | |
printUsage(); | |
Deno.exit(0); | |
} |
This file contains 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
#lang racket/base | |
(require racket/list | |
racket/match) | |
; The call-by-value lambda calculus: | |
(define (eval-expr expr env) | |
(match expr | |
[(? symbol?) | |
(env expr)] |
This file contains 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
// see http://www.eprg.org/computerphile/tripref.c | |
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
type thing struct { | |
item string |
This file contains 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 { useEffect, useReducer } from "react"; | |
const dispatchers = new Map(); | |
function centralDispatch(type, payload) { | |
for (const dispatch of dispatchers.keys()) { | |
dispatch({ type, payload }); | |
} | |
} |
This file contains 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
main().catch(console.error); | |
async function main() { | |
const clicks = streamify(document, "click"); | |
let clickCount = 0; | |
for await (const event of clicks) { | |
console.log("click", event, clickCount); | |
if (clickCount++ > 2) { | |
clicks.return(); | |
} |
This file contains 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
main().catch(console.error); | |
async function main() { | |
const clicks = streamify(document, "click"); | |
let clickCount = 0; | |
for await (const event of clicks) { | |
console.log("click", event, clickCount); | |
if (clickCount++ > 2) { | |
clicks.return(); | |
} |
This file contains 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
#lang racket | |
(module+ test | |
(require rackunit)) | |
(define state-machine | |
'((init (c more)) | |
(more (a more) | |
(d more) | |
(r end)) |
NewerOlder