FIND YOUR NEXT FEW LINES

Results for “Collections & data structures”

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

694 snippets foundClear filters
PythonStructured data & serialization

Represent a record with a dataclass

Python: Generate initialization and convert a typed record to a dictionary.

Python✓ Tested
TypeScriptUtilities & async

Return typed data from an async function

Await a Promise and handle failures explicitly.

async✓ Tested
HTMLTables & list numbering

Separate table headings data and totals

HTML: Thead, tbody, and tfoot group rows according to their purpose.

HTML✓ Tested
Docker / ComposeStorage & isolation

Share data through a named volume

Keep a file across two short-lived containers.

volume✓ Tested
RustThreads & shared ownership

Share immutable data with Arc

Share immutable data with Arc in a complete Rust program using the standard library.

Rust✓ Tested
RustFunctions & data types

Store data in an enum variant

Store data in an enum variant in a complete Rust program using the standard library.

Rust✓ Tested
RustFunctions & data types

Accept different types with a generic function

Accept different types with a generic function in a complete Rust program using the standard library.

Rust✓ Tested
jQueryCollections & styling

Apply classes from explicit Boolean state

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

jQuery✓ Tested
Docker / ComposeNetworks & volume metadata

Assign a network-scoped alias

Docker / Compose: An alias gives an endpoint an additional name on that network.

Docker / Compose✓ Tested
Docker / ComposeNetworks & volume metadata

Attach an existing container to another network

Docker / Compose: network connect adds an attachment without recreating the container.

Docker / Compose✓ Tested
jQueryEvent control

Attach configuration when registering a handler

jQuery: event.data carries the registration-time data object.

jQuery✓ 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