FIND YOUR NEXT FEW LINES

Results for “ratio”

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

305 snippets foundClear filters
TypeScriptUTC date operations

Format whole seconds as hours minutes and seconds

TypeScript: Use integer divisions and remainders for a nonnegative duration.

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

Generate combinations across two collections

Python: Use product for a Cartesian product; this differs from selecting combinations within one collection.

Python✓ Tested
C++Ordering & set operations

Group matching values while preserving their order

C++: stable_partition keeps the relative order within both predicate groups.

C++✓ Tested
C++Filesystem operations

Handle a failed file open through stream state

C++: An unopened input stream is not an empty successful file read.

C++✓ Tested
PythonFile operations & archives

Hash a file without reading it all at once

Python: Feed fixed-size binary chunks into SHA-256 for files larger than memory.

Python✓ Tested
GitTags & repository configuration

Identify a commit exactly at a release tag

Git: Describe with exact-match refuses to invent a label for a later commit.

Git✓ Tested
GitTags & repository configuration

Ignore a personal scratch file without changing shared rules

Git: The repository-local exclude file applies only to this checkout.

Git✓ Tested
SQLBulk changes & set operations

Increment a stored value in the database

SQL: An in-database arithmetic update avoids a separate application read-modify-write step.

SQL✓ Tested
SQL ServerBulk changes & set operations

Increment a stored value in the database

SQL Server: An in-database arithmetic update avoids a separate application read-modify-write step.

SQL Server✓ Tested
PostgresBulk changes & set operations

Increment a stored value in the database

Postgres: An in-database arithmetic update avoids a separate application read-modify-write step.

Postgres✓ Tested
SQLiteBulk changes & set operations

Increment a stored value in the database

SQLite: An in-database arithmetic update avoids a separate application read-modify-write step.

SQLite✓ Tested