Last active
September 28, 2019 19:09
-
-
Save dariocravero/9bca789a0e51f9b422ce157c5f409071 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
unset GREP_OPTIONS | |
# find content in javascript files inside a folder | |
# eg: findjs color src | |
function findjs { | |
find "${2:-.}" -name '*.js' -not -path '*node_modules*' -not -path '*dist*' -exec grep "$1" --color=auto {} \; -print | |
} | |
# find content in javascript files inside a folder and replace it with something else | |
# eg: findjsr red blue src | |
function findjsr { | |
find "${3:-.}" -name '*.js' -not -path '*node_modules*' -not -path '*dist*' -exec sed -i "" "s/$1/$2/g" {} \; -print | |
} | |
# find content in view files inside a folder | |
function findview { | |
find "${2:-.}" -name '*.view' -not -path '*node_modules*' -not -path '*dist*' -exec grep "$1" --color=auto {} \; -print | |
} | |
# find content in view files inside a folder and replace it with something else | |
function findviewr { | |
find "${3:-.}" -name '*.view' -not -path '*node_modules*' -not -path '*dist*' -exec sed -i "" "s/$1/$2/g" {} \; -print | |
} | |
# list all views and when you select one it opens it with the editor | |
# it needs fzy, install it with brew install fzy | |
function editview { | |
find "${1:-.}" -name '*.view*' -not -path '*node_modules*' -not -path '*dist*' -not -path '*.view.js' | fzy | xargs -o $EDITOR | |
} | |
function cleangitbranches { | |
git remote prune origin | |
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D | |
} | |
# list processes running off the current directory | |
function procpwd { | |
ps aux | grep `pwd` | |
} | |
# kill processes running off the current directory | |
function killpwd { | |
kill $(ps aux | grep `pwd` | awk '{print $2}') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment