Here's a quite balanced talk about FP and OO that fits my view of the two paradigms. Give it a shot if you have 40mins on your commute or something.
https://www.reddit.com/r/programming/comments/as6epa/fp_vs_oo_choose_two_by_brian_goetz/
martes, 19 de febrero de 2019
jueves, 7 de febrero de 2019
TIL: paste -sd+
Following https://hacker-tools.github.io/ lectures, I found a neat trick I didn't know in the data wrangling chapter:
seq 100 | paste -sd+ | bc -l # 5050
That's pretty nice. I already had this usecase solved by an "addup" perl script that I stole years ago from Mark Jason Dominus' utils repo.
As a bonus, it reminds me the very similar trick to generate a regex that matches either of many words. That's part of my git pre-commit hook
Not exactly the same, but it also belongs to "Higher Order Shell"
seq 100 | paste -sd+ | bc -l # 5050
That's pretty nice. I already had this usecase solved by an "addup" perl script that I stole years ago from Mark Jason Dominus' utils repo.
As a bonus, it reminds me the very similar trick to generate a regex that matches either of many words. That's part of my git pre-commit hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alternative to https://gist.github.com/SkyM/1641459 | |
FORBIDDEN=$(echo 'declaim break ==== >>>> <<<< string.gmatch inspect' | | |
sed -e 's/ /\\\|/g') | |
git diff --cached | grep '^+' | sed -e 's/--.*//' | | |
grep -n $FORBIDDEN && | |
echo "COMMIT REJECTED Found '$FORBIDDEN' references. Please remove them before commiting" && | |
exit 1 |
Not exactly the same, but it also belongs to "Higher Order Shell"
Suscribirse a:
Entradas (Atom)