FIND YOUR NEXT FEW LINES

Results for “only”

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

621 snippets foundClear filters
GitRemotes & additional checkouts

Read the upstream tracked by the current branch

Git: The upstream shorthand resolves the configured remote-tracking branch.

Git✓ Tested
RustIterators & transformations

Read values until a condition changes

Read values until a condition changes in a complete Rust program using the standard library.

Rust✓ Tested
GoConcurrency & cancellation

Receive a result from a goroutine

Receive a result from a goroutine using a complete Go program with explicit sample inputs.

Go✓ Tested
RustNumbers & durations

Reject a narrowing integer conversion

Reject a narrowing integer conversion in a complete Rust program using the standard library.

Rust✓ Tested
GoFiles & paths

Reject an escaping relative path

Reject an escaping relative path using a complete Go program with explicit sample inputs.

Go✓ Tested
GoErrors & validation

Reject an integer outside a byte’s range

Reject an integer outside a byte’s range using a complete Go program with explicit sample inputs.

Go✓ Tested
C#Dates & precise numbers

Reject infinity and NaN

C#: Double.IsFinite distinguishes usable finite numeric inputs from special values.

C#✓ Tested
GoErrors & validation

Reject non-finite numeric input

Reject non-finite numeric input using a complete Go program with explicit sample inputs.

Go✓ Tested
GoJSON & encoding

Reject unknown JSON object fields

Reject unknown JSON object fields using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonText validation & encoding

Remove a known suffix safely

Python: Use removesuffix to remove only a matching ending.

Python✓ Tested
Linux CommandsArchive integrity & packaging

Remove a leading directory while extracting

Linux Commands: Use strip-components only after inspecting a trusted archive layout.

Linux Commands✓ Tested
JavaScriptObject behavior & collections

Remove a Map entry and detect whether it existed

JavaScript: Map.delete returns true only when an entry was present.

JavaScript✓ Tested