Programming

How one language or tool really behaves: the mechanism, a snippet that runs, and where it breaks.

GoByte Skills: 9 tracks. One mechanism, one snippet, one animation.

See the series

Latest in Programming

RSS
  • CSS from zero: the later rule can win

    Two rules with the same selector set color. The later one wins. This stylesheet ends on #0b0b0c, so that is the color of the price.

  • CSS from zero: the unit is part of the length

    16px is a length that ignores the reader's font size. 1rem follows the root font size. Use rem for type and for padding that should grow with the text.

  • CSS from zero: a class groups the declarations

    A class is the reusable group of declarations. .price sets the color, the padding, and the opacity. You put the class on each price that should look the same.

  • CSS from zero: a value has a type

    A CSS value has a type. A color is not a length, and a length is not a bare number. This rule sets a color, a length, and a number.

  • Vim macros: a register full of keystrokes

    GoByte Skills #27: a Vim macro is just keystrokes in a register. Record once with qa, paste it as text, edit it, yank it back, then run it on every line. The only program whose bug report reads: it did exactly what I did.

  • Vim's dot command: repeat any change

    GoByte Skills #26: Vim remembers your last change as keystrokes, and . replays them at the cursor. Motions are not recorded, so shape the change to carry its own position: A, not $a. One key of automation, no YAML.

  • Vim operators and motions: a grammar

    GoByte Skills #25: Vim commands are a verb plus a noun. d waits for a motion, 2w says how far, and every new motion works with every operator. Plus why cw breaks the pattern on purpose.

  • jq: a pipeline for JSON

    GoByte Skills #24: in jq, bob does not become null. He stops existing. select emits nothing for a miss, because every jq filter takes JSON in and emits a stream of zero or more values, and | runs the next step once per value.

  • xargs -P: parallelism in one flag

    GoByte Skills #23: xargs -P turns a serial loop into a worker pool. Twelve seconds of jobs finish in three. Also: the missing -n that makes -P do nothing at all.

  • Pipes: the concurrency model you already use

    GoByte Skills #22: a pipeline is every stage running at once, joined by 64 KiB buffers. awk streams in 1.6 MB. sort cannot: on a 444 MB log it held 2.1 GB. So filter first.

  • Easing: a function from progress to progress

    GoByte Skills #21: an ease is just a function from progress to progress. Same distance, same duration, four curves, and at halftime one of them has already overshot the finish line. On purpose.

  • Animate transform and opacity only

    GoByte Skills #20: animate transform and opacity, not top or width. Traced in Chrome: 57 layouts for left, 1 for x, same move. Plus why GSAP still freezes when your main thread does.