Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
SQL ARRAY_AGG and JSON_AGG (PostgreSQL)
Roll up grouped rows into a PostgreSQL array or JSON array — often a faster replacement for the application doing the same "group children under parent" join.
HTML Video Element with Captions
`<video>` with multiple `<source>` formats (MP4 + WebM), `controls`, `poster`, and a captions track via `<track kind="captions">`. All shipped with the browser — no JS player needed.
HTML Tabs (ARIA tablist pattern)
The accessible tab pattern: a `role="tablist"` container, each tab as `role="tab"`, panels as `role="tabpanel"`. `aria-selected` + `aria-controls` link them and announce state.
Rust Lifetime Annotations Basics
Lifetimes are how Rust proves references don't outlive what they point to. Most are inferred — but functions returning references from arguments need explicit `'a` to relate input and output.
PHP Index Array By Column
Rekey a list of rows by one of their column values, so $byId[42] gives the row with id=42. Equivalent to array_column($rows, null, $key).
HTML ARIA Live Region for Dynamic Announcements
Use `aria-live` on a container so screen readers announce its content changes (toast notifications, form errors, loading states). `polite` waits for a pause; `assertive` interrupts.
SQL Views and Materialized Views
A view is a named query — no data stored. A materialized view caches the result; refresh it on demand. Great for expensive joins or aggregations that don't need to be real-time.
HTML Visually Hidden Utility (.sr-only)
Hides content from sighted users but keeps it discoverable by screen readers. Use for icon-only buttons, table-row context, and form-status announcements that don't need visible text.
Bash Source Multiple Files from Directory
A common ~/.bashrc / ~/.zshrc pattern: split your config into ~/.bashrc.d/*.sh and source them all. Easier than one giant file.
Bash Sort an Array
Bash itself doesn't sort arrays — you pipe through `sort`. readarray captures the sorted output back into an array, preserving each element verbatim (including spaces).
SQL Gap Detection — Missing Days / Sequences
Find holes in a series — missing invoice numbers, days with no events, gaps in a sequence. Combine `LAG` (or `generate_series`) with a join to spot them.
Python Stdlib .env Loader (no dependency)
Parse a `.env` file into a dict and optionally export to os.environ. Skips comments and blank lines, strips surrounding quotes — no python-dotenv dependency needed.
SQL Pivot Without PIVOT (Conditional Aggregation)
Most databases don't have a real `PIVOT` keyword (SQL Server does). The portable answer is conditional aggregation — `SUM(CASE WHEN ...) AS col` for each pivoted value.
Go slices package — Modern Helpers
`slices` (Go 1.21+) ships the iteration helpers everyone wrote by hand for years: Contains, Index, Sort, SortFunc, BinarySearch, Clone, Reverse, Equal, Max/Min.
Python argparse with Subcommands
Standard-library CLI framework. Subcommands (like `git COMMAND`) require a sub-parser per command, each with its own arguments and handler.
SQL STRING_AGG / GROUP_CONCAT
Concatenate values across a group into a single delimited string. PostgreSQL/MSSQL use `STRING_AGG`; MySQL uses `GROUP_CONCAT`; SQLite has both.
Go maps package — Modern Helpers
`maps` (Go 1.21+) adds Keys, Values, Equal, Clone, Copy — replaces the slice-of-keys boilerplate you used to write to iterate a map deterministically.
SQL ROLLUP — Subtotals and Grand Totals
`GROUP BY ROLLUP` adds subtotal rows (with NULL for the rolled-up columns) plus a grand total. Drop into reports without writing UNIONs by hand.