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 React from 'react' | |
const NonceContext = React.createContext<string | undefined>(undefined) | |
export const NonceProvider = NonceContext.Provider | |
export const useNonce = () => React.useContext(NonceContext) |
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
{ | |
"global": { | |
"ask_for_confirmation_before_quitting": true, | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": true, | |
"show_profile_name_in_menu_bar": false, | |
"unsafe_ui": false | |
}, | |
"profiles": [ | |
{ |
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 useProxyRef = <T extends object>(value: T) => { | |
const ref = useRef(value); | |
ref.current = value; | |
return useMemo( | |
() => | |
new Proxy( | |
ref.current, | |
new Proxy(Reflect, { | |
get(target, p, receiver) { |
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
alias gut="git" | |
alias gti="git" | |
dockerclean() { | |
docker rmi --force $(docker images -f 'dangling=true' -q) | |
} |
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 React, { Reducer, useEffect, useReducer } from 'react'; | |
import { createAsyncAction } from 'typesafe-actions'; | |
import { ResponseError } from 'utils/api/request'; | |
const initialState = { | |
isLoading: false, | |
data: null, | |
error: null, | |
}; |
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 promiseThrottle = (maxParallelCalls = 10) => { | |
const queued = []; | |
let parallelCalls = 0; | |
const abortController = new AbortController(); | |
const execute = () => { | |
if (!queued.length || parallelCalls >= maxParallelCalls) return; | |
const { promiseFn, resolve, reject } = queued.shift(); | |
parallelCalls++; |
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 React, { useCallback, useEffect, useState } from 'react'; | |
/** | |
* HoC for prefetching component data from remote server. | |
* | |
* @param fetchData(props) - async function generator for fetching data | |
* @param getInitialState(props)? - function to get initialState | |
* @param depsFn(props)? - function to set deps for useEffect | |
*/ | |
function prepopulate(fetchData, getInitialState, depsFn) { |