Skip to content

Instantly share code, notes, and snippets.

@TClark1011
TClark1011 / AccordionController.tsx
Last active December 18, 2024 23:35
Work (BTC) Helpers
import {
PropsWithChildren,
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useReducer,
} from "react";
@TClark1011
TClark1011 / Action.ts
Last active April 15, 2025 05:48
TS - Helpful Utilities
// branded types to allow for better type inference
// with default generic types
/* eslint-disable @typescript-eslint/naming-convention */
type NO_PAYLOAD = {
JgJES6BF8uyaOwF1: "FY7eBhPYJlqOxuVp";
};
type OPTIONAL_PAYLOAD = {
A7nWdXs0r5RLuHRf: "zPcrRNRIl4r5IHbA";
};
@TClark1011
TClark1011 / Event Functions In React.md
Last active October 22, 2024 05:12
React Utilities

Event Functions In React

When writing functions that can handle various different types of dom events in react, it's important to remember that react uses its own custom type of events which it calls "synthetic events". To best handle these, we create a custom type which can be either a native event or a react synthetic event.

Example code

import type { SyntheticEvent } from 'react';

type ReactCompatibleEvent = Event | SyntheticEvent;
@krisbolton
krisbolton / fix-USB-showing-up-as-two-partitions.md
Last active November 8, 2025 10:43
How to fix a USB drive showing up as two drives (fragmented into multiple partitions) on Windows

How to fix a USB drive showing up as two drives (fragmented into multiple partitions) on Windows:

  1. Hold the Windows key and press X, select PowerShell (Admin), select Yes to the pop-up. You can also use Command Prompt.
  2. In the Powershell interface type diskpart to enter the disk partition tool.
  3. Type list disk to see all disks listed.
  4. Select the USB drive by typing select disk [NUMBER]. Be careful to select the correct drive.
  5. Type clean. An error will occur if you have the drive folder open, close the window and repeat the command if this happens.
  6. Type create partition primary.
  7. Type format fs=ntfs quick to format the drive (you can also choose to set fs=fat32).
  8. Type active.