Skip to content

Instantly share code, notes, and snippets.

View leifarriens's full-sized avatar
🛠️

Leif Arriens leifarriens

🛠️
View GitHub Profile
@leifarriens
leifarriens / github-multi-account.md
Created March 11, 2025 18:57
Multiple GitHub accounts on a single computer

Step 1: Generate SSH keys for each GitHub account

  1. Open a terminal on your computer.

  2. Generate a new SSH key for your first GitHub account. Replace [email protected] with the email associated with your GitHub account.

    ssh-keygen -t ed25519 -C "[email protected]"

When prompted, save the key with a descriptive name, such as id_ed25519_first_account.

export function useDebounceEffect(
effect: React.EffectCallback,
delay = 500,
deps?: React.DependencyList | undefined,
) {
useEffect(() => {
const debounce = setTimeout(() => {
effect();
}, delay);
return () => clearTimeout(debounce);
@leifarriens
leifarriens / react-use-script.js
Created July 30, 2022 04:59
React Hook to load script
function useScript(id, src, options = {}) {
const { persist = true, onLoad } = options;
const [ready, setReady] = useState(false);
useEffect(() => {
const domScript = document.getElementById(id);
if (!domScript) {
const script = document.createElement('script');
@leifarriens
leifarriens / inferPropTypes.tsx
Last active May 31, 2022 03:33
NextJS infer prop types from getServerSideProps
import type { GetServerSidePropsContext, InferGetServerSidePropsType } from 'next';
import Head from 'next/head';
const Home = ({ host }: InferGetServerSidePropsType<typeof getServerSideProps>) => {
return (
<>
<Head>
<title>Home Page</title>
</Head>