Skip to content

Instantly share code, notes, and snippets.

@ChristianKienle
Last active December 2, 2019 13:12
Show Gist options
  • Save ChristianKienle/60bd9653943da8949cf9a9682d1a8f05 to your computer and use it in GitHub Desktop.
Save ChristianKienle/60bd9653943da8949cf9a9682d1a8f05 to your computer and use it in GitHub Desktop.
# Add this to your zsh.rc-file
# Execute a Node Binary
function nbin() {
./node_modules/.bin/$@
}
# Execute and Debug Unit Tests
function njest() {
./node_modules/.bin/jest --clearCache && node --inspect-brk --no-lazy ./node_modules/.bin/jest . --runInBand --testTimeout 99999999 $@
}
# Debug a NodeJS Execution
function ndebug() {
node --inspect-brk --no-lazy $@
}
# Safely change the casing of a file which is under version control
function git-rn() {
if [[ $# -eq 0 ]] ; then
echo 'Arguments needed'
exit 1
fi
echo "Will try to rename:"
echo "${1}"
echo " -- to --"
echo "${2}"
read -s -k $'?Press any key to continue.\n'
mv $1 "_${2}"
git add -A
git commit -m "renaming"
mv "_${2}" $2
git add -A
git commit --amend -m "renamed ${1} to ${2}"
}
# Use it like this:
$ git-rn from_file_or_dir to_file_or_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment