Results for “library”
Small, practical examples. Search by task or narrow things down below.
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
Hide an element
jQuery: Learn how to hide an element in a complete browser example.
jQuery✓ Tested
Implement a method on a struct
Implement a method on a struct in a complete Rust program using the standard library.
Rust✓ Tested
Increment an atomic counter
Increment an atomic counter using a complete Go program with explicit sample inputs.
Go✓ Tested
Index records by a unique key
Java: Use toMap with an explicit merge rule so duplicate keys have defined behavior.
Java✓ Tested
Initialize a map entry only when absent
Java: Use computeIfAbsent when creating a collection for a new key.
Java✓ Tested
Initialize a resource only once
Initialize a resource only once using a complete Go program with explicit sample inputs.
Go✓ Tested
Initialize shared data once
Initialize shared data once in a complete Rust program using the standard library.
Rust✓ Tested
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
Insert a sibling after an element
jQuery: after preserves the selected element and adds its next sibling.
jQuery✓ Tested
Insert a sibling before an element
jQuery: before inserts outside the selected element.
jQuery✓ Tested
Insert a value while preserving sorted order
Python: Use insort on an already sorted list; insertion still shifts later list elements.
Python✓ Tested