Demo Type · 09

Slide deck

A handful of full-bleed slides, one big idea each — for summarizing a whole topic at a glance.

This is a copyable exemplar. To use it in a lesson, lift the <section id="deck"> block below into a page built from assets/lesson-template.html and keep the design tokens intact.

1

Use this when…


Reach for a slide deck when you want someone to grasp the shape of a whole topic in two minutes, before they dive into the detail. Each slide carries exactly one idea in large type, so the reader is never asked to juggle two thoughts at once. They click through — or tap an arrow key — and the story builds one beat at a time.

Think of it like… flashcards held up one at a time. You don't read a wall of text; you watch a single idea appear, let it land, then turn to the next card. The progress bar is the thickness of the stack shrinking in your hand.

How the deck works

Slides are absolutely-positioned siblings stacked in one .deck-stage; only the one with .current is visible and focusable. Navigation is a single go(index) function clamped to [0, n-1] that swaps the current class, updates the counter, fills the progress bar to (index+1)/n, syncs the dot rail's aria-current, and disables the Prev/Next buttons at the ends.

Keyboard + accessibility

A keydown listener maps ArrowRight/ArrowLeft (plus Home/End) to go(). Controls are real <button> elements; the stage is an aria-roledescription="carousel" region with aria-live="polite" so a screen reader announces each slide change. Motion respects prefers-reduced-motion.

// the whole engine — one clamp, one render
function go(i) {
  idx = Math.max(0, Math.min(i, slides.length - 1));
  render();           // toggle .current, fill bar, sync dots + counter
}
addEventListener('keydown', e => {
  if (e.key === 'ArrowRight') go(idx + 1);
  if (e.key === 'ArrowLeft')  go(idx - 1);
});
2

Caching, in 6 slides


Click Next / Back, tap a dot, or use the left/right arrow keys. The bar at the top shows how far through you are.

The big idea

A cache is a shortcut to an answer you already paid for.

Computing something is slow and expensive. Once you've done it, keep the result nearby so the next request is nearly free.

Why it pays off

Most requests ask the same few questions.

A small fraction of items get asked for over and over. Cache those hot items and you serve the crowd without touching the slow source.

Hit vs miss

Every lookup is a hit or a miss.

A hit finds the answer in the cache — fast. A miss falls through to the slow source, then stores the result for next time.

The hard part

Stale data is the price of speed.

A cached answer can fall out of date the moment the real source changes. Knowing when to throw a copy away is the whole game.

Eviction & expiry

Two clocks decide what to drop.

A TTL expires an entry after a set time; an LRU policy evicts whatever was used least when space runs out. Tune both to your data.

Takeaway

Cache the hot, expire the stale, measure the hit rate.

If your hit rate is high and your data is fresh enough for the job, the cache is earning its keep. If not, tune the TTL or the size — and measure again.

1 / 6 Use arrow keys