Combine `instanceof` with a variable binding — no separate cast needed. Eliminates the most common "check then cast" bug pattern and is significantly less verbose.
`x.run { ... }` is `apply` but returns the block's LAST expression instead of `x`. Top-level `run { ... }` (no receiver) is useful for inline computation blocks.
Run a callable up to N times; log each failed attempt and bubble the last exception. Compact, no dependencies, useful for transient failures (S3 puts, email sends, etc.).
Tests live in `*_test.go` files alongside the code. Functions named `TestXxx(t *testing.T)` are picked up by `go test`. Use `t.Errorf` for soft fails (continues running), `t.Fatalf` for hard fails.
A foreign key prevents orphan rows. The `ON DELETE` clause decides what happens to children when the parent goes away: `CASCADE`, `SET NULL`, `RESTRICT`, `NO ACTION`.
A tiny key-value cache with TTL, persisted as a serialized PHP file per key. Good enough for memoizing expensive computations on a single machine; replace with Redis when scaling out.
`<audio>` is video's simpler sibling. Use it for podcasts, music samples, sound effects on play. Same multi-`<source>` pattern for cross-browser format support.
A 30-line PSR-3 compatible logger you can drop into any project that expects \Psr\Log\LoggerInterface. Writes to a file using the JSON structured format.
JSON-LD is Google's preferred way to mark up structured data for rich search results. Drop it in a <script type="application/ld+json"> tag in <head>. Validate with Google's Rich Results Test.
Backtick string tags on struct fields control how `encoding/json` serializes them — rename to camelCase, omit zero values, skip entirely. The same tag system is used by many other libraries.
Parallelize I/O-bound tasks (HTTP requests, file reads, DB queries) without writing thread management code. The default thread count is min(32, os.cpu_count() + 4) — usually the right call.
Generics start unbounded — you can't access any properties of `T`. `T extends { … }` adds a constraint so the body can safely use known shape, while callers can still pass in narrower types.
`tracing` is the structured-logging story for async Rust — better than `log` for anything tokio-based. Drop in this initializer and use `info!`, `warn!`, `error!` macros throughout.
`github.com/google/uuid` is the standard UUID library. v4 (random) for IDs, v7 (time-ordered) when you want UUIDs that sort chronologically and play nicely with B-tree indexes.