FIND YOUR NEXT FEW LINES

Results for “if”

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

946 snippets foundClear filters
ReactEffects & lifecycle

Restore the previous document title

Restore the previous document title with a small React component and explicit browser behavior.

React✓ Tested
ReactEffects & lifecycle

Schedule a one-time update with cleanup

Schedule a one-time update with cleanup with a small React component and explicit browser behavior.

React✓ Tested
JavaScriptObjects & JSON

Serialize an object

Turn a JavaScript object into JSON text.

JavaScript✓ Tested
ReactState & reducers

Share state between sibling controls

Share state between sibling controls with a small React component and explicit browser behavior.

React✓ Tested
ReactEffects & lifecycle

Skip synchronization when a feature is disabled

Skip synchronization when a feature is disabled with a small React component and explicit browser behavior.

React✓ Tested
Bash ScriptsVariables & text

Split a line into named fields

Read a simple delimiter-separated line into variables.

read✓ Tested
Docker / ComposeContainer lifecycle

Start an existing container and attach to its output

Docker / Compose: create records the command; start with attach runs that existing container.

Docker / Compose✓ Tested
Docker / ComposeContainer lifecycle

Stop a running container gracefully

Docker / Compose: stop sends the configured stop signal and waits before forcing termination.

Docker / Compose✓ Tested
ReactEffects & lifecycle

Subscribe to and clean up a window event

Subscribe to and clean up a window event with a small React component and explicit browser behavior.

React✓ Tested
GitInspecting the working tree

Summarize added and removed lines numerically

Git: Numstat provides tab-separated counts suitable for processing.

Git✓ Tested
GitInspecting the working tree

Test whether tracked working files changed

Git: A quiet diff returns status one for differences, so handle it in a conditional.

Git✓ Tested
AngularLifecycle & observable data

Transform an observable value

Transform an observable value with a standalone Angular component and explicit browser behavior.

Angular✓ Tested