Results for “media”
Small, practical examples. Search by task or narrow things down below.
Sum a row and its immediate predecessor
SQLite: A ROWS frame counts physical ordered rows rather than all peers with the same sort value.
SQLite✓ Tested
Apply a rule at a viewport breakpoint
CSS: Learn how to apply a rule at a viewport breakpoint in a complete browser example.
CSS✓ Tested
Stack columns on small screens
Change a two-column CSS grid to one column at a viewport breakpoint.
CSS✓ Tested
Build text incrementally with StringBuilder
C#: Append fragments instead of repeatedly concatenating intermediate strings in a loop.
C#✓ Tested
Calculate a least common multiple using a GCD
C: Divide before multiplying to reduce the risk of intermediate overflow.
C✓ Tested
Calculate a two-dimensional vector length
C++: hypot avoids unnecessary intermediate overflow in the sum of squares.
C++✓ Tested
Choose a different image for a small viewport
HTML: Picture evaluates source media conditions before falling back to the img source.
HTML✓ Tested
Compute a two-dimensional vector length
C: hypot avoids unnecessary intermediate overflow compared with squaring both inputs directly.
C✓ Tested
Disable animations for a reduced-motion mode
jQuery: The global fx.off switch causes effects to finish immediately.
jQuery✓ Tested
Find the first matching value with a fallback
Python: Pass a generator and default to next to avoid building an intermediate list.
Python✓ Tested
Hide interface controls in print layout
CSS: A print media query can retain article content while removing interactive controls.
CSS✓ Tested
Inspect every command status in a pipeline
Bash Scripts: Copy PIPESTATUS immediately before another command overwrites it.
Bash Scripts✓ Tested