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
| // Mirrors the `Shortcut` type from bench.ts in plain JS. | |
| // Enumerates the 200k+ string literals TS would build internally for the | |
| // `Shortcut` union, then measures how long it takes to stuff them into a Set. | |
| // | |
| // node bench.js | |
| // ---- modifiers, grouped by family (aliases within a family are interchangeable) ---- | |
| const ModifierAlt = ['Alt', 'Option']; | |
| const ModifierCmd = ['Command', 'Cmd', 'Meta']; | |
| const ModifierCtrl = ['Control', 'Ctrl']; |
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
| /* Mini benchmark: are-deeply-equal vs object-identity */ | |
| import areDeeplyEqual from 'are-deeply-equal'; | |
| import { identify } from 'object-identity'; | |
| /* CONTENDERS */ | |
| // are-deeply-equal: direct deep comparison (can short-circuit) | |
| const isEqualDirect = ( a, b ) => areDeeplyEqual ( a, b ); |
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 */ | |
| import esbuild from 'esbuild'; | |
| import worktank from 'worktank-esbuild-plugin'; | |
| /* MAIN */ | |
| esbuild.build ({ | |
| bundle: true, |
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
| ~/Downloads ❯ time (rg something linux-master --sort path) | |
| linux-master/Documentation/ABI/stable/sysfs-class-infiniband | |
| 214: unless set to something else by the driver. Users may echo a | |
| linux-master/Documentation/ABI/stable/sysfs-class-rfkill | |
| 64: transmitter is forced off by something outside of | |
| 78: The transmitter is forced off by something outside of | |
| linux-master/Documentation/ABI/stable/vdso | |
| 14:if you set CS on x86 to something strange, the vDSO functions are |
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
| ~/Downloads ❯ time (gg something linux-master --sort path) | |
| linux-master/Documentation/ABI/stable/sysfs-class-infiniband | |
| 214: unless set to something else by the driver. Users may echo a | |
| linux-master/Documentation/ABI/stable/sysfs-class-rfkill | |
| 64: transmitter is forced off by something outside of | |
| 78: The transmitter is forced off by something outside of | |
| linux-master/Documentation/ABI/stable/vdso | |
| 14:if you set CS on x86 to something strange, the vDSO functions are |
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 string = ` ${'This is just some example big file with lots of strings\n'.repeat ( 100_000 )}`.slice ( 1 ); | |
| const uint8 = new TextEncoder ().encode ( string ); | |
| const getRangesFromString = value => { | |
| let pos = 0; | |
| let length = value.length; | |
| while ( pos < length ) { |
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
| export NVM_DIR="$HOME/.nvm" | |
| export NVM_DEFAULT_VERSION=$(cat $NVM_DIR/alias/default) | |
| export PATH="$NVM_DIR/versions/node/$NVM_DEFAULT_VERSION/bin:$PATH" | |
| export MANPATH="$NVM_DIR/versions/node/$NVM_DEFAULT_VERSION/share/man:$MANPATH" | |
| export NODE_PATH="$NVM_DIR/versions/node/$NVM_DEFAULT_VERSION/lib/node_modules" | |
| function find-up () { | |
| local look=${PWD%/} |
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
| # INSPECT | |
| function inspect () { | |
| eval NODE_OPTIONS="--inspect-brk" $@ | |
| } | |
| # INSPECT PLUGIN | |
| # Toggles the "inspect " prefix upon double ESC key | |
| function plugin-inspect () { |
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 proxy = new Proxy ( [0, 1, 2], { | |
| get: ( ...args ) => { | |
| console.log ( '[get]', ...args ); | |
| return Reflect.get ( ...args ); | |
| }, | |
| apply: ( ...args ) => { | |
| console.log ( '[apply]', ...args ); | |
| return Reflect.apply ( ...args ); | |
| }, |
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 */ | |
| import {$$, createDirective} from 'voby'; | |
| import {useUpdateEffect} from '~/hooks'; | |
| /* HELPERS */ | |
| const onCheckboxChange = ( target: HTMLInputElement, value: $<undefined | boolean | number | string>, onChange?: ( value: boolean | string ) => void ): void => { |
NewerOlder