Results for “one-off”
Small, practical examples. Search by task or narrow things down below.
Collect several checked values under one name
HTML: Only checked named checkboxes become successful form controls.
HTML✓ Tested
Combine a branch’s changes into one new commit
Git: Squash prepares the combined changes in the index without recording a merge parent.
Git✓ Tested
Compose a component with named content slots
Compose a component with named content slots with a small React component and explicit browser behavior.
React✓ Tested
Consume positional arguments one at a time
Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.
Bash Scripts✓ Tested
Convert a timestamp to a different fixed offset
C#: ToOffset changes the displayed local time while retaining the same instant.
C#✓ Tested
Convert Unix seconds to an offset-aware timestamp
C#: DateTimeOffset preserves the UTC offset explicitly.
C#✓ Tested
Count a result even when it is empty or has one item
PowerShell: Wrap pipeline results in an array subexpression for consistent Count behavior.
PowerShell✓ Tested
Create a file without overwriting an existing one
Python: Use exclusive creation mode and handle FileExistsError explicitly.
Python✓ Tested
Create a reusable one-to-many lookup
C#: ToLookup groups values by key and returns an empty sequence for an unknown key.
C#✓ Tested
Decode a percent-encoded URL component
JavaScript: decodeURIComponent reverses percent encoding and throws for malformed sequences.
JavaScript✓ Tested
Decode a percent-encoded URL component
TypeScript: decodeURIComponent reverses percent encoding and throws for malformed sequences.
TypeScript✓ Tested
Delete one known scratch file
C++: filesystem::remove reports whether an item was removed and also supports empty directories.
C++✓ Tested