FIND YOUR NEXT FEW LINES

Results for “ratio”

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

305 snippets foundClear filters
TypeScriptPromises & iteration protocols

Run cleanup after a promise settles

TypeScript: finally runs after success or failure and normally preserves the original outcome.

TypeScript✓ Tested
JavaScriptPromises & iteration protocols

Run dependent async steps in order

JavaScript: Await one result before using it as the input of the next calculation.

JavaScript✓ Tested
TypeScriptPromises & iteration protocols

Run dependent async steps in order

TypeScript: Await one result before using it as the input of the next calculation.

TypeScript✓ Tested
RustNumbers & durations

Saturate arithmetic at the type boundary

Saturate arithmetic at the type boundary in a complete Rust program using the standard library.

Rust✓ Tested
Bash ScriptsArray operations

Select a range of array elements

Bash Scripts: Quote a sliced at-sign expansion to keep each selected element separate.

Bash Scripts✓ Tested
PowerShellArray operations

Select elements by an index range

PowerShell: An index range selects the requested array positions in order.

PowerShell✓ Tested
PythonIteration & sequences

Separate records into two lists

Python: Build two explicit partitions so callers can use both matching and rejected values.

Python✓ Tested
GitTags & repository configuration

Set an author identity only for this repository

Git: Local configuration avoids changing the identity used by unrelated repositories.

Git✓ Tested
C++Filesystem operations

Set owner-only read and write permissions

C++: Replace ordinary permission bits with the requested owner permissions.

C++✓ Tested
C++Ordering & set operations

Sort only the smallest requested prefix

C++: partial_sort orders the selected prefix without guaranteeing the order of the remainder.

C++✓ Tested
C++Ordering & set operations

Sort records by two fields

C++: Tuple comparison implements lexicographic ordering across several keys.

C++✓ Tested
JavaScriptUTC date operations

Sort timestamp strings by their parsed instants

JavaScript: Compare epoch values explicitly when date strings may contain different offsets.

JavaScript✓ Tested