All PostsAll the stuff I've written on this sitePinpoint Bugs with Git BisectFind the exact commit that caused a bug using a less known git command. 3 min read~512 words02/10/23Include<T, U>A more inclusive complement to TypeScript's Exclude helper type - only include the parts of a union type that are assignable to another type07/09/23useFullscreen (React)Get access to the current fullscreen element, and controls to enter, exit, and toggle fullscreen.14/08/23safeViewTransitionA tiny wrapper around document.startViewTransition that respects users' prefers-reduced-motion preferences11/07/2313/09/23createManualPromiseCreate a promise that you manually resolve or reject at any time!20/06/2323/07/23Write your own Promise.all()Work your way up to the super useful Promise.all() function! 7 min read~1.3K words15/04/2319/03/23useTemporaryState (React)State that resets after a timeout.19/06/2313/09/23createPreviousMemo (SolidJS)Get the previous value of a SolidJS signal01/01/2320/06/23Event DelegationA better way to handle multiple elements with the same event handlers5 min read~868 words23/10/22FormData - My 2nd Favourite Web APIThe FormData API lets you easily access the values of inputs inside a form. 7 min read~1.4K words18/03/2322/10/22Cypress StuffMiscellaneous snippets for doing things in Cypress30/11/2212/01/23PartiallyOptionalA TypeScript generic type to make part of another type optional10/10/22Over-Engineering a Website (September 2022)How I discovered the secrets of the TMNT stack, built this website and procrastinated uni course work for 2 years. 15 min read~2.9K words22/09/2221/09/22InspectA useful function to print out the value of something with an optional message06/10/2212/01/23Tailwind CSS Hocus PluginA plugin for lazy people like me who use the same styles for hover and focus states19/09/2230/11/22Stop Vercel GitHub CommentsStop Vercel's bot from commenting on PRs and commits (and the associated emails)27/08/2220/06/23useIsMouseInactive (SolidJS)Know when the mouse hasn't moved for a period of time27/08/2207/08/23useSyncedLocalStorage (React)Save state to localStorage and sync it between hook instances, tabs and windows!07/07/2230/08/23useCssVar (React)Control a css variable from the comfort of React.04/05/2207/08/23useCopy (React)Copy to clipboard with a 'copied' timeout02/05/2219/06/23useCopy (SolidJS)Copy to clipboard with a 'copied' timeout02/05/2227/08/22File DownloadsDownload a file with or without JavaScript26/04/2213/10/22Enzyme StuffMiscellaneous snippets for working if you have to do tests with Enzyme20/02/2230/11/22PartiallyRequiredA TypeScript generic type to make part of another type required28/10/2110/10/22cxA tiny helper function to conditionally join classnames.09/05/2118/03/23useBoolean (React)Toggle and set a boolean piece of state with a slightly better interface than straight useState02/05/2118/03/23Next.js <Redirect />A <Redirect /> component like the one for react-router.02/04/2118/03/23useMounted (React)Know when the current component is mounted.02/04/2118/03/23debounceRun a function at most once every N seconds, at the end of the N seconds.28/03/21throttleRun a function at most once every N seconds, at the start of the N seconds.28/03/21useLocalStorage (React)Save state to localStorage with an interface almost identical to useState26/03/2130/08/23Hello WorldShow "Hello, World!" to your screen.24/03/2102/10/2332 posts total