`github.com/google/uuid` is the standard UUID library. v4 (random) for IDs, v7 (time-ordered) when you want UUIDs that sort chronologically and play nicely with B-tree indexes.
Uniformly shuffle an array in place using the modern Fisher-Yates algorithm. Returns the same array for chaining. Use crypto.getRandomValues for cryptographic uses.
`encoding/base64` has Standard, URL-safe, and Raw (no padding) variants. URL-safe replaces `+/` with `-_` so the output is safe in query strings and filenames.
HTML Registration Form (new-password + email-verify)
`autocomplete="new-password"` tells password managers to OFFER a generated password instead of filling an existing one. `autocomplete="email"` and `inputmode="email"` give phones the right keyboard.
A complete login form with the autocomplete attributes that browsers + password managers depend on. Missing these causes 1Password, Bitwarden, and Chrome to mis-detect the form.
The default thread-safe map. Better than `Collections.synchronizedMap` — segmented locking allows multiple readers AND writers. Use `compute`, `merge`, `putIfAbsent` for atomic compound updates.
The async/await-friendly version of `setTimeout`. The one-liner everyone re-invents — keep it in a util file. Optional AbortSignal lets you cancel mid-wait.
`chunked(n)` splits a list into NON-overlapping pieces of size n. `windowed(n)` slides a fixed-size window across — overlapping. Useful for moving averages, n-grams, batch APIs.
Numerical reducers with a selector lambda — much cleaner than `.map { ... }.max()` chains. `sumOf` is type-aware (returns Int, Long, Double, BigDecimal as appropriate).
`associateBy` builds a `Map<K, T>` keyed by a derived value. `associateWith` keys by the items themselves with derived values. `associate` lets you build both key and value from each item.
`//go:build` constraints control which files compile under which conditions — different code for Linux vs Windows, dev vs prod, with/without a feature. Standard library uses this heavily.
Stdlib templating with `{{.Field}}` placeholders, range loops, if/else, and function pipelines. Safe alternative for non-HTML text (e.g. emails, config files).
When TypeScript can't narrow a union for you, write a `x is T` predicate. Inside any block where the guard returns true, the compiler knows the narrower type.
Block one or more threads until a count of events occurs. Set the count up front; each event calls `countDown()`; waiters call `await()`. Classic "wait until all workers are ready" pattern.
The "where am I" boilerplate that every nontrivial bash script needs. Resolves symlinks correctly with realpath, falls back gracefully if realpath is missing.