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 * as remix from "https://cdn.skypack.dev/@remix-run/server-runtime"; | |
console.log(remix); |
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
#!/bin/sh +x | |
VERSION=a1d6b53acd05ae0c598f13c0e597b9daa342d35b | |
TARGET=x86_64-apple-darwin | |
curl -o deno.zip https://dl.deno.land/canary/$VERSION/deno-$TARGET.zip | |
rm -rf ./deno | |
unzip deno.zip | |
./deno --version | |
cp deno deno-$VERSION |
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 { delay } from "https://deno.land/[email protected]/async/delay.ts"; | |
import { listenAndServe } from "https://deno.land/[email protected]/http/server.ts"; | |
listenAndServe("", async () => { | |
console.log("Got request", req.url); | |
await delay(5000); | |
new Response("Hello World\n"); | |
}); |
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
addEventListener("fetch", (event) => { | |
const x = event.respondWith(new Promise((resolve) => { | |
setTimeout(() => { | |
resolve(new Response(`${typeof x} ${x.constructor.name}`)); | |
}, 300); | |
})); | |
}); |
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 { transform } from "https://esm.sh/sucrase"; | |
import { init, parse } from "https://unpkg.com/[email protected]/dist/lexer.js"; | |
(async () => { | |
await init; | |
const pathToAnalyze = "https://esm.sh/react"; | |
const resp = await fetch(pathToAnalyze); | |
console.log("Analyzing", resp.url); |
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 { JSDOM } from "https://jspm.dev/jsdom"; | |
const doc = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`); | |
console.log(doc.window.document.querySelector("p").textContent); |
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 Predicate<T> = (item: T) => boolean | |
type Selector<T, O = unknown> = (item: T) => O | |
type Grouping<V> = Record<string, Array<V>> | |
// 17 items | |
// ARRAYS (11) | |
// [Array] Transformations to Array | |
declare function distinct<T>(collection: Array<T>): Array<T> | |
declare function distinctBy<T>(collection: Array<T>, selector: Selector<T>): Array<T> |
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 Predicate<T> = (item: T) => boolean | |
type Selector<T, O = unknown> = (item: T) => O | |
type Grouping<V> = Record<string, Array<V>> | |
// ARRAYS | |
// [Array] Transformations to Array | |
declare function mapNotNullish<T, O>(collection: Array<T>, transformer: Selector<T, O>): Array<NonNullable<O>> | |
declare function takeFirstWhile<T>(collection: Array<T>, predicate: Predicate<T>): Array<T> | |
declare function takeLastWhile<T>(collection: Array<T>, predicate: Predicate<T>): Array<T> | |
declare function dropFirstWhile<T>(collection: Array<T>, predicate: Predicate<T>): Array<T> |
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 Predicate<T> = (item: T) => boolean | |
type Selector<T, O = unknown> = (item: T) => O | |
type Grouping<V> = Record<string, Array<V>> | |
// 6 Array predicates | |
// 19 Array transformations to Array | |
// 14 Array transformations to value | |
// 9 Array transformations to other formats | |
// 2 Record Predicates | |
// 9 Record Transformations to Records |
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 { hmac } from "https://deno.land/x/[email protected]/mod.ts"; | |
addEventListener("fetch", (e) => { | |
e.respondWith(new Response(hmac("sha256", "key", "msg", "utf8", "base64"))); | |
}) |