FIND YOUR NEXT FEW LINES

Results for “du”

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

410 snippets foundClear filters
TypeScriptArray restructuring

Replace an array segment in place

TypeScript: splice returns removed items and inserts replacements at the chosen position.

TypeScript✓ Tested
TypeScriptGetting Started

Replace one collection element

TypeScript: Update an existing element at a known valid index.

TypeScript✓ Tested
HTMLInput constraints

Require a checkbox to be selected

HTML: A required checkbox is invalid until that individual control is checked.

HTML✓ Tested
TypeScriptGetting Started

Require two conditions to be true

TypeScript: Combine a lower and an upper bound to check whether a value is in range.

TypeScript✓ Tested
TypeScriptRegular expressions & URL encoding

Resolve a relative URL against a base

TypeScript: A trailing slash makes the final base path component a directory.

TypeScript✓ Tested
TypeScriptTypes & functions

Return the first item with a generic function

Preserve the element type while allowing empty arrays.

generics✓ Tested
TypeScriptUtilities & async

Return typed data from an async function

Await a Promise and handle failures explicitly.

async✓ Tested
SQLReporting & grouped calculations

Return zero for a sum over no rows

SQL: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

SQL✓ Tested
SQL ServerReporting & grouped calculations

Return zero for a sum over no rows

SQL Server: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

SQL Server✓ Tested
PostgresReporting & grouped calculations

Return zero for a sum over no rows

Postgres: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

Postgres✓ Tested
SQLiteReporting & grouped calculations

Return zero for a sum over no rows

SQLite: SUM produces NULL for an empty input; COALESCE supplies the desired reporting default.

SQLite✓ Tested
TypeScriptArray restructuring

Reverse a copy while preserving the original

TypeScript: Copy before reverse because reverse mutates the array it receives.

TypeScript✓ Tested