FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

3000 snippets foundClear filters
CSSGetting Started

Make keyboard focus visible

CSS: Learn how to make keyboard focus visible in a complete browser example.

CSS✓ Tested
GoGetting Started

Map a command with switch

Map a command with switch using a complete Go program with explicit sample inputs.

Go✓ Tested
Arduino / CData & storage

Map an input range to an output range

Scale an integer reading to a different interval.

map✓ Tested
JavaScriptArray restructuring

Map items to multiple output values

JavaScript: flatMap combines mapping and a one-level flattening operation.

JavaScript✓ Tested
TypeScriptArray restructuring

Map items to multiple output values

TypeScript: flatMap combines mapping and a one-level flattening operation.

TypeScript✓ Tested
HTMLText semantics

Mark a longer quotation and its source

HTML: Blockquote marks quoted content; a visible source link remains useful because cite is metadata.

HTML✓ Tested
ReactPerformance & rendering

Mark a nonurgent state update as a transition

Mark a nonurgent state update as a transition with a small React component and explicit browser behavior.

React✓ Tested
HTMLAccessible structure

Mark a self-contained article

HTML: Article identifies a standalone composition that can be read independently.

HTML✓ Tested
HTMLText semantics

Mark a short quotation within a sentence

HTML: The q element identifies an inline quotation and allows native quotation marks.

HTML✓ Tested
HTMLGetting Started

Mark emphasis and importance

HTML: Learn how to mark emphasis and importance in a complete browser example.

HTML✓ Tested
HTMLMetadata & document links

Mark the language of a phrase inside a page

HTML: An element-level lang attribute identifies a language change within the document.

HTML✓ Tested
HTMLLinks & accessibility

Mark up a machine-readable date

Pair a readable date with an ISO datetime attribute in HTML.

HTML✓ Tested