I’m always searching for better ways to improve my workflow, increase productivity, and just generally learn new and exciting things. (Besides, it’s part of having a healthy growth mindset.)
We’ve had some big changes on our team during the past year and I’ve felt like I’ve needed to step up when it comes to reviewing code that my fellow colleagues write. While searching for some ideas on how to improve my code review skills, I discovered a blog post from 2018, entitled “Code Review from the Command Line“.
This blew my mind and really helped reframe how we engineers should approach code reviews:
When I ask that other people review my code, it’s an opportunity for me to teach them about the change I’ve just made. When I review someone else’s code, it’s to learn something from them.
Jake, the author of the above post, goes on to describe his setup and custom tooling for conducting an interactive code review.
He uses custom git alias to see which files have changed and how many changes there are, a custom script that visualizes how often the files within the pull request have changed over time, and another custom script that can visualize the relationship between changed files.
All of these go above and beyond the call of duty for reviewing code, but it’s stuff that decreases friction and can make a sometimes tedious process much more enjoyable.
I’ll be implementing some of these ideas into my own workflow in the near future.
Sublime Text is an indispensable tool to have in your arsenal of web development goodies. There’s a nearly infinite amount of shortcuts and tricks one can use to improve their workflow.
One of my favorite shortcuts is moving either lines (or entire blocks) of code up or down a page without cutting and pasting all over the place.
Simply select the line (or multiple lines of code) that you want to move, then simply hit
CONTROL + CMD + (Up or Down arrows) on OS X
CONTROL + SHIFT + (Up or Down arrows) on Windows
I guarantee if you do this in front of your friends or family, you will look like a wizard.
tl;dr: Quickly generate multiple emails that you can send from your favorite mail client using mailto links and parsing data from various text files. (email addresses, email template, and optional redemption codes)
Recently, I had to contact 50 readers by email for a giveaway that we were running on our site. We’ve run similar sorts of events before and it’s always a tedious experience. It involves something like this:
- Get email address from the list of winners.
- Write up some sort of email template.
- Go through and copy paste template into new email, and then copy and past the email address from list of winners.
- Oh, don’t forget to copy and paste the subject line: “Dude, you’ve won FOO! Nice work!”
- Oh, this particular giveaway features a unique code for each winner. Make sure you copy and paste that, too!
- After all this copy and pasting, send the email.
- Repeat this process until you’ve gone through the list of winners. Look at a clock and realize this has taken all afternoon.
- “Oh, man,” you think to yourself, “there’s got to be a better way.”
The Better Way
There is! Just download this project to your favorite PHP compatible server (or run an app like MAMP on your machine) and open up the “make_email.php” script.
There are a few required files:
- emails.txt – This is the list of email addresses you wish to send emails to. Each email address should be on a new line. No commas or funny stuff separating them, please. I didn’t build in any sort of fancy error checking.
- body.txt – This is the meat and potatoes. This is the message you’re going to want to send over and over and over and over. Sweet! One particularly important note: If there is some sort of unique redemption code or URL that winners will need to go to, you can add in ‘%code%’ (without quotes) to your email. The script will then automatically fill in unique codes when it generates the email (should you choose that options).
- codes.txt – If you have a whole list of redemption codes or URLs, this is where you put them. Like emails, each code or URL needs to be on a separate line.
That’s it! You might be wondering how you set the subject line of the email. Right now, it’s a variable at the top of the script. Just change that and you’ll be good to go!
Once you have these text files filled out, run the script, choose whether you’re generating emails with or without redemption codes and then fire away!
You can now click through the list and start firing off emails like you’re your own spambot. Except you’re giving people legitimately cool things. And you’ll still be able to enjoy your afternoon.
If you’re interested in checking it out, you can download the source code on Github.