Results for “one”
Small, practical examples. Search by task or narrow things down below.
Update several classifications in one statement
Postgres: A CASE expression computes the new value for each row covered by the update predicate.
Postgres✓ Tested
Update several classifications in one statement
SQLite: A CASE expression computes the new value for each row covered by the update predicate.
SQLite✓ Tested
Use an alternate value only when a variable is nonempty
Bash Scripts: The colon-plus expansion returns its word only when the parameter has a nonempty value.
Bash Scripts✓ Tested
Verify that a one-off container was removed
Docker / Compose: An automatically removed container no longer appears in an exact-name listing.
Docker / Compose✓ Tested
Wrap a collection in one shared parent
jQuery: wrapAll places all selected elements inside one wrapper.
jQuery✓ Tested
Write several messages through one file descriptor
Bash Scripts: Open a destination once and close the descriptor after writing.
Bash Scripts✓ Tested
Advance a date by a number of days
Python: Use timedelta so month and year boundaries are handled automatically.
Python✓ Tested
Check the Gregorian leap-year rule
Java: Use Year.isLeap rather than checking divisibility by four alone.
Java✓ Tested
Connect a reusable label using useId
Connect a reusable label using useId with a small React component and explicit browser behavior.
React✓ Tested
Convert a duration to hours and minutes
Python: Use divmod to split nonnegative whole seconds into display components.
Python✓ Tested
Convert a Unix timestamp to aware UTC
Python: Supply timezone.utc so the result does not depend on the machine time zone.
Python✓ Tested
Convert an aware datetime to another offset
Python: Use astimezone for conversion; replacing tzinfo alone does not convert an instant.
Python✓ Tested