FIND YOUR NEXT FEW LINES

Results for “one-off”

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

621 snippets foundClear filters
PythonFile operations & archives

Extract filename components

Python: Use pathlib properties to separate a directory, filename stem, and suffix.

Python✓ Tested
Arduino / CArrays & embedded state

Find a sample range in one pass

Arduino / C: Initialize extrema from the first element of a nonempty array.

Arduino / C✓ Tested
C++Sequence algorithms

Find both extremes in one algorithm call

C++: Check for a nonempty input before dereferencing the returned iterators.

C++✓ Tested
CArray transformations

Find the smallest value in a nonempty array

C: Initialize from the first element instead of assuming a numeric sentinel.

C✓ Tested
PythonMappings & sets

Find values present in exactly one set

Python: Use symmetric difference when either side can contain unmatched values.

Python✓ Tested
PythonIteration & sequences

Flatten one level of nested lists

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

Python✓ Tested
AngularPipes & formatting

Format a date in an explicit timezone

Format a date in an explicit timezone with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
SQLReporting & grouped calculations

Group by more than one field

SQL: Each distinct combination of grouping fields produces its own row.

SQL✓ Tested
SQL ServerReporting & grouped calculations

Group by more than one field

SQL Server: Each distinct combination of grouping fields produces its own row.

SQL Server✓ Tested
PostgresReporting & grouped calculations

Group by more than one field

Postgres: Each distinct combination of grouping fields produces its own row.

Postgres✓ Tested
SQLiteReporting & grouped calculations

Group by more than one field

SQLite: Each distinct combination of grouping fields produces its own row.

SQLite✓ Tested
AngularLifecycle & observable data

Initialize component data with ngOnInit

Initialize component data with ngOnInit with a standalone Angular component and explicit browser behavior.

Angular✓ Tested