Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
{"lastUpload":"2020-09-01T19:09:55.494Z","extensionVersion":"v3.4.3"} |
# to be updated | |
[alias] | |
## disecting/inspecting/searching | |
findkeyword = "!f() { git log -S $1 --oneline -- ':(exclude)*package-lock.json' . ; }; f" |
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 })); |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
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; |
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 () => { |
/** `⚠️ 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`. |
[color] | |
ui = auto | |
[core] | |
editor = code --wait | |
autocrlf = false | |
[diff] | |
tool = code | |
[difftool "code"] | |
cmd = code --wait --diff $REMOTE $LOCAL | |
[alias] |
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 |