TIL that curl supports a --json
flag to send and accept JSON responses since version 7.82.0, which means that the following requests,
'{"name": "morpheus"}' \
curl --data "Content-Type: application/json" \
--header "Accept: application/json" \
--header
--request POST https://example.com/api/users
'{"name": "morpheus"}' \
curl -d "Content-Type: application/json" \
-H "Accept: application/json" \
-H
-X POST https://example.com/api/users
can be further shortened as follows:
'{"name": "morpheus"}' \
curl --json
-X POST https://example.com/api/users
Source: https://glaforge.dev/posts/2023/03/22/curl-s-json-flag/
- Andy Bell wrote about this technique using CSS properties: https://set.studio/relative-rounded-corners/
- Adam Argyle discussed an alternative approach using
overflow-clip-margin
: https://nerdy.dev/perfect-nested-radius-with-overflow-clip-margin
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:
git push --force origin main
git push -f origin main
git push origin +main
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.
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:
(git branch | lines | where ($it !~ '^\*') | each {|br| git branch -D ($br | str trim)} | str trim)
TIL that HTML5 spec specifies a href="#top"
and href="#"
fragment to quickly jump to the top of any document. No need to provide a matching anchor. Pretty handy stuff.
https://html.spec.whatwg.org/multipage/browsing-the-web.html#scroll-to-the-fragment-identifier
My yearly account purge is in full-swing. Casualties include toxic social media, dead apps, useless subscriptions of diminishing returns. Also, I won’t be signing up for services that have unclear account deletion and data export policies.