Official Examples
Fluid type scale with clamp
Official Bits example. A responsive typography scale built from CSS custom properties and clamp for smooth resizing.
Graceful HTTP server shutdown
Official Bits example. Run an HTTP server that drains in-flight requests and exits cleanly on SIGINT or SIGTERM.
Debounce a function
Official Bits example. A small debounce utility with a cancel method, useful for search inputs, resize handlers and other noisy events.
Retry decorator with backoff
Official Bits example. Retry a flaky function with exponential backoff and jitter while preserving its metadata.
Safe Bash script template
Official Bits example. A strict-mode Bash skeleton with argument validation and an EXIT trap for cleanup.
Memoize expensive methods
Official Bits example. A tiny Memoizable module that caches method results per argument list without external gems.
Read a file line by line
Official Bits example. A small, reusable helper that reads a text file into a Vec of lines using buffered I/O.
Deep partial type
Official Bits example. A recursive DeepPartial helper that makes nested configuration objects easy to override in tests and defaults.
Group and sum with streams
Official Bits example. Aggregate orders by customer using the Java Stream API, records and Collectors.groupingBy.
Multi-stage Node image
Official Bits example. Build a small production Node image with cached dependencies, a separate build stage and a non-root user.
Package scripts for CI
Official Bits example. A package.json scripts block that runs linting, tests and the production build in a predictable order.
Async GitHub API client
Official Bits example. Fetch a user's repositories with HttpClient, System.Text.Json source-friendly records and cancellation support.
Top N rows per group
Official Bits example. Rank rows inside each partition with ROW_NUMBER and keep the top N per group using a portable CTE.
GitHub Actions Node CI
Official Bits example. A compact GitHub Actions workflow that lints, tests and builds a Node project on two supported versions.
Accessible page skeleton
Official Bits example. A minimal HTML document with a skip link, landmark elements and a focusable main region.
Safe PDO query helper
Official Bits example. A small prepared-statement helper plus a PDO configuration that disables emulated prepares.