Results for “per”
Small, practical examples. Search by task or narrow things down below.
Calculate each group’s integer percentage of the total
SQLite: Multiply before division and protect against a zero denominator.
SQLite✓ Tested
Cancel an asynchronous operation on unmount
Cancel an asynchronous operation on unmount with a small React component and explicit browser behavior.
React✓ Tested
Chain operations that may return None
Chain operations that may return None in a complete Rust program using the standard library.
Rust✓ Tested
Change directory only for one operation
Bash Scripts: A subshell makes a temporary directory change without affecting later commands.
Bash Scripts✓ Tested
Check an upper integer bound before adding
C++: For these nonnegative values, compare against the maximum minus the addend first.
C++✓ Tested
Check positive integer addition before performing it
C: Check the upper boundary before adding two known nonnegative integers.
C✓ Tested
Construct a record with named properties
PowerShell: PSCustomObject gives downstream pipeline commands meaningful property names.
PowerShell✓ Tested
Convert a variable to uppercase
Bash Scripts: Double caret transforms matching lowercase characters in Bash 4 or later.
Bash Scripts✓ Tested
Convert an object’s properties into a hashtable
PowerShell: Enumerate PSObject.Properties when the set of property names is known only at runtime.
PowerShell✓ Tested
Convert ASCII text to uppercase
Convert characters with toupper while avoiding signed-char undefined behavior.
C✓ Tested
Convert received ASCII letters to uppercase
Arduino / C: ctype functions should receive an unsigned character value.
Arduino / C✓ Tested
Copy a file with explicit permissions
Linux Commands: Use install to create parent directories and set the destination mode in one operation.
Linux Commands✓ Tested