I like to make my ~/.bash_profile able to be re-sourced multiple times. Because I'll change it, and then re-source it. But I don't want my PATH to become super long with duplicates. So I check PATH before appending or prepending a path.
I often want to go up directory levels or to HOME quickly.
alias ..='cd ..'alias ..2='cd ../..'alias ..3='cd ../../..'alias ~='cd ~'
When I do mkdir I often follow it with cd to that directory. So I've combined the operations. (Sometime I tweak it to be lazy and cd into the directory if it already exists. Sometimes I don't like that behavior, and take it out.)
function mkcd {if[-n"$1"-a!-a"$1"]then
mkdir"$1"cd"$1"else
echo NO
fi}
Sometimes I'm editing an HTML file (and possibly associated CSS and JavaScript files), and I want Chrome to reload my local page for me when it changes. (I think I got fswatch through brew.)
function watch {local DIR=$PWDif[-n"$1"]then
DIR="$1"fi
fswatch -o"$DIR" | xargs -n1-I{} osascript -e'tell application "Google Chrome" to tell the active tab of its first window to reload'}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I like to make my
~/.bash_profile
able to be re-sourced multiple times. Because I'll change it, and then re-source it. But I don't want my PATH to become super long with duplicates. So I check PATH before appending or prepending a path.I use SCOWL to look up words frequently. So I like to be able to grep words no matter where I am.
I'm often on a Macintosh using Terminal.app, and I like to be able to clear the screen and clear the scrollback buffer in one command.
I'm always making little C++ toy programs to test out a thought. I like to compile in a specific way, so a handy alias to the rescue.
I often want to go up directory levels or to HOME quickly.
When I do
mkdir
I often follow it withcd
to that directory. So I've combined the operations. (Sometime I tweak it to be lazy and cd into the directory if it already exists. Sometimes I don't like that behavior, and take it out.)Sometimes I'm editing an HTML file (and possibly associated CSS and JavaScript files), and I want Chrome to reload my local page for me when it changes. (I think I got fswatch through brew.)