FIND YOUR NEXT FEW LINES

Results for “when”

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

230 snippets foundClear filters
PowerShellCommands & execution context

Restore an environment value after temporary use

PowerShell: Use finally so temporary process configuration does not leak to subsequent work; remove the entry when it was originally absent.

PowerShell✓ Tested
PythonStructured data & serialization

Return a small immutable named record

Python: Use NamedTuple when callers need both tuple behavior and named fields.

Python✓ Tested
Docker / ComposeContainer commands

Run a one-off container

Run a command and remove its stopped container automatically.

run✓ Tested
C++Ownership & optional values

Run cleanup through a scoped destructor

C++: A stack object’s destructor runs when its scope exits, including normal exception unwinding.

C++✓ Tested
Docker / ComposeStorage & isolation

Run with a read-only root filesystem

Add a temporary writable location while protecting the image filesystem.

read-only✓ Tested
Linux CommandsSearching text

Search for a literal string

Linux Commands: Use grep -F when the pattern contains regex metacharacters that should be literal.

Linux Commands✓ Tested
SQLSelect & filter

Select an inclusive range

Find rows with values between two endpoints.

BETWEEN✓ Tested
TypeScriptUtilities & async

Select fields with the Pick utility type

Expose a smaller view of a larger object type.

Pick✓ Tested
SQLSelect & filter

Select specific columns

Read only the fields a result needs.

SELECT✓ Tested
PythonNumbers & calculations

Select the largest values without sorting everything

Python: Use heapq.nlargest when only a small prefix of the ranking is required.

Python✓ Tested
SQLiteJSON data

Set a JSON property

Create an updated JSON document from existing text.

json_set✓ Tested
Docker / ComposeStorage & isolation

Set and inspect a memory limit

Apply a per-container limit when creating a container.

memory✓ Tested