Results for “library”
Small, practical examples. Search by task or narrow things down below.
Post URL-encoded form data
jQuery: post sends a data object as form-encoded fields by default.
jQuery✓ Tested
Preallocate a slice’s capacity
Preallocate a slice’s capacity using a complete Go program with explicit sample inputs.
Go✓ Tested
Preconfigure some function arguments
Python: Use partial to produce a callable with selected arguments already bound.
Python✓ Tested
Preserve a large JSON integer
Preserve a large JSON integer using a complete Go program with explicit sample inputs.
Go✓ Tested
Preserve map insertion order
Java: Use LinkedHashMap when iteration should follow the order keys were first added.
Java✓ Tested
Prevent navigation from a handled link
jQuery: preventDefault cancels the browser action without cancelling event bubbling.
jQuery✓ Tested
Print a collection for inspection
Print a collection for inspection in a complete Rust program using the standard library.
Rust✓ Tested
Print a number with two decimal places
Python: Format a small decimal value consistently for display.
Python✓ Tested
Print a number with two decimal places
Java: Format a small decimal value consistently for display.
Java✓ Tested
Process a slice in bounded chunks
Process a slice in bounded chunks in a complete Rust program using the standard library.
Rust✓ Tested
Process a text file one line at a time
Java: Use a buffered reader to avoid loading a large file into memory.
Java✓ Tested
Process the lines of an in-memory string
Java: Use String.lines to handle common line terminators without retaining them.
Java✓ Tested