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
JavaScript Throttle
Ensures a function is called at most once per specified time interval, no matter how many times the trigger fires. Ideal for scroll listeners, mousemove handlers, and window resize events where you need regular updates but not every single frame.
Kotlin Channel — Coroutine Communication
A `Channel<T>` is a coroutine-safe queue — producer side sends, consumer side receives. Bounded buffer applies backpressure. Use Flow when broadcasting; use Channel for hand-off between coroutines.
HTML Open Graph + Twitter Card Tags
How your page renders when shared to Facebook, LinkedIn, Slack, Discord, X. Every public page needs these — they dramatically improve click-through on shares.
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.
Java Files.readString / readAllLines
`java.nio.file.Files` shipped these convenience helpers in Java 8/11. Way cleaner than the legacy `FileReader` + `BufferedReader` ceremony for small/medium files.
Bash Wait For Service With Timeout
Block until a TCP port accepts connections, with a deadline. Used everywhere in docker-compose entrypoints — wait for the DB to be ready before running the app.
Rust mpsc Channel Between Threads
`std::sync::mpsc` is the standard cross-thread channel. Multiple producers, single consumer. Send any `Send` type; the receiver blocks on `recv()` until something arrives.
JavaScript Create Element Helper
A concise helper for creating DOM elements with attributes, properties, styles, event listeners, and children in one call — similar to hyperscript or JSX without a build step. Eliminates repetitive createElement / setAttribute / appendChild chains and keeps DOM construction code readable.
SQL SELECT with WHERE / ORDER BY / LIMIT
The four-clause workhorse: pick columns, filter rows, sort them, return the top N. Standard across every database.
TypeScript Typed Fetch Wrapper
A thin fetch wrapper that returns parsed JSON typed as `T`, throws on non-2xx, and accepts an AbortSignal. Single source of truth for "how this app talks to APIs."
Go errors.Join — Aggregate Multiple Errors
Go 1.20+ ships `errors.Join`, which combines multiple errors into one. Stop accumulating errors in a slice and stringifying yourself — use the standard library.
Bash Tail Logs from Multiple Containers
`docker compose logs -f` already does this — but the one-liner with --tail and filters is the more useful day-to-day workflow when you only care about recent activity from a subset of services.
Bash Prune Dangling Docker Images
Reclaim disk space from Docker. `prune` operates on stopped containers, dangling images, build cache, and unused networks. Run periodically on CI runners.
Kotlin select — Choose Among Channels
`select { }` lets a coroutine wait on multiple suspending operations and proceed when the first one is ready — like nginx select() but for channels, deferreds, and timers.
Kotlin Type-Safe Builder DSL
`@DslMarker` + lambdas with receivers let you build statically-typed DSLs that look like declarative configuration. The HTML / Gradle Kotlin DSL style.
Kotlin tailrec — Tail-Call Optimization
Mark a recursive function `tailrec` and the compiler rewrites it as a loop — no stack frame per call, no StackOverflowError on deep recursion. Function must end with itself as the FINAL expression.
Kotlin JSON Annotations — Rename, Default, Optional
Per-field annotations let you map Kotlin camelCase ↔ JSON snake_case, set defaults for missing fields, and skip nulls.
Go CSV Read/Write with encoding/csv
`encoding/csv` parses RFC 4180 CSVs. Read row-by-row with `Read()` or all at once with `ReadAll()`. Same for writing — flush with `Writer.Flush()` before closing.