I hereby claim:
- I am jonsmithers on github.
- I am jonsmithers (https://keybase.io/jonsmithers) on keybase.
- I have a public key ASCK8kq3ik-vqpcrTb34aFTxGKriHs5vG0wBM_DRH5LBTAo
To claim this, I am signing this object:
export const useSystemThemePreference = (): 'dark' | 'light' => { | |
const systemPrefQuery = useMemo( | |
() => window.matchMedia('(prefers-color-scheme: dark)'), | |
[] | |
); | |
const [systemThemePreference, setSystemThemePreference] = useState< | |
'dark' | 'light' | |
>(systemPrefQuery.matches ? 'dark' : 'light'); | |
const onSystemPreference = useCallback(() => { | |
setSystemThemePreference(systemPrefQuery.matches ? 'dark' : 'light'); |
/** | |
* Calls the provided factory on first render, then returns THAT value on all | |
* renders thereafter. | |
*/ | |
export function useMakeOnce<T>(factory: () => T): T { | |
const [value] = useState(factory); | |
return value; | |
} | |
/** |
/** | |
* WeakRef is supported by major browsers but doesn't appear to be available in | |
* Typescript 4.0.5. Here is a temporary type definition until TypeScript adds | |
* native support. | |
* | |
* See https://github.com/microsoft/TypeScript/issues/32393 | |
*/ | |
interface WeakRef<V> { | |
deref(): V | undefined; |
aah | |
abacinate | |
abandon | |
abase | |
abash | |
abate | |
abbreviate | |
abdicate | |
abduce | |
abduct |
#!/bin/bash | |
read -r local_ref local_sha remote_ref remote_sha | |
check_for_wip_commits() { | |
if [[ "$remote_ref" != 'refs/heads/master' ]]; then | |
return | |
fi | |
commits=$(git log --format=%s "$remote_sha".."$local_sha") | |
local IFS=$'\n' |
Settings > External Tools > Add | |
Name: Open in Vim | |
Program: gvim | |
Arguments: $FilePath$ "+call cursor($LineNumber$, $ColumnNumber$)" "+set cursorline" "+set lines=100" "+set columns=1000" "+autocmd VimLeavePre * execute '!idea ' . expand('%') . ':' . line('.')" | |
Working directory: $ProjectFileDir$ | |
Advanced > Open console for tool output: OFF |
/** | |
* Simple Queue implementation based on a linked-list | |
*/ | |
class Q { | |
/** | |
* Construct a queue | |
* @param {array} [items] - Items to put in the queue (in left-to-right order) | |
*/ | |
constructor(items) { | |
this._size = 0 |
I hereby claim:
To claim this, I am signing this object: