FIND YOUR NEXT FEW LINES

Results for “code”

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

3000 snippets foundClear filters
SQLiteText cleanup & matching

Measure the length of ordinary text

SQLite: Use the engine’s text-length function; this ASCII example has no trailing spaces.

SQLite✓ Tested
JavaEncoding & structured values

Measure UTF-8 bytes separately from characters

Java: Encode a Java string before measuring its serialized byte length.

Java✓ Tested
ReactPerformance & rendering

Memoize a component with stable props

Memoize a component with stable props with a small React component and explicit browser behavior.

React✓ Tested
ReactPerformance & rendering

Memoize a derived collection

Memoize a derived collection with a small React component and explicit browser behavior.

React✓ Tested
ReactPerformance & rendering

Memoize a sorted copy of state

Memoize a sorted copy of state with a small React component and explicit browser behavior.

React✓ Tested
ReactPerformance & rendering

Memoize an object passed to a provider

Memoize an object passed to a provider with a small React component and explicit browser behavior.

React✓ Tested
GitBranches & recovery

Merge a branch only by fast-forward

Refuse to create an unexpected merge commit.

merge✓ Tested
PowerShellHashtables & object records

Merge configuration maps with override precedence

PowerShell: Copy defaults before applying override keys so the original remains unchanged.

PowerShell✓ Tested
JavaScriptObjects & JSON

Merge object settings

Use object spread to apply JavaScript overrides to defaults.

JavaScript✓ Tested
PythonCollections

Merge two dictionaries

Combine two dictionaries into a new dictionary. When a key appears in both inputs, the value from the second dictionary wins.

dictionary✓ Tested
CArray transformations

Merge two sorted arrays

C: Advance the pointer belonging to the smaller next element and copy any remaining suffix.

C✓ Tested
C++Sequence algorithms

Merge two sorted sequences

C++: Both inputs must use the same ordering before merge is called.

C++✓ Tested