FIND YOUR NEXT FEW LINES

Results for “Queues & collection operations”

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

312 snippets foundClear filters
JavaScriptUTC date operations

Add calendar days in UTC

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

JavaScript✓ 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
PowerShellFile operations & integrity

Append a line while keeping earlier content

PowerShell: Add-Content appends using an explicitly selected encoding.

PowerShell✓ Tested
PowerShellArray operations

Append an item to a small array

PowerShell: The plus-equals operator builds a new array; use a generic list for repeated large additions.

PowerShell✓ Tested
Bash ScriptsArray operations

Append several items to an array

Bash Scripts: Array-plus-equals adds elements without losing spaces inside a quoted item.

Bash Scripts✓ Tested
jQueryCollections & styling

Apply classes from explicit Boolean state

jQuery: The second toggleClass argument applies a known state consistently.

jQuery✓ Tested
PowerShellArray operations

Build a mutable generic list

PowerShell: A generic list supports repeated additions without copying an entire array each time.

PowerShell✓ Tested
JavaScriptObject behavior & collections

Build an object from key-value entries

JavaScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.

JavaScript✓ Tested
TypeScriptObject behavior & collections

Build an object from key-value entries

TypeScript: Object.fromEntries converts an iterable of pairs into ordinary own properties.

TypeScript✓ Tested
PowerShellFile operations & integrity

Calculate a file’s SHA-256 digest

PowerShell: Get-FileHash hashes bytes without requiring the caller to load the whole file.

PowerShell✓ Tested
CSmall algorithms & bit operations

Calculate a fixed-window moving average

C: For this small window, sum each complete group and skip incomplete prefixes.

C✓ Tested
CSmall algorithms & bit operations

Calculate a least common multiple using a GCD

C: Divide before multiplying to reduce the risk of intermediate overflow.

C✓ Tested