TIL is my collection of short, technical daily learnings. 247 and counting.
Inspecting Symlink with readlink
There are a few ways to know that a file is a symlink. Here’s one I learned today. ...
TIL is my collection of short, technical daily learnings. 247 and counting.
There are a few ways to know that a file is a symlink. Here’s one I learned today. ...
It’s been a bit since I was typing SQL into a REPL. One interface that didn’t come back to me right away is the percent character in a like or ilike query: select full_name from users where full_name ilike 'jake%'; Returns: full_name ----------- Jake Gyllenhaal Jake Tapper Jake Worth (3 rows) This percent sign ensures we get all the Jakes. Here’s how I’m going to remember this next time. ...
I use Ripgrep as my command-line search tool. Something I often want is to return matching filenames only, instead of Ripgrep’s rich colored output, so I can pipe them to xargs. Here’s that flag: rg -l ...
For each way you can map something in Vim, you can inspect those mappings. Check out this table of commands: COMMANDS MODES :map :noremap :unmap Normal, Visual, Select, Operator-pending :nmap :nnoremap :nunmap Normal :vmap :vnoremap :vunmap Visual and Select :smap :snoremap :sunmap Select :xmap :xnoremap :xunmap Visual :omap :onoremap :ounmap Operator-pending :map! :noremap! :unmap! Insert and Command-line :imap :inoremap :iunmap Insert :lmap :lnoremap :lunmap Insert, Command-line, Lang-Arg :cmap :cnoremap :cunmap Command-line :tmap :tnoremap :tunmap Terminal-Job To take a very practical one, :nmap will show you all of your normal mode mappings. Find a new command to try; you are not using them all (neither am I). ...
We can save all evaluated commands from our TSX REPL session to a file: $ npx tsx > const name: number = "Jake" undefined > .save output.ts Session saved to: output.ts ...
Want to get better at technical writing? I’ve been writing prose (READMEs, wikis, and this blog) with Vale for months. It’s helps me write better, faster. Here’s what I’ve learned. ...
Today I discovered tsx, a REPL that evaluates TypeScript. You can run it with npx: npx tsx And it evaluates TypeScript. > const onClick = (input: number):void => input + 1 undefined > onClick(1) 2 ...
For the golfers out there, we can combine these two lines into one: const items = await getCollection(); return items.sort(); This doesn’t work because sort() is being called on the promise returned by getCollection(): return await getCollection().sort(); // `sort()` runs on the Promise Instead, wrap the await expression in parentheses so sort() is called on the resolved value: return (await getCollection()).sort(); // `sort()` runs on the resolved array Promise documentation - MDN
Astro’s default port is 4321. Like Vite, this project is trying to convey its (rocket-launch) branding, even in this small detail. ...
Node Timeout timers have a private boolean attribute called _destroyed. It tells you if the function has been cleared: timer._destroyed; ...