Mutate a nested array by dot path, auto-creating any intermediate arrays. Companion to getPath; together they replace a lot of isset+array_key_exists ladders.
`withContext(dispatcher)` suspends the calling coroutine, runs the block on the given dispatcher, returns the result. Use `Dispatchers.IO` for blocking I/O, `Default` for CPU work, `Main` for UI updates.
A search input usually has a visible-only icon — but screen readers need a real label. Pair a visually-hidden `<label>` with the icon, OR use `aria-label` on the input.
Use `find -print0` + `read -d ""` to safely iterate filenames that may contain spaces, newlines, or quotes. Standard bash for-loop over `find` output breaks on these.
Bash 4+ arrays — declare, access by index, get all elements with [@], length with #. The quoting matters: "${arr[@]}" preserves each element; ${arr[@]} word-splits.
Set a `deleted_at` timestamp instead of physically removing rows — preserves history and lets you "undelete". Pair with a partial index for fast queries that skip the soft-deleted rows.
Construct complex objects step-by-step with `self`-returning methods. Type-state can enforce required vs. optional fields at compile time — but the simple version is plenty for most cases.
PostgreSQL `RETURNING *` returns the rows affected by an INSERT/UPDATE/DELETE — no separate SELECT round-trip needed. SQL Server has `OUTPUT`; MySQL added `RETURNING` in MariaDB and 8.0.31+.
When you have an `interface{}` (or any) and need to dispatch on its underlying type, use `switch v := x.(type)`. Cleaner than a chain of type-assertions.
`walkdir` recursively iterates every entry under a path, skipping inaccessible directories cleanly. The standard-library alternative requires manual recursion.
`withTimeout(ms) { ... }` cancels the inner coroutine if it doesn't finish in time and throws `TimeoutCancellationException`. `withTimeoutOrNull` returns null instead.
Indexes are the difference between a 50ms query and a 50s one. Composite indexes match queries that filter / sort on the columns in order; partial indexes skip irrelevant rows for big space savings.
Numerical reducers with a selector lambda — much cleaner than `.map { ... }.max()` chains. `sumOf` is type-aware (returns Int, Long, Double, BigDecimal as appropriate).