Skip to content

Instantly share code, notes, and snippets.

@thinkawitch
thinkawitch / abort-controller.js
Last active July 6, 2022 14:18 — forked from kentcdodds/abort-controller.js
React hook for AbortController with reset
function useAbortController(runEffect=false, runLayoutEffect=false) {
const acRef = useRef()
const getAbortController = useCallback(() => {
if (!acRef.current) {
acRef.current = new AbortController()
}
return acRef.current
}, []);
if (runEffect) {
@thinkawitch
thinkawitch / _variables.scss
Created October 2, 2020 10:56
vertical resize for css grid in react hooks
/* css vars names must be unique */
:root {
--ezc-color-gray-100: #f8f9fa;
--ezc-color-gray-200: #e9ecef;
--ezc-color-gray-300: #dee2e6;
--ezc-color-gray-400: #ced4da;
--ezc-color-gray-500: #adb5bd;
--ezc-color-gray-600: #6c757d;
@thinkawitch
thinkawitch / gist:4b0f2165f2fc938d65f2ce5c8a6edeb1
Last active May 17, 2019 19:48
Git: extract commits / files from branch to create new clean repo with prev history
# https://stackoverflow.com/questions/28983842/remote-rejected-shallow-update-not-allowed-after-changing-git-remote-url
# https://stackoverflow.com/questions/29748197/how-to-clone-seed-kick-start-project-without-the-whole-history
1. git clone --single-branch --branch=commerce --depth=198 git@git.hostname.com:andrew/project.git ./
2. git remote remove origin
3. put the starting point hash to grafts (the commit you with to start new repo from, the last one of --depth)
echo "fc4c845f42adf3447f3b531398c69451bb11f6e7" >> .git/info/grafts
4. git filter-branch -- --all
5. rm -fr ./.git/refs/original