Official Examples

CSSOct 22, 2026

Fluid type scale with clamp

Official Bits example. A responsive typography scale built from CSS custom properties and clamp for smooth resizing.

CSSdesignresponsivetypography
010
GoOct 22, 2026

Graceful HTTP server shutdown

Official Bits example. Run an HTTP server that drains in-flight requests and exits cleanly on SIGINT or SIGTERM.

gohttpgraceful-shutdownServer
011
JavaScriptOct 22, 2026

Debounce a function

Official Bits example. A small debounce utility with a cancel method, useful for search inputs, resize handlers and other noisy events.

functionsjavascriptperformanceutility
011
PythonOct 22, 2026

Retry decorator with backoff

Official Bits example. Retry a flaky function with exponential backoff and jitter while preserving its metadata.

resiliencedecoratorspythonretry
011
BashOct 22, 2026

Safe Bash script template

Official Bits example. A strict-mode Bash skeleton with argument validation and an EXIT trap for cleanup.

safetytemplateshellbash
011
RubyOct 22, 2026

Memoize expensive methods

Official Bits example. A tiny Memoizable module that caches method results per argument list without external gems.

cachingmetaprogrammingrubyperformance
011
RustOct 22, 2026

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.

rustiofilescli
011
TypeScriptOct 22, 2026

Deep partial type

Official Bits example. A recursive DeepPartial helper that makes nested configuration objects easy to override in tests and defaults.

genericstypescripttypesutility
011
JavaOct 22, 2026

Group and sum with streams

Official Bits example. Aggregate orders by customer using the Java Stream API, records and Collectors.groupingBy.

functionalstreamscollectionsjava
011
DockerfileOct 22, 2026

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.

dockercontainersdeploymentnodejs
011
JSONOct 22, 2026

Package scripts for CI

Official Bits example. A package.json scripts block that runs linting, tests and the production build in a predictable order.

toolingscriptsnpmjson
011
C#Oct 22, 2026

Async GitHub API client

Official Bits example. Fetch a user's repositories with HttpClient, System.Text.Json source-friendly records and cancellation support.

asyncdotnetcsharphttp
010
SQLOct 22, 2026

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.

analyticspostgresqlwindow-functionssql
010
YAMLOct 22, 2026

GitHub Actions Node CI

Official Bits example. A compact GitHub Actions workflow that lints, tests and builds a Node project on two supported versions.

github-actionsnodejsciyaml
010
HTMLOct 22, 2026

Accessible page skeleton

Official Bits example. A minimal HTML document with a skip link, landmark elements and a focusable main region.

semanticstemplateaccessibilityHTML
010
PHPOct 22, 2026

Safe PDO query helper

Official Bits example. A small prepared-statement helper plus a PDO configuration that disables emulated prepares.

databasephpsecuritypdo
010