FIND YOUR NEXT FEW LINES

Results for “code”

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

3000 snippets foundClear filters
JavaScriptRegular expressions & URL encoding

Resolve a relative URL against a base

JavaScript: A trailing slash makes the final base path component a directory.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Resolve a relative URL against a base

TypeScript: A trailing slash makes the final base path component a directory.

TypeScript✓ Tested
HTMLMetadata & document links

Resolve relative links against an explicit base

HTML: A base href changes how relative document URLs are resolved.

HTML✓ Tested
CSSInteraction & themes

Respect dark color preference

Apply different CSS colors when the browser requests a dark theme.

CSS✓ Tested
CSSInteraction & themes

Respect reduced motion

Disable a CSS animation when the user prefers reduced motion.

CSS✓ Tested
jQueryGetting Started

Respond to a button click

jQuery: Learn how to respond to a button click in a complete browser example.

jQuery✓ Tested
jQueryEvent control

Respond to the Enter key

jQuery: Use the event key rather than deprecated numeric key codes.

jQuery✓ Tested
jQueryGetting Started

Respond when a select value changes

jQuery: Learn how to respond when a select value changes in a complete browser example.

jQuery✓ Tested
jQueryGetting Started

Respond while a user types

jQuery: Learn how to respond while a user types in a complete browser example.

jQuery✓ Tested
Docker / ComposeContainer lifecycle

Restart an existing container

Docker / Compose: restart starts the same container again while retaining its writable layer.

Docker / Compose✓ Tested
HTMLTables & list numbering

Restart numbering at an individual list item

HTML: A value on one ordered-list item sets its ordinal and affects following items.

HTML✓ Tested
GitRestoring & revising local work

Restore a file’s content from an older commit

Git: Specify a source revision when the desired contents are not in the current index.

Git✓ Tested