Results for “Small algorithms & bit operations”
Small, practical examples. Search by task or narrow things down below.
Stack columns on small screens
Change a two-column CSS grid to one column at a viewport breakpoint.
CSS✓ Tested
Store a small unsigned value
Arduino / C: Store a small unsigned value on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Subscribe to a small external store safely
Subscribe to a small external store safely with a small React component and explicit browser behavior.
React✓ Tested
Toggle a bit with an XOR mask
Arduino / C: XOR flips selected bits and leaves all other bits unchanged.
Arduino / C✓ Tested
Use a small table variable
Declare rows for a short batch.
table variable✓ Tested
Validate a small stored payload with a checksum
Arduino / C: Store a checksum with the payload and reject a changed byte.
Arduino / C✓ Tested
Copy a file and preserve its metadata
Python: Use copy2 for a file copy that also attempts to preserve timestamps and permission bits.
Python✓ Tested
Set owner-only read and write permissions
C++: Replace ordinary permission bits with the requested owner permissions.
C++✓ Tested
Add calendar days in UTC
JavaScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
JavaScript✓ Tested
Add calendar days in UTC
TypeScript: Use UTC date setters to cross month boundaries without local daylight-saving effects.
TypeScript✓ Tested
Append a line while keeping earlier content
PowerShell: Add-Content appends using an explicitly selected encoding.
PowerShell✓ Tested
Append several items to an array
Bash Scripts: Array-plus-equals adds elements without losing spaces inside a quoted item.
Bash Scripts✓ Tested