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 Star Projections (List<*>, etc.)
`List<*>` means "list of something I don't need to know exactly" — read-only with Any? as element type. Useful when you genuinely don't care about the parameter.
Java ReentrantLock — Beyond synchronized
`ReentrantLock` does what `synchronized` does, plus: tryLock with timeout, fair queueing, interruptible acquire, multiple condition variables. Use when synchronized's rigidity bites.
Kotlin Flow — Cold Async Streams
`Flow<T>` is a coroutine-based reactive stream — like Sequence but async. Cold (each collector restarts the producer) and respects cancellation. The backbone of modern Kotlin/Android reactive code.
Kotlin launch and Jobs
`launch` starts a coroutine and returns a `Job` you can join, cancel, or check status on. Fire-and-forget or join-when-ready style.
Kotlin distinct, distinctBy, intersect, union
Set-style ops on collections. `distinct` removes duplicates; `distinctBy` lets you key the dedupe by a derived value; `union/intersect/subtract` give you set operations.
Kotlin zip and zipWithIndex
`zip` pairs elements positionally; the result is the length of the shorter list. `withIndex()` gives you `(index, value)` pairs without the manual `forEachIndexed`.
Kotlin associate and associateBy
`associateBy` builds a `Map<K, T>` keyed by a derived value. `associateWith` keys by the items themselves with derived values. `associate` lets you build both key and value from each item.
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 Inline Value Classes (kotlin 1.5+)
`@JvmInline value class` wraps a single value with a distinct type at compile time but no runtime overhead — at runtime it's just the underlying primitive/object. Replaces typedef tricks and prevents UserId vs PostId mix-ups.
Kotlin Enums with Properties and Methods
Kotlin enums can carry constructor properties and define methods — including abstract methods overridden per constant. Way more expressive than Java enums.
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".
Kotlin Sealed Classes — Closed Type Hierarchies
`sealed` restricts subclassing to the same module. Combined with exhaustive `when`, the compiler enforces handling of every variant — refactor-friendly state machines.
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.
Go embed — Compile Assets into the Binary
Go 1.16+ `embed` lets you bundle static files (templates, web assets, SQL migrations) directly into the compiled binary — no companion files to ship.
HTML Print Stylesheet Setup
Tune the print layout: hide nav/footer, force black-on-white text, expand absolute URLs, hide images you don't want printed. Save your users from wasting paper on the page chrome.
HTML Breadcrumb Navigation (with Schema)
A keyboard- and screen-reader-friendly breadcrumb. The `aria-label="Breadcrumb"` on `<nav>` announces the role; `aria-current="page"` marks the final segment. Add the JSON-LD for Google's rich result.
HTML Newsletter Signup Form
A focused inline form: just an email + submit. Use `type="email"`, `autocomplete="email"`, `inputmode="email"` for the best mobile UX. Include an inline status/confirmation slot.
HTML Hero Section
The big "above the fold" intro on a landing page: large heading, sub-copy, primary CTA, optional supporting image. Keep the H1 unique to the page and one per document.