Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. unset GREP_OPTIONS
  2.  
  3. # find content in javascript files inside a folder
  4. # eg: findjs color src
  5. function findjs {
  6. find "${2:-.}" -name '*.js' -not -path '*node_modules*' -not -path '*dist*' -exec grep "$1" --color=auto {} \; -print
  7. }
  8.  
  9. # find content in javascript files inside a folder and replace it with something else
  10. # eg: findjsr red blue src
  11. function findjsr {
  12. find "${3:-.}" -name '*.js' -not -path '*node_modules*' -not -path '*dist*' -exec sed -i "" "s/$1/$2/g" {} \; -print
  13. }
  14.  
  15. # find content in view files inside a folder
  16. function findview {
  17. find "${2:-.}" -name '*.view' -not -path '*node_modules*' -not -path '*dist*' -exec grep "$1" --color=auto {} \; -print
  18. }
  19.  
  20. # find content in view files inside a folder and replace it with something else
  21. function findviewr {
  22. find "${3:-.}" -name '*.view' -not -path '*node_modules*' -not -path '*dist*' -exec sed -i "" "s/$1/$2/g" {} \; -print
  23. }
  24.  
  25. # list all views and when you select one it opens it with the editor
  26. # it needs fzy, install it with brew install fzy
  27. function editview {
  28. find "${1:-.}" -name '*.view*' -not -path '*node_modules*' -not -path '*dist*' -not -path '*.view.js' | fzy | xargs -o $EDITOR
  29. }
  30.  
  31. function cleangitbranches {
  32. git remote prune origin
  33. git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D
  34. }
  35.  
  36. # list processes running off the current directory
  37. function procpwd {
  38. ps aux | grep `pwd`
  39. }
  40.  
  41. # kill processes running off the current directory
  42. function killpwd {
  43. kill $(ps aux | grep `pwd` | awk '{print $2}')
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement