More in Systems
Null-safe chaining in Kotlin
Systems
?. stops at the first null and ?: supplies the fallback, replacing a stack of if statements.
Iterate and collect in Rust
Systems
Filter and map fuse into a single pass; collect decides what comes out the other end.
Result and the question mark operator in Rust
Systems
? propagates the error to the caller, which is why Rust functions rarely need explicit error branches.
Context with a timeout in Go
Systems
Cancels the request and everything downstream of it after two seconds. The defer is not optional.
RAII file handling in C++
Systems
The stream closes itself when it leaves scope, whether the function returns normally or throws.
Async/await with a task group in Swift
Systems
Runs the downloads concurrently and collects them, with cancellation propagating to all of them.
Check a malloc result in C
Systems
The allocation that nobody checks is the one that fails in production.
Worker pool with a wait group in Go
Systems
Fixed number of goroutines draining a channel, with the group ensuring main waits for all of them.
Random picks
Find slow queries in Postgres
Databases
Ranks statements by total time spent. Needs the pg_stat_statements extension enabled.
Compose file with a healthcheck and dependency order
Containers
Makes the app wait until Postgres actually answers, not merely until its container has started.
Find the largest files with PowerShell
Shell
The Windows counterpart to du | sort | head.
Table sizes, largest first
Databases
Where the disk actually went, including indexes and TOAST.
Respect a reduced-motion preference
Web & CSS
One rule that disables animation for people who asked their system for less of it.
Deep clone a value
JavaScript
structuredClone handles Dates, Maps, Sets and cycles, which JSON round-tripping quietly destroys.
Search the whole history for a string
Git
Finds every commit whose diff added or removed a piece of text, including in files long since deleted.
Centre a box, two ways
Web & CSS
Grid is one line. Flex is three and gives you control over the axes separately.