Skip to main content
Posts —— 1…10 of 67

TIL you can redirect a command output directly to the clipboard on Mac using pbcopy. No need to fumble with text selection to copy it.

sh
Copying date to clipboard in Nushell
date now | date format '%Y-%M-%d' | pbcopy

Source: https://stackoverflow.com/a/1753127

TIL you can use brew autoremove to prune unused dependencies installed by Homebrew.

sh
# dry run to preview what will be removed
brew autoremove --dry-run

# removes the unused dependencies
brew autoremove

TIL that curl supports a --json flag to send and accept JSON responses since version 7.82.0, which means that the following requests,

sh
curl --data '{"name": "morpheus"}' \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--request POST https://example.com/api/users

curl -d '{"name": "morpheus"}' \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X POST https://example.com/api/users

can be further shortened as follows:

sh
curl --json '{"name": "morpheus"}' \
-X POST https://example.com/api/users

Source: https://glaforge.dev/posts/2023/03/22/curl-s-json-flag/

How to generate webfonts with fontTools from ttf sources

Tiny design detail: nested border radii look really funky if they’re the same. To maintain the same curvature, the outer radius = inner radius + padding.

Nested border radii
Nested border radii
Lily Konings (published: )

TIL that + sets a force flag on a Git refspec. That means I can force push to a branch with any of the following commands:

sh
git push --force origin main
git push -f origin main
git push origin +main

https://stackoverflow.com/a/69745212

Unlighthouse by Harlan Wilton is an invaluable tool to scan your entire site with Lighthouse. It runs as a command line tool and displays results through a beautiful web interface. And it just works with minimal configuration. I’ve been using it to audit naiyer.dev and couldn’t recommend it enough.

A common fallacy is to assume authors of incomprehensible code will somehow be able to express themselves lucidly and clearly in comments.

Kevlin Henney (published: )
Introducing the latest redesign of this website. Here are the motivations for the revamp, some website metrics and comparison with the old version, and the interesting ‘behind the scenes’ changes.

If you accumulate a lot of local Git branches over time, you can get rid of them in one go with the following Nushell script:

nu
(git branch | lines | where ($it !~ '^\*') | each {|br| git branch -D ($br | str trim)} | str trim)