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
Go Custom Generic Constraints
Type constraints are interfaces with type sets. Use them to express "any numeric" or "any ordered" without resorting to `any`.
Kotlin Backing Fields with Custom get/set
`field` is the implicit backing storage inside a property's getter/setter. Lets you wrap simple storage with validation, normalization, or change tracking — without writing a separate private field.
Bash Cron Entry From Script
Append a cron job idempotently — grep first to avoid duplicates on re-run. Doesn't require editing files manually.
Rust clap — Derive-Style CLI Parser
`clap` with the derive macro turns a Rust struct into a fully-featured CLI: `--help`, `--version`, validation, subcommands. The most popular CLI framework in the Rust ecosystem.
Kotlin Sealed Interfaces (Kotlin 1.5+)
Like sealed classes, but for interfaces — and a class can implement multiple sealed interfaces. Cleaner state modeling when you want "this is both a Loadable and a Cacheable".
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.
Rust if let / while let
When you only care about one variant, `if let` is shorter than `match`. `while let` keeps looping as long as the pattern matches — great for draining iterators or option-returning APIs.
JavaScript Intersection Observer (Lazy Load / Reveal)
Uses the IntersectionObserver API to trigger a callback when elements enter the viewport. The reveal pattern adds a visible class to animate elements as they scroll into view. The lazyLoad pattern loads images on demand by swapping data-src to src. Much more performant than scroll event listeners.
Rust Untyped JSON with serde_json::Value
When you don't know the JSON shape up-front, parse into `serde_json::Value` and navigate via index / get(). Type-safe pattern matching converts back to Rust types.
TypeScript Chunk Array Into Fixed-Size Pieces
Split an array into chunks of `size` items. Common building block for batch APIs — "send 50 rows per request" — and for paginated grids.
Go Prepared Statement Reuse
For repeated queries (loops, bulk inserts), prepare once and re-use. The driver caches the parsed query and saves a round trip per invocation.
JavaScript Animate Counter (Number Roll-Up)
Smoothly animates a number from a start value to an end value over a given duration using requestAnimationFrame. Supports a custom easing function (defaults to ease-out quad). Ideal for dashboard stat widgets, donation counters, and any UI where a bare static number would be less impactful.
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.
Go regexp.MustCompile + FindAll
`regexp.MustCompile` panics on a bad pattern at startup — perfect for package-level vars. Use `Find`, `FindString`, `FindAllStringSubmatch` to extract matches and capture groups.
JavaScript Debounce
Delays invoking a function until after a specified wait time has elapsed since the last time it was called. Essential for search inputs, resize handlers, and any event that fires rapidly — prevents excessive function calls and improves performance.
Go strings package essentials
The most-reached-for functions in the `strings` package: Split, Contains, TrimSpace, ToLower/Upper, Replace, Index, HasPrefix/Suffix.
Kotlin Companion Objects
A `companion object` inside a class hosts what other languages call "static" members. Methods + properties on the companion are callable as `Foo.bar()`, but unlike static, they're a real object you can extend or implement interfaces on.
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.