How ZSH saves me time
I naturally spend a lot of time in the terminal and I found my way to ZSH after having used Bash long enough to find its shortcomings. These tips aren't exclusive to ZSH, it just happens to be the shell I use.
Opening Meetings
alias firstName='open http://company.webex.com/join/first.last'
This might be my favorite of the list. My job utilizes webex for meetings, so everyone has a “meeting room” that’s accessed by visiting http://company.webex.com/join/first.last. I spent the first 3 moths going to Slack and searching for the link every time I needed to pair with my co-worker. Now I can fire off the command above and the meeting room opens like magic, no digging in Slack required.
Quickly open GitHub repos
alias gmetro='open https://github.com/GroupTen/metro'
A common pattern in my workflow is creating a new branch, pushing some changes, and opening a pull request from GitHub’s site (since my git powers are weak and request-pull
still scares me). The above alias lets me enter the project’s name with a prepended ‘g’ to open the repo right on GitHub.
Quickly open local repos
alias metro='cd ~/development/metro'
Related to the alias above, I highly recommend making aliases for frequently visited projects. I know where I want to go. I don’t want to precede where I’m going with cd
.
Change display rotation
alias fd='displayplacer "id:7D8F5137-0762-3904-0B6C-BC80189F82A8 res:1920x1200 hz:59 color_depth:8 scaling:off origin:(0,0) degree:0" "id:98958CF3-4350-BDC2-FB15-1ADF6A8BD7D1 res:1200x1920 hz:59 color_depth:8 scaling:off origin:(-1200,-315) degree:90"'
Okay, this one's a bit more involved. Somewhere along the way to macOS Mojave, my laptop never remembers the position of external displays. Undocking and docking causes both my monitors' orientation to be flipped. Apple doesn’t expose the display information readily outside of system preferences, but displayplacer, a handy command line utility by Jake Hilborn, uses a single command to fix that.
Keeping a developer diary
alias diary='cd ~/code/journal && vim `date +"%Y-%m-%d"`.md'
Shamelessly stolen from Jamison Dance. There's an idea in psychology called the 20-Second Rule, which basically boils down to you're more likely to do something if it takes less than 20 seconds to start. This alias lets me quickly jot down notes and questions that I convince myself I'll definitely remember but rarely do.
Shortening commands
alias yd=yarn run dev
Everything so far can be summarized by taking a long command/task and making it shorter. This doesn’t always have to be some elaborate idea, it can sometimes be as simple as something like the above. As much as I love my mechanical keyboard, I hate typing. My life is better if I can type less and the above alias embodies that. There’s no point in typing a long command like yarn run dev
if I can make it something both shorter and easier to remember. If I run a command multiple times a day, I’m likely to make it a two-character alias. I’ll let you guess what I made yarn run test
.