FIND YOUR NEXT FEW LINES

Results for “du”

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

410 snippets foundClear filters
ReactState & reducers

Update a nested object immutably

Update a nested object immutably with a small React component and explicit browser behavior.

React✓ Tested
ReactState & reducers

Update one array item by its identifier

Update one array item by its identifier with a small React component and explicit browser behavior.

React✓ Tested
RustNumbers & durations

Use a nonnegative remainder for cyclic indexing

Use a nonnegative remainder for cyclic indexing in a complete Rust program using the standard library.

Rust✓ Tested
Arduino / CGetting Started

Use a wider type for a large count

Arduino / C: Use a wider type for a large count on an Uno with the Serial Monitor set to 9600 baud.

Arduino / C✓ Tested
Arduino / CArrays & embedded state

Use named states for a controller

Arduino / C: An enum makes state transitions easier to read than unexplained numbers.

Arduino / C✓ Tested
Arduino / CSerial protocols

Validate a complete numeric serial command

Arduino / C: Check for digits, an end pointer, and an application-specific range.

Arduino / C✓ Tested
Arduino / CEEPROM & program memory

Validate a small stored payload with a checksum

Arduino / C: Store a checksum with the payload and reject a changed byte.

Arduino / C✓ Tested
Arduino / CGetting Started

Visit every reading in a fixed array

Arduino / C: Visit every reading in a fixed array on an Uno with the Serial Monitor set to 9600 baud.

Arduino / C✓ Tested
C#Collections & data structures

Add a dictionary entry only if absent

C#: TryAdd reports a duplicate key without replacing its existing value.

C#✓ Tested
PostgresDates & series

Add an interval to a date

Perform calendar arithmetic with an interval literal.

INTERVAL✓ Tested
TypeScriptUTC date operations

Add calendar days in UTC

TypeScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.

TypeScript✓ Tested
Arduino / CData & storage

Average a fixed set of readings

Accumulate sample values without overflowing a 16-bit total.

array✓ Tested