FIND YOUR NEXT FEW LINES

The snippet library.

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

3000 snippets foundClear filters
Docker / ComposeCompose service options

Pass dollar expressions through Compose

Docker / Compose: Double dollar signs defer expansion to the container shell.

Docker / Compose✓ Tested
Linux CommandsFinding & selecting files

Pass filenames with spaces through xargs

Linux Commands: Use null delimiters end to end instead of splitting filenames on whitespace.

Linux Commands✓ Tested
PowerShellFunctions & control

Pass named parameters from a hashtable

Keep a command’s options together in a reusable object.

splatting✓ Tested
jQueryEvent control

Pass values through a custom event

jQuery: trigger passes its extra argument array after the event object.

jQuery✓ Tested
AngularReactive forms

Patch part of a reactive form

Patch part of a reactive form with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
JavaScriptRegular expressions & URL encoding

Percent-encode one URL component

JavaScript: encodeURIComponent escapes a parameter value rather than a complete URL.

JavaScript✓ Tested
TypeScriptRegular expressions & URL encoding

Percent-encode one URL component

TypeScript: encodeURIComponent escapes a parameter value rather than a complete URL.

TypeScript✓ Tested
C#Types & reliable control flow

Perform cleanup even after an exception

C#: A finally block runs after a handled failure as well as after success.

C#✓ Tested
Docker / ComposeExecution & file transfer

Pipe input into a container process

Docker / Compose: The interactive flag keeps standard input open without allocating a terminal.

Docker / Compose✓ Tested
CSSBox dimensions & overflow

Place fixed-size boxes on the same line

CSS: Inline-block allows dimensions while participating in inline layout.

CSS✓ Tested
SQLText cleanup & matching

Place missing values after known values portably

SQL: A CASE sort key controls NULL placement without relying on engine-specific defaults.

SQL✓ Tested
SQL ServerText cleanup & matching

Place missing values after known values portably

SQL Server: A CASE sort key controls NULL placement without relying on engine-specific defaults.

SQL Server✓ Tested