made with esnextbin
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
/** | |
* Adapted from https://github.com/broofa/mime/blob/main/index.js#L4 | |
*/ | |
export const mimeTypesToFileExtensions = { | |
"application/andrew-inset": ["ez"], | |
"application/applixware": ["aw"], | |
"application/atom+xml": ["atom"], | |
"application/atomcat+xml": ["atomcat"], | |
"application/atomsvc+xml": ["atomsvc"], | |
"application/bdoc": ["bdoc"], |
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
Running 55 benchmarks, please wait... | |
Native .fill() vs fast.fill() (3 items) | |
✓ Array.prototype.fill() x 12,868,637 ops/sec ±4.44% (66 runs sampled) | |
✓ fast.fill() x 25,604,456 ops/sec ±2.60% (64 runs sampled) | |
Result: fast.js is 98.97% faster than Array.prototype.fill(). | |
Native .fill() vs fast.fill() (10 items) | |
✓ Array.prototype.fill() x 7,098,897 ops/sec ±4.15% (74 runs sampled) |
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
export class WeakRefMap<K, V extends object> { | |
#weakRefs = new Map<K, WeakRef<V>>() | |
#registry = new FinalizationRegistry((key) => this.#weakRefs.delete(key)) | |
has = (key: K) => this.#weakRefs.has(key) | |
get = (key: K) => this.#weakRefs.get(key)?.deref() | |
set = (key: K, value: V) => { | |
const ref = new WeakRef(value) |
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
#!/bin/bash | |
echo -n "Github Username: " | |
read USER | |
echo -n "Password: " | |
read PASS | |
echo -n "Repo (e.g. cyclejs/core); " | |
read REPO |
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
type Subtract<A extends string, B extends string> = { | |
readonly [Key in A]: (Record<B, never> & Record<string, Key>)[Key] | |
}[A] | |
type Dissoc<A, B extends string> = Readonly<Pick<A, Subtract<keyof A, B>>> |
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
export const enum KeyboareEventKey { | |
// Modifier Keys | |
Alt = 'Alt', | |
AltGraph = 'AltGraph', | |
CapsLock = 'CapsLock', | |
Control = 'Control', | |
Fn = 'Fn', | |
FnLock = 'FnLock', | |
Hyper = 'Hyper', | |
Meta = 'Meta', |
made with esnextbin
made with esnextbin
made with esnextbin
NewerOlder