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
git branch | egrep -v " develop| stage| master" | xargs git branch -D |
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
# Load .nvmrc file using fnm | |
## Description: load nvmrc by automatically taking the node version contained in the first upwards .nvmrc (or .node-version) file | |
## See GIST/upfind.sh https://gist.github.com/GalassoLuca/a502c3ba2489b6fae7270f5653bedfc0 | |
local last_nvmrc_path=null | |
load-nvmrc() { | |
local nvmrc_path="$(upfind .nvmrc .node-version)" |
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
# Upwards find | |
## Description: find the first filename backward from the current folder to the root | |
upfind() { | |
folder="$(pwd)" | |
while [ "$folder" != "/" ]; do | |
for arg in "$@"; do | |
if [ -e "${folder}/$arg" ]; then | |
echo $folder/$arg |
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
const idFromDate = ObjectId.fromDate(ISODate("2021-02-08")) | |
db['collection'].count({ _id: { $gte: idFromDate } }) |
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
const fs = require('fs') | |
const path = require('path') | |
const html1 = fs.readFileSync(path.join(__dirname, '../test/fixtures/page1.html'), 'utf-8') | |
// in one line | |
const html2 = require('fs').readFileSync(require('path').join(__dirname, '../test/fixtures/page2.html'), 'utf-8') | |
// with a function | |
const readFile = relativePath => require('fs').readFileSync(require('path').join(__dirname, relativePath), 'utf-8') | |
const html3 = readFile('../test/fixtures/page3.html') |
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
alias p="pnpm" | |
alias i="p install" | |
alias u="p uninstall" | |
alias s="p dev" | |
alias t="p test" | |
alias tw="p run test:watch" | |
alias c="code ." | |
alias o="open ." | |
alias rmi="rm -rf node_modules; i" | |
alias rmit="rmi; t" |
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
Show hidden characters
{ | |
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
// Placeholders with the same ids are connected. | |
"Print a variable to console": { | |
"prefix": "logvar", |