TIL that Node.js standard library has support for parsing CLI script arguments:
TIL that Docker Compose accepts --project-name option (or COMPOSE_PROJECT_NAME env variable) which overrides the default parent directory prefix for built images, containers and other resources e.g. networks. Fairly userful for e.g. a specific situation (I have one) of running multiple containerized app instances under different locations, but same parent dir
Maybe not today, but IL about mount-s3 - enables mounting S3 bucket as a local file system. Just like sshfs enables mounting remote SSH host locations
TIL about a snippet that allows to checkout to git branches using regex. Fairly useful if e.g. branch names are driven using tickets/task identifiers like feature-PROJ-2137-new-screen-in-app because we can just git coregex /PROJ-2137/ or even git coregex /2137/
To enable it we need extra function file ~/.myfunctions:
#!/usr/bin/env bash
find_and_checkout_branch() {
for last; do true; done
pattern='^/.*/$'
if [[ $# -eq 1 && $last =~ $pattern ]]
then
branch_pattern=`echo $last | sed -e 's/^\\///' -e 's/\\/$//'`
branch=`git for-each-ref --sort=-committerdate --format='%(refname:lstrip=3)' refs/remotes/origin | grep -E $branch_pattern | head -n1`
if [[ $branch ]] ; then
git checkout $branch
else
echo "No branch found matching $last"
exit 1
fi
else
git checkout $@
fi
}
And then define an alias in ~/.gitconfig:
[alias]
coregex = "!BRANCH=$@ bash -c 'source $HOME/.myfunctions && find_and_checkout_branch $BRANCH'"
Note that probably it has to be slightly modified for MacOS.
TIL about docker-compose.override.yml — it lets you automatically override certain fields in the main docker-compose.yml file. Useful if you have a repo with docker-compose and want to configure it beyond what’s possible with .env and without messing with any tracked files
TIL about a header in emails that can disable outlook’s “reactions”: Attempting to stop Microsoft users sending 'reactions' to email from me by adding a postfix header
TIL about the second argument to the Error constructor in JS:
TIL about rqlite - a distributed database built on top of sqlite with simplicity and fault-tolerance in mind
TIL that mobile webkit browsers automatically turn some strings into clickable tel: links — and it can be disabled: WebKit browsers see telephone numbers everywhere — Seth Larson
TIL about CSS clamp() function which lets you assign a value to a CSS property between a minimum and a maximum range, and uses a preferred value in that range: css-tricks article on clamp
TIL about PostgreSQL constraint param deferrable which lets you tell the dbms to check whether the constraint is satisfied only at the end of transaction. Fairly useful for e.g. an one-off larger modification when caring about the proper statement order just distracts from the main issue
TIL, that Firefox lets you render an image of a different HTML element using just CSS
TIL that node has native support for .env files:
TIL that docker supports rootless mode which helps mitigate potential vulnerabilities. However, I usually hear that podman is still the better choice in terms of security
TIL about npm install --before flag which may prevent us from installing dependencies published too recently. Usually supply chain attacks last shortly, so we have highly effective & built-in protection measure
TIL about Array.fromAsync() method a modern counterpart of Array.from() designed for handling async iterables. A short article can be found here