Results for “LED”
Small, practical examples. Search by task or narrow things down below.
Handle a failed file open through stream state
C++: An unopened input stream is not an empty successful file read.
C++✓ Tested
Handle a failed string-to-integer conversion
C++: stoi throws invalid_argument when no conversion can be performed.
C++✓ Tested
Inspect both successful and failed promise results
JavaScript: allSettled preserves input order and reports failures without rejecting the combined promise.
JavaScript✓ Tested
Inspect both successful and failed promise results
TypeScript: allSettled preserves input order and reports failures without rejecting the combined promise.
TypeScript✓ Tested
Leave room above a scrolled-to heading
CSS: Scroll-margin offsets scrollIntoView placement so a heading is not flush against the viewport edge.
CSS✓ Tested
Offer a retry after a failed attempt
Offer a retry after a failed attempt with a small React component and explicit browser behavior.
React✓ Tested
Prevent navigation from a handled link
jQuery: preventDefault cancels the browser action without cancelling event bubbling.
jQuery✓ Tested
Read an uncontrolled field through a ref
Read an uncontrolled field through a ref with a small React component and explicit browser behavior.
React✓ Tested
Read an uncontrolled form with FormData
Read an uncontrolled form with FormData with a small React component and explicit browser behavior.
React✓ Tested
Represent a decimal quantity with a scaled integer
Arduino / C: Integer hundredths avoid floating-point storage for fixed-precision values.
Arduino / C✓ Tested
Represent an enabled state
Arduino / C: Represent an enabled state on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Reset controlled form state
Reset controlled form state with a small React component and explicit browser behavior.
React✓ Tested