FIND YOUR NEXT FEW LINES

Results for “all”

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

1115 snippets foundClear filters
CSSPositioning & stacking

Move a box visually without changing its layout slot

CSS: Transforms change the painted geometry while leaving surrounding normal-flow layout unchanged.

CSS✓ Tested
C#Text validation & encoding

Normalize canonically equivalent Unicode strings

C#: Normalize to NFC before an ordinal comparison of equivalent character sequences.

C#✓ Tested
ReactComponents & props

Notify a parent with a callback prop

Notify a parent with a callback prop with a small React component and explicit browser behavior.

React✓ Tested
RustTesting & reusable patterns

Own a heap-allocated value with Box

Own a heap-allocated value with Box in a complete Rust program using the standard library.

Rust✓ Tested
C++Ownership & optional values

Own one dynamically allocated value with unique_ptr

C++: make_unique allocates a value whose lifetime is tied to its owning smart pointer.

C++✓ Tested
Arduino / CBinary values & packets

Pack two small values into one byte

Arduino / C: Mask each four-bit value before combining it.

Arduino / C✓ Tested
Bash ScriptsArguments & decisions

Parse a small set of long options

Bash Scripts: Use a loop and case statement to consume a value-bearing long option.

Bash Scripts✓ Tested
CStructures & function interfaces

Pass a function as a callback

C: A typed function pointer permits behavior to be supplied to another function.

C✓ Tested
GoSlices & collections

Preallocate a slice’s capacity

Preallocate a slice’s capacity using a complete Go program with explicit sample inputs.

Go✓ Tested
Bash ScriptsText parsing & arithmetic

Print text containing percent characters literally

Bash Scripts: Never use untrusted text as the printf format string.

Bash Scripts✓ Tested
C#Types & reliable control flow

Provide a fallback for a nullable value

C#: The null-coalescing operator supplies a default only when the left side is null.

C#✓ Tested
CSSResponsive conditions & sizing

Provide a fallback for an unset custom property

CSS: The second var argument supplies a value when the custom property is unavailable.

CSS✓ Tested