More in Containers
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 what is taking up space in an image
Containers
Prints the size each layer adds, which usually points straight at the offending RUN line.
Multi-stage Dockerfile for a Node service
Containers
Builds with the full toolchain, ships only production dependencies, and runs as a non-root user.
Shell into a running container
Containers
Falls back to sh, since slim images often have no bash.
Random picks
Group an array by a key
JavaScript
Object.groupBy is available in current runtimes; the reduce version is the fallback for older ones.
Throttle with a trailing call
JavaScript
Runs at most once per interval but still fires once more after the last event, so the final state is never dropped.
A semantic, accessible form field
Web & CSS
The label is tied to the input by id, and the hint is announced with it via aria-describedby.
Delete duplicate rows, keeping the oldest
Databases
Uses a window function to number the duplicates and removes everything but the first of each group.
Read a file into a string in Go
Systems
os.ReadFile replaced ioutil.ReadFile in 1.16 and is the one-liner for small files.
Stop tracking a file without deleting it
Git
For the config file that should never have been committed. Add it to .gitignore afterwards.
Security headers for an Express app
Security
The handful worth setting even when you are not using a framework that sets them for you.
A README that people actually read
Data Formats
The order matters more than the length: what it is, how to run it, how to develop on it.