Results for “all”
Small, practical examples. Search by task or narrow things down below.
Inspect a substring without allocating a copy
C++: A string_view refers to existing storage and must not outlive that storage.
C++✓ Tested
Iterate over all regular-expression matches
C++: A regex iterator yields successive matches without manually updating an offset.
C++✓ Tested
Keep a callback stable between renders
Keep a callback stable between renders with a small React component and explicit browser behavior.
React✓ Tested
Keep a tall section inside a local vertical scroller
CSS: A bounded height and overflow auto keep long content from stretching the surrounding page.
CSS✓ Tested
Keep a value inside an allowed range
Arduino / C: Keep a value inside an allowed range on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Keep caller data unchanged by passing a structure by value
C: A value parameter is a copy of the original structure.
C✓ Tested
Keep function state between calls
C: A static local variable retains its stored value for the lifetime of the process.
C✓ Tested
Keep function-local assignments separate from caller state
PowerShell: Ordinary function assignments create local variables rather than replacing the caller’s variable.
PowerShell✓ Tested
Keep separate state for separate hook calls
Keep separate state for separate hook calls with a small React component and explicit browser behavior.
React✓ Tested
List all files stored in a commit
Git: ls-tree inspects the committed tree without relying on working files.
Git✓ Tested
Load a small properties configuration
Java: Use a Reader to make the configuration character encoding explicit.
Java✓ Tested
Measure a small seekable binary file
C: Seek to the end and inspect ftell, checking both operations for errors.
C✓ Tested