FIND YOUR NEXT FEW LINES

Results for “library”

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

653 snippets foundClear filters
PythonFile operations & archives

Hash a file without reading it all at once

Python: Feed fixed-size binary chunks into SHA-256 for files larger than memory.

Python✓ Tested
jQueryGetting Started

Hide an element

jQuery: Learn how to hide an element in a complete browser example.

jQuery✓ Tested
RustFunctions & data types

Implement a method on a struct

Implement a method on a struct in a complete Rust program using the standard library.

Rust✓ Tested
GoConcurrency & cancellation

Increment an atomic counter

Increment an atomic counter using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaStream transformations

Index records by a unique key

Java: Use toMap with an explicit merge rule so duplicate keys have defined behavior.

Java✓ Tested
JavaQueues & collection operations

Initialize a map entry only when absent

Java: Use computeIfAbsent when creating a collection for a new key.

Java✓ Tested
GoConcurrency & cancellation

Initialize a resource only once

Initialize a resource only once using a complete Go program with explicit sample inputs.

Go✓ Tested
RustThreads & shared ownership

Initialize shared data once

Initialize shared data once in a complete Rust program using the standard library.

Rust✓ Tested
jQueryGetting Started

Insert a list item at the beginning

jQuery: Learn how to insert a list item at the beginning in a complete browser example.

jQuery✓ Tested
jQueryInsertion & wrapping

Insert a sibling after an element

jQuery: after preserves the selected element and adds its next sibling.

jQuery✓ Tested
jQueryInsertion & wrapping

Insert a sibling before an element

jQuery: before inserts outside the selected element.

jQuery✓ Tested
PythonNumbers & calculations

Insert a value while preserving sorted order

Python: Use insort on an already sorted list; insertion still shifts later list elements.

Python✓ Tested