TODAY I LEARNED
by lubosmato
by lubosmato
Did you know asciinema supports real-time terminal streaming? Running asciinema stream -r starts a live stream of your terminal session, giving anyone with the link a real-time view of what you're doing. Perfect for remote pair programming with Neovim or live demos.
I use Neovim BTW!
psql can accept a full connection URI instead of passing individual flags for host, port, database, and user.
This is especially handy when working with managed database providers (Supabase, Neon, Railway, etc.) since they typically give you a connection string you can copy and paste directly. No more juggling five different flags.
In the default branch, TypeScript narrows proto to whatever union members weren't handled. If all cases are covered, proto becomes never and the check passes silently. If you miss a case (like "raw" here), proto still has a remaining type, so satisfies never produces a compile-time error telling you exactly which variant you forgot to handle.
This statement lets you insert rows into a table by pulling data from another table (or the same table) using a SELECT query, rather than specifying values manually.
❯ asciinema stream -r
::: asciinema session started
::: Live streaming at https://asciinema.org/s/BAgxaJcQbsr55T
::: Press <ctrl+d> or type 'exit' to endfc -p # commands you run after this won't be saved to your shell history (for current session only)
psql postgres://myuser:mypassword@localhost:5432/mydb
# same as:
psql -h localhost -p 5432 -U myuser -d mydb
fc -P # back to normal-- Assume both tables have the same structure
INSERT INTO orders_archive (order_id, customer_id, total, order_date)
SELECT order_id, customer_id, total, order_date
FROM orders
WHERE status = 'completed' AND order_date < '2025-01-01';type Proto = "tcp" | "http1" | "raw"
const proto = "tcp" as Proto
switch (proto) {
case "tcp":
case "http1":
break;
default:
proto satisfies never; // <-- Type '"raw"' does not satisfy the expected type 'never'.
}