Examples

Page 47 of 50

Browse code examples

pythonSnippet

Thread Pool Map With Timeout

Map a function over items with a bounded thread pool, preserve input order, and cancel pending work when the overall deadline expires.

rustSnippet

Hex Encode And Decode

Convert bytes to lowercase hex and back, accepting an optional prefix and embedded whitespace while rejecting invalid digits.

rustSnippet

INI File Parser

Parse INI sections and key-value pairs into a sorted map, trimming quotes and rejecting malformed headers or empty keys.

rustSnippet

Generic RAII Object Pool

Reuse expensive objects through a mutex-backed pool whose guard returns the item automatically on drop, with a factory fallback.

rustSnippet

JoinSet Task Supervisor

Spawn a batch of async tasks, collect results as they finish, and abort everything still running when a deadline expires.

typescriptSnippet

Fixed-Size Circular Buffer

Store the most recent items in a fixed-capacity circular buffer with overwrite eviction, indexed access, iteration, and clearing.