Code Snippets

20+ classic snippets, filter and copy in one click

Filter Snippets

How to Use

Every developer keeps re-looking up the same small things: the regex for phone numbers or emails, how to deduplicate an array, which deep clone to pick, the canonical debounce and throttle implementations, undoing a Git commit, adding a timeout to fetch, centering a div. Searching for them one by one wastes minutes. This library gathers over 20 battle-tested snippets on a single page, each with a short usage note so you can tell at a glance whether it fits your case.

Filter by category at the top - regex, date and time, arrays and objects, strings, Git, HTTP requests, CSS tricks - or type a keyword in the search box to match titles and code, e.g. deep jumps straight to deep cloning. Every snippet has a one-click copy button right under the code block. Everything renders locally with no network requests and no sign-up, so keep this page bookmarked as your always-ready cheat sheet.

FAQ

Which language are the snippets written in?

Except for the Git and CSS categories, all snippets are JavaScript (ES6 or later) that runs directly in browsers and modern Node.js; the Git category holds command-line commands and the CSS category holds stylesheets. After copying, replace sample variable names and parameters with your own.

What exactly does the copy button copy?

It copies the full text of the code block, verbatim into the clipboard with no extra blank lines or comments. Some snippets need tweaking for your project, such as the debounce wait time, the fetch endpoint or the CSS line limit.

Will the snippets be updated over time?

The library ships with the page and updates with site releases. The bar for inclusion is a long-stable, widely verified classic pattern rather than the newest API. If you spot an error or want a high-frequency snippet added, send feedback through the site contact and we will review it.