FIND YOUR NEXT FEW LINES

Results for “only”

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

621 snippets foundClear filters
GitRestoring & revising local work

Stop tracking a generated file while keeping it locally

Git: Removing a path from the index leaves its working copy intact when cached is specified.

Git✓ Tested
C#Getting Started

Store a value in a named variable

C#: Give a value a descriptive name and print it.

C#✓ Tested
RustFunctions & data types

Store data in an enum variant

Store data in an enum variant in a complete Rust program using the standard library.

Rust✓ Tested
RustNumbers & durations

Subtract durations without underflow

Subtract durations without underflow in a complete Rust program using the standard library.

Rust✓ Tested
C#Data & dates

Sum integer values

Sum a C# sequence using LINQ.

C#✓ Tested
JavaNumbers & dates

Sum integer values

Reduce a Java integer stream to its sum.

Java✓ Tested
GitInspecting the working tree

Summarize added and removed lines numerically

Git: Numstat provides tab-separated counts suitable for processing.

Git✓ Tested
Docker / ComposeExecution & file transfer

Supply an environment variable to an exec process

Docker / Compose: An exec environment override applies to the new process only.

Docker / Compose✓ Tested
PythonIteration & sequences

Take a limited number of iterator values

Python: Use islice to consume only the requested prefix of a potentially unbounded iterator.

Python✓ Tested
C#LINQ transformations

Take a page from an ordered sequence

C#: Apply a stable order before Skip and Take for predictable paging.

C#✓ Tested
RustStrings & Unicode

Take Unicode characters without byte slicing

Take Unicode characters without byte slicing in a complete Rust program using the standard library.

Rust✓ Tested
GoHTTP & URLs

Test an HTTP handler without a server

Test an HTTP handler without a server using a complete Go program with explicit sample inputs.

Go✓ Tested