FIND YOUR NEXT FEW LINES

Results for “pre”

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

429 snippets foundClear filters
TypeScriptUTC date operations

Find the final day of a month

TypeScript: Day zero of the following UTC month selects the previous month’s final day.

TypeScript✓ Tested
JavaScriptArray traversal & selection

Find the first matching array item

JavaScript: find returns undefined when no item satisfies the predicate.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Find the first matching array item

TypeScript: find returns undefined when no item satisfies the predicate.

TypeScript✓ Tested
JavaScriptArray traversal & selection

Find the position of a matching item

JavaScript: findIndex returns -1 when the predicate matches nothing.

JavaScript✓ Tested
TypeScriptArray traversal & selection

Find the position of a matching item

TypeScript: findIndex returns -1 when the predicate matches nothing.

TypeScript✓ Tested
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
PythonIteration & sequences

Flatten one level of nested lists

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

Python✓ Tested
C++Numbers & algorithms

Format decimal output

Use fixed and setprecision to print two C++ decimal places.

C++✓ Tested
Bash ScriptsArguments & decisions

Forward all arguments without changing their boundaries

Bash Scripts: Quoted at-sign preserves empty arguments and embedded spaces.

Bash Scripts✓ Tested
CSmall algorithms & bit operations

Generate a bounded Fibonacci sequence

C: Keep only the two previous values instead of using exponential recursive calls.

C✓ Tested
PostgresRows & writes

Get the latest row in each group

Select one ordered row per key with DISTINCT ON.

DISTINCT ON✓ Tested
CStructures & function interfaces

Give a reusable record type a short name

C: A typedef names a structure type without changing its representation.

C✓ Tested