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
Kotlin reified Type Parameters
In an `inline` function, a `reified` type parameter survives erasure — you can use `T::class`, `is T`, `as T` at runtime. The killer use-case for JSON parsers ("give me a List<User>").
Bash docker exec — Drop Into Running Container
`docker exec` is your debugger. Get a shell, inspect env, tail logs, run one-off commands inside a live container.
Kotlin Sorting Collections
`sortedBy { ... }` returns a sorted copy. `sortedWith(compareBy { ... })` chains tie-breakers cleanly. Avoid `sortBy` (in-place) on read-only lists.
HTML Figure + Figcaption (Images, Code, Charts)
`<figure>` groups self-contained illustrative content with its caption. Use it for images, code blocks, charts, diagrams — anything that's referenced from the surrounding text but stands on its own.
Go struct Tags for JSON Marshaling
Backtick string tags on struct fields control how `encoding/json` serializes them — rename to camelCase, omit zero values, skip entirely. The same tag system is used by many other libraries.
Python pathlib Quick Reference
Forget os.path.* — pathlib.Path is the modern, OS-aware way to work with paths. Operator overloading for joins, attribute access for components, methods for reads/writes/iterations.
Kotlin Smart Casts
After a successful `is` check (or null check), the compiler "smart-casts" the variable to the narrower type in that scope. No explicit cast needed.
SQL Median with PERCENTILE_CONT
SQL has no `MEDIAN()` — use `PERCENTILE_CONT(0.5) WITHIN GROUP`. The same function gets you P95, P99, quartiles, etc. for latency analysis.
Kotlin String Templates
Embed expressions inside double-quoted strings with `$var` or `${expr}`. No printf/format needed for 95% of cases. Raw strings (triple-quoted) skip escape processing for multiline / regex / SQL.
Kotlin observable — Listen for Property Changes
`Delegates.observable(initial) { prop, old, new -> ... }` fires a callback every time the property changes. Useful for state-tracking, simple observability without a full reactive lib.
Bash Extract JSON Field with jq
jq is the de-facto JSON tool. Pipe any JSON in, get a parsed/filtered/reshaped result out. Indispensable in deploy scripts that consume API output.
Kotlin Safe Call Chain + Elvis Default
`?.` is the safe-call operator — short-circuits to `null` at the first null in a chain. Pair with `?:` (Elvis) for "this or a default". Replaces nested if-not-null ladders.
SQL EXPLAIN / EXPLAIN ANALYZE
`EXPLAIN` shows the query plan; `EXPLAIN ANALYZE` actually runs it and shows real timings. The first tool when a query is slow — look for sequential scans on big tables.
PHP Human-Readable File Size
Format a byte count as a human-friendly string (KB / MB / GB / TB). Defaults to base-1024 sizes; pass base 1000 for SI units.
Kotlin Compose Modifier Chain
`Modifier` is how you customize composables — padding, click handlers, background, size, alignment. Order matters: each modifier wraps the previous one.
Kotlin Type Aliases
`typealias` gives a shorter / more meaningful name to an existing type. Compile-time only — no new type, no overhead. Great for taming verbose function types or generic parameters.
Kotlin coroutineScope and Structured Concurrency
`coroutineScope { }` waits for ALL its children before returning. If any child throws, the others are cancelled. The cornerstone of structured concurrency — no leaked coroutines.
Bash URL-Encode and URL-Decode
Encode and decode URL-safe strings entirely in bash — no python or external tool required. Useful in pure-shell deployment scripts that need to build query strings.