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
| /** biome-ignore-all lint/suspicious/noExplicitAny: <allow it> */ | |
| import type { SpawnSyncReturns } from 'node:child_process'; | |
| import { execSync } from 'node:child_process'; | |
| // import pc from 'picocolors'; | |
| type ChainableGetter<Keys extends string, T extends Record<string, any>> = { | |
| readonly [K in Keys]: ChainableGetter<Keys, T> & T; | |
| }; | |
| export class Runner { |
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 const regexWithOccurrencePattern = (regex: RegExp | string) => { | |
| const source = regex instanceof RegExp ? regex.source : regex; | |
| return new RegExp(`^${source}((,${source})+)?$`); | |
| }; | |
| export const KEY_VALUE_PAIRS_REGEX = regexWithOccurrencePattern(/\w+=\w+/); |
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
| env=~/.ssh/agent.env | |
| bind 'set enable-bracketed-paste off' | |
| agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } | |
| agent_start () { | |
| (umask 077; ssh-agent >| "$env") | |
| . "$env" >| /dev/null ; | |
| } | |
| agent_load_env |
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
| [color] | |
| ui = auto | |
| [core] | |
| editor = code --wait | |
| autocrlf = false | |
| [diff] | |
| tool = code | |
| [difftool "code"] | |
| cmd = code --wait --diff $REMOTE $LOCAL | |
| [alias] |
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
| /** `⚠️ DevNote`: Should always resolve and never reject. */ | |
| type PollRequestCallback = (count: number) => Promise<{ fulfilled: boolean; value: any }>; | |
| type PollRequestOptions = { delay: number | 1000; maxTries: number | 10 }; | |
| /** | |
| * Polls a given callback function until it resolves or the `maxTries` is reached. | |
| * | |
| * The resolved value should be an object with `fulfilled` and `value` properties. | |
| * If `fulfilled` is `true`, then it will stop polling at that count and resolve the | |
| * given `value`. |
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 { unified } from 'unified'; | |
| import remarkParse from 'remark-parse'; | |
| import remarkGfm from 'remark-gfm'; | |
| import remarkRehype from 'remark-rehype'; | |
| import rehypeFormat from 'rehype-format'; | |
| import rehypeStringify from 'rehype-stringify'; | |
| import rehypeRaw from 'rehype-raw'; | |
| import { load as cheerioLoad } from 'cheerio'; | |
| (async () => { |
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 tokenizeStrAndSplitIntoChunks = (strToTokenize = '') => | |
| [...strToTokenize].reduce( | |
| (acc, letter, i, { length }) => { | |
| if (/\w+/.test(letter)) { | |
| acc[acc.length - 1] += letter; | |
| } else if (i !== length - 1 && acc.at(-1) !== '') { | |
| acc.push(''); | |
| } | |
| return acc; |
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 const triggerNativeEventFor = (elm, { event, ...valueObj }) => { | |
| if (!(elm instanceof Element)) { | |
| throw new Error(`Expected an Element but received ${elm} instead!`); | |
| } | |
| const [prop, value] = Object.entries(valueObj)[0] ?? []; | |
| const desc = Object.getOwnPropertyDescriptor(elm.__proto__, prop); | |
| desc?.set?.call(elm, value); | |
| elm.dispatchEvent(new Event(event, { bubbles: 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
| # to be updated | |
| [alias] | |
| ## disecting/inspecting/searching | |
| findkeyword = "!f() { git log -S $1 --oneline -- ':(exclude)*package-lock.json' . ; }; f" |
NewerOlder