TIL is my collection of short, technical daily learnings. 210 and counting.
The Outbox Pattern
Today I learned about the Outbox Pattern. ...
TIL is my collection of short, technical daily learnings. 210 and counting.
Today I learned about the Outbox Pattern. ...
After version v12.17.0, Node’s REPL provides a useful preview effect. In this example, 2 is shown in gray before I hit enter. > 1 + 1 2 But what if I don’t want that? Here’s a file called repl that disables it as an option: #!/usr/bin/env node const repl = require('node:repl'); repl.start({preview: false}); Then: $ ./repl > 1 + 1 No preview. Docs
With my Node versions managed via NVM, I want to be on the latest LTS. You can ensure that happens with these commands: $ nvm install --lts $ nvm alias default lts/* default -> node (-> v24.16.0) ...
The Law of Demeter is important in object-oriented programming. But where does “Demeter” come from? ...
Today I learned how to fill in an emoji with CSS. Here’s an example: .filledEmoji { color: transparent; text-shadow: '0 0 0 #86efac'; } ...
What I call “wraparound” are repeatable indices on an array. The common use case is a carousel. Here’s how it’s done: const items = ["first", "middle", "last"]; const i = 0; // Our iterable index // "Next" -> const nextIndex = (i + 1) % items.length; // <- "Previous" const prevIndex = (i - 1 + items.length) % items.length;
Here’s a periodic reminder that JavaScript supports string concatenation with a plus sign: > 'foo' + 'bar' 'foobar' ...
Need an array of letters? Here’s a trick: > const alpha = [...'abcdefghijklmnopqrstuvwxyz'] ...
When you join an array in JavaScript, the default separator is a comma: node> ['j', 'a', 'k', 'e'].join() 'j,a,k,e' ...
The JavaScript bitwise AND operator (&) can be used for some real-world tasks, like testing if a number is odd or even. ...