FIND YOUR NEXT FEW LINES

Results for “to”

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

3000 snippets foundClear filters
CSSVisual treatment & accessibility

Fit an entire image inside a differently shaped box

CSS: Contain preserves the image aspect ratio while keeping all of it visible inside the specified content box.

CSS✓ Tested
CSSResponsive design

Fit as many columns as possible

Use auto-fit and minmax for a CSS grid that responds to its available width.

CSS✓ Tested
JavaScriptArray restructuring

Flatten a single nesting level

JavaScript: flat defaults to a depth of one and creates a new array.

JavaScript✓ Tested
TypeScriptArray restructuring

Flatten a single nesting level

TypeScript: flat defaults to a depth of one and creates a new array.

TypeScript✓ Tested
JavaStream transformations

Flatten nested collections

Java: Use flatMap to concatenate nested Java lists into one stream.

Java✓ Tested
RustIterators & transformations

Flatten nested collections

Flatten nested collections in a complete Rust program using the standard library.

Rust✓ Tested
C#LINQ transformations

Flatten nested collections with SelectMany

C#: Concatenate the items from several sequences into one sequence.

C#✓ Tested
PythonIteration & sequences

Flatten one level of nested lists

Python: Use a nested comprehension when each input item is itself an iterable.

Python✓ Tested
ReactRefs & DOM interaction

Focus an input through a ref

Focus an input through a ref with a small React component and explicit browser behavior.

React✓ Tested
AngularEvents & DOM interaction

Focus an input through its template reference

Focus an input through its template reference with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
Docker / ComposeContainer lifecycle

Force a disposable container to stop

Docker / Compose: kill sends SIGKILL by default without a graceful shutdown interval.

Docker / Compose✓ Tested
PowerShellDates & numeric validation

Format a bounded duration as hours minutes and seconds

PowerShell: TimeSpan can format duration components with escaped separators.

PowerShell✓ Tested