Results for “code”
Small, practical examples. Search by task or narrow things down below.
Compute an integer weighted average
Postgres: Multiply before summing and guard a zero total weight with NULLIF.
Postgres✓ Tested
Compute an integer weighted average
SQLite: Multiply before summing and guard a zero total weight with NULLIF.
SQLite✓ Tested
Compute beyond the fixed-width integer range
PowerShell: BigInteger keeps an exact result when ordinary integer types are too small.
PowerShell✓ Tested
Concatenate arrays without mutating either input
JavaScript: concat creates a shallow combined sequence.
JavaScript✓ Tested
Concatenate arrays without mutating either input
TypeScript: concat creates a shallow combined sequence.
TypeScript✓ Tested
Configure bounded retries after a failure
Docker / Compose: on-failure with a count limits automatic restart attempts.
Docker / Compose✓ Tested
Confirm the root filesystem rejects writes
Docker / Compose: A read-only root prevents creating files outside writable mounts.
Docker / Compose✓ Tested
Connect a reusable label using useId
Connect a reusable label using useId with a small React component and explicit browser behavior.
React✓ Tested
Connect an invalid field to its explanation
Connect an invalid field to its explanation with a small React component and explicit browser behavior.
React✓ Tested
Constrain a calendar date input
HTML: Use ISO date values for the date control’s minimum and maximum.
HTML✓ Tested
Constrain and center a container
Use max-width and auto margins for a centered CSS reading area.
CSS✓ Tested
Construct a date from Unix seconds
JavaScript: Multiply seconds by 1000 before creating a Date.
JavaScript✓ Tested