FIND YOUR NEXT FEW LINES

Results for “code”

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

3000 snippets foundClear filters
Arduino / CText & bounded buffers

Detect truncated formatted output

Arduino / C: snprintf returns the length it would have written, excluding the null terminator.

Arduino / C✓ Tested
PythonDates & time zones

Determine whether a year is a leap year

Python: Use calendar.isleap rather than a simplified divisibility-by-four check.

Python✓ Tested
jQueryText & attributes

Disable a button

Set the live disabled property with jQuery prop.

jQuery✓ Tested
AngularReactive forms

Disable a control through its model

Disable a control through its model with a standalone Angular component and explicit browser behavior.

Angular✓ Tested
HTMLForm behavior

Disable a related group of controls

HTML: A disabled fieldset prevents editing its descendant controls and omits them from form submission.

HTML✓ Tested
Docker / ComposeCompose service options

Disable a service’s network interfaces

Docker / Compose: network_mode none leaves only the loopback interface.

Docker / Compose✓ Tested
ReactAsync work & status

Disable an action while it is pending

Disable an action while it is pending with a small React component and explicit browser behavior.

React✓ Tested
ReactGetting Started

Disable an unavailable action

Disable an unavailable action with a small React component and explicit browser behavior.

React✓ Tested
jQueryAnimation completion

Disable animations for a reduced-motion mode

jQuery: The global fx.off switch causes effects to finish immediately.

jQuery✓ Tested
Docker / ComposeGetting Started

Disable networking for a Compose command

Docker / Compose: Disable networking for a Compose command in a small Compose file.

Docker / Compose✓ Tested
Docker / ComposeGetting Started

Disable networking for a local command

Docker / Compose: Disable networking for a local command using a locally available Ubuntu image.

Docker / Compose✓ Tested
GitRestoring & revising local work

Discard an unstaged edit to one tracked file

Git: Restore copies the index version back into the selected working file.

Git✓ Tested