def processKeycode(self, keycode):
"""Parse a command in our current layer bound to the passed keycode (ledger history)."""
# Normalize NumLock "sandwiches" → strip KEY_NUMLOCK if other keys are present
parts = keycode.split("-")
filtered = [p for p in parts if p != "KEY_NUMLOCK"]
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
/* Helper Types */ | |
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ( | |
x: infer I | |
) => void | |
? I | |
: never; | |
/* Comparator */ | |
export type Comparator<T> = (a: T, b: T) => number; | |
export type CombinedComparator<T extends Comparator<unknown>[]> = Comparator< |
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 c { | |
$code_path = "C:\Users\tanishq\AppData\Local\Programs\Microsoft VS Code\Code.exe" | |
if($args) { & $code_path $args > $null } | |
else { & $code_path . > $null } | |
} | |
function f { | |
$directories = @( | |
"C:\Users\tanishq\Projects", |
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 { AsyncPipe } from "@angular/common"; | |
import { Component } from "@angular/core"; | |
import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop"; | |
import { injectNetwork } from "ngxtension/inject-network"; | |
import { | |
distinctUntilChanged, | |
map, | |
skipWhile, | |
startWith, | |
switchMap, |
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 { $ } from "bun"; | |
import { parseArgs } from "util"; | |
const { values, positionals } = parseArgs({ | |
args: Bun.argv, | |
options: { | |
user: { | |
short: "u", | |
type: "string", | |
}, |
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 dotenv from "dotenv"; | |
export const DEFAULT_ENV_FILE_MAP = { | |
production: ".env.production", | |
development: ".env.development", | |
test: ".env.test", | |
}; | |
type Config = Record<string, string | false | undefined>; | |
type ConfigFn = (defaultFilemap: Config) => Config; |
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 { randomBytes, scrypt, timingSafeEqual } from "crypto"; | |
/* | |
#Wikipedia: | |
Scrypt: https://en.wikipedia.org/wiki/Scrypt | |
PBKDF2: https://en.wikipedia.org/wiki/PBKDF2 | |
*/ | |
const SALT_LENGTH_BYTES = 32; | |
const HASH_LENGTH_BYTES = 64; |
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 { isNativeError } from "util/types"; | |
/* Type Definitions */ | |
export type ResultOk<T> = { | |
ok: true; | |
value: T; | |
}; | |
export type ResultError<E extends Error = Error> = { | |
ok: false; | |
error: E; |