Results for “date difference”
Small, practical examples. Search by task or narrow things down below.
Parse a typed command-line option
Python: Use argparse to validate and convert an integer option.
Python✓ Tested
Parse an integer safely
Handle invalid Java integer input with NumberFormatException.
Java✓ Tested
Parse an integer with validation
Validate range and trailing characters when parsing a C integer with strtol.
C✓ Tested
Prevent runtime changes to top-level properties
JavaScript: Object.freeze prevents ordinary top-level mutations; Reflect.set reports the rejected update without throwing.
JavaScript✓ Tested
Prevent runtime changes to top-level properties
TypeScript: Object.freeze prevents ordinary top-level mutations; Reflect.set reports the rejected update without throwing.
TypeScript✓ Tested
Pull without creating a merge commit
Update a branch only when its upstream can be fast-forwarded.
pull✓ Tested
Read a JSON property
Parse a JSON document and dispose it after reading in C#.
C#✓ Tested
Read named fields from a successful regex match
PowerShell: The Matches table is updated after a successful scalar match operation.
PowerShell✓ Tested
Rename a configured remote
Git: Renaming a remote updates its associated configuration and remote-tracking references.
Git✓ Tested
Rename a container without recreating it
Docker / Compose: rename updates the container name while preserving its identity.
Docker / Compose✓ Tested
Replace bytes at a known position in a binary file
C: Open in update mode and seek before writing a fixed-size replacement.
C✓ Tested
Replace one collection element
Python: Update an existing element at a known valid index.
Python✓ Tested