FIND YOUR NEXT FEW LINES

Results for “os”

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

809 snippets foundClear filters
HTMLNative disclosure & dialogs

Toggle a native popover from a button

HTML: The popovertarget relationship handles show and hide behavior without a click handler.

HTML✓ Tested
PostgresText cleanup & matching

Treat an empty trimmed value as missing

Postgres: NULLIF converts an empty string to NULL before a fallback is applied.

Postgres✓ Tested
PostgresGetting Started

Turn a condition into a result label

Postgres: Use CASE to describe stock availability for each row.

Postgres✓ Tested
PostgresReporting & grouped calculations

Turn known group values into columns

Postgres: Conditional aggregation gives a portable pivot when the category set is known.

Postgres✓ Tested
PostgresSchema design & transactions

Undo a multi-row transfer atomically

Postgres: The first transaction commits the fixtures. Rolling back the second transaction restores both sides of the attempted transfer.

Postgres✓ Tested
PostgresSchema design & transactions

Undo only the work after a savepoint

Postgres: After committing the fixtures, roll back a trial change while keeping earlier work in the second transaction.

Postgres✓ Tested
PostgresGetting Started

Update one row using its primary key

Postgres: Use a precise WHERE condition to change only the intended row in a scratch table.

Postgres✓ Tested
PostgresBulk changes & set operations

Update rows selected by a related table

Postgres: Use EXISTS to limit updates based on an independent eligibility table.

Postgres✓ Tested
PostgresBulk changes & set operations

Update several classifications in one statement

Postgres: A CASE expression computes the new value for each row covered by the update predicate.

Postgres✓ Tested
Docker / ComposeDockerfile patterns

Use a build argument while creating an image

Docker / Compose: ARG supplies a build-time value that is not automatically a runtime environment variable.

Docker / Compose✓ Tested
Bash ScriptsFunction scope & composition

Use a function’s exit status as a boolean result

Bash Scripts: Return zero for success and test the function directly in a conditional.

Bash Scripts✓ Tested
Bash ScriptsFunction scope & composition

Use a recursive function for a bounded calculation

Bash Scripts: A recursive factorial demonstrates local variables and a clear base case.

Bash Scripts✓ Tested