Return

Snippet Vault

A small vault of commonly reached-for utility functions - debounce, clamp, sleep - browsable by tab with one-click copy and a live 'Copied' state.

snippet-vault-preview

debounce.ts
function debounce<T extends (...args: any[]) => void>(
  fn: T,
  delay: number,
) {
  let timer: ReturnType<typeof setTimeout>;
  return (...args: Parameters<T>) => {
    clearTimeout(timer);
    timer = setTimeout(() => fn(...args), delay);
  };
}

Why it helps: Everyone rewrites the same handful of utility functions per project. This packages the most common ones in a browsable, copy-ready widget.

Source

components/live/SnippetVault.tsx

Usage

example.tsx

Props

className
string

Optional CSS class for root container

snippets
Snippet[]

Array of snippet objects with label, language, and code

initialActiveIndex
number

Initial index of active snippet

This site counts visits (masked IP, rough location, device type - never anything identifying) and publishes the results openly at /visitors.