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
HTML Iframe with Sandbox + lazy loading
Embed third-party content (YouTube, Stripe, maps) safely. `sandbox` restricts what the embedded page can do. `loading="lazy"` defers offscreen iframes — huge perf win for blog posts with multiple embeds.
SQL ROW_NUMBER OVER PARTITION
Number rows within a partition — the most common "give me the Nth thing per group" pattern. Pair with a WHERE rn = 1 in an outer query to keep just the top row per group.
Go json.RawMessage — Deferred Decoding
`json.RawMessage` is a `[]byte` that survives a decode pass. Use it for envelope-style JSON where one field's type depends on another (e.g. `{"type":"X","payload":{...}}`).
Bash Format Date Like a Pro
`date` accepts a format string + optional override of the date being formatted. The +%FT%TZ form gives you ISO-8601 / RFC-3339 in one call.
Python Stream Large CSV with DictReader
Iterate over a CSV row-by-row as a dict — never loading the whole file. Tolerant of UTF-8 BOMs (utf-8-sig). Generator wrapper makes consumers naturally use for/break.
PHP Recursively Delete Directory
Remove a directory and everything under it. Defensive against symlinks (unlinks the symlink rather than recursing into it). Returns the count of items removed.
PHP Email Address Obfuscator
Render an email address as HTML that is human-readable but resistant to naive scraping bots. Uses entity encoding and an optional Caesar-style ROT for the mailto link.
HTML Breadcrumb Navigation (with Schema)
A keyboard- and screen-reader-friendly breadcrumb. The `aria-label="Breadcrumb"` on `<nav>` announces the role; `aria-current="page"` marks the final segment. Add the JSON-LD for Google's rich result.
Java JUnit 5 — Basic Test
JUnit 5 is the modern standard. `@Test` marks a method as a test; `Assertions.*` provides the assertion API. `@BeforeEach` runs setup before every test.
Go strings package essentials
The most-reached-for functions in the `strings` package: Split, Contains, TrimSpace, ToLower/Upper, Replace, Index, HasPrefix/Suffix.
Rust anyhow for Application Errors
`anyhow::Result<T>` is `Result<T, anyhow::Error>` — a type-erased error that captures any other error AND adds context via `.context()`. The app-author's pick (use thiserror for libraries).
Bash Add / Subtract Time from Date
GNU date accepts natural-language deltas: "+1 day", "-3 weeks", "now + 2 hours". Combine with -d to compute against any reference date.
PHP Pretty-Print JSON
One-liner wrapper around json_encode with the right flags: indented, no escaped slashes, no escaped unicode. Use it everywhere instead of raw json_encode for human-readable output.
PHP Date Range Iterator
Yield each date in a [start, end] interval as a DateTimeImmutable, with a configurable step. Builds on DatePeriod under the hood — but exposes a generator so you can break out early.
PHP Human-Readable "Time Ago"
Convert a timestamp into a short relative phrase: "just now", "5 minutes ago", "3 days ago". Falls back to an absolute date once the delta exceeds a year.
SQL EXTRACT — Pull Parts Out of a Timestamp
`EXTRACT(field FROM timestamp)` pulls year, month, hour, day-of-week, week, epoch — whatever you need to group, filter, or render. Standard SQL across every database.
SQL SELECT DISTINCT and Counting Uniques
`DISTINCT` removes duplicate rows. Combine with `COUNT(DISTINCT col)` to count uniques in aggregations — different from `COUNT(*)`.
Go sql.NullString — Nullable DB Columns
Plain `string` can't represent SQL NULL. Use `sql.NullString` (and its siblings `NullInt64`, `NullBool`, etc.) for columns where NULL is a real value distinct from empty.