Category: Computers

First off, if you’re not using iterm 2, it’s awesome and you should. Recently I found that iterm 2 has functionality that can help you automate actions based on things that happen in your terminal. This particular trick has proven helpful recently.


I use Bitbucket for much of my work. When I push up a new branch, Bitbucket responds with a URL that I can use to open a pull request for that branch. For the longest time, I’d highlight from Terminal, copy and paste into a browser and do my pull request. Shortly after that I learned you can right-click anywhere in the URL and select “Open Selection as URL” and it will open a browser. A bit after that I learned that you can Command-Click on the URL in the terminal and the browser will open. That’s pretty easy, but I’ve got a way that is even easier.

For reference, this is an example of what it might look like when I open a pull request in Bitbucket:


In iterm 2, you can tell it to watch for certain patterns and do something with them. You can make a sound, bounce the dock, run a command, open a Growl and more. For this, I want to run a command. In iterm 2, right click and select “Edit session…”.iterm_advanced_trigger_edititerm_edit_session

Next, choose the Advanced tab and click on Edit under “Triggers”.

The triggers in iterm 2 work on matching a regular expression and doing something with it. The parts of the URL that will or could change will be the username, repo name and the branch name, but really, we don’t even need to be that specific.

For the regular expression, enter this:


iterm_trigger_preferencesFor the action, choose “Run Command…”. For the paramters, enter “open ‘\1′”. It should look like this:

There’s a few important parts with the regular expression if you’re not familiar. First of all, the parentheses around the part that matches the URL is to capture the pattern. In parameters, the \1 is substituted with the matched URL. I put the ‘remote:.+’ part in so that it will only trigger if the response looks like it comes from pushing up code. Without it, this will trigger on any link that shows up in your terminal for any reason.

The last bit that you may want to change for your purposes is the part after source=. In mine, it’s “[A-Z]+-\d+”. This means it’s matching one or more capital letters followed by a dash followed by one or more digits. This is because our standard is to name our branches after our JIRA tickets. They look something like BUG-1234 or APP-443. In fact, the regular expression wouldn’t have worked on my first terminal example because “my-branch-name” doesn’t match that pattern. If you want to simplify it and make it work no matter how you name your branches, you could replace that pattern with .+:


With this in place, any time you push up code and Bitbucket responds with a Pull Request URL, iterm 2 will run “open” on the URL which results in opening your default browser to that URL.

For me it saves a bit of time and it’s pretty cool. You could also use these triggers along with a command like ‘tail -f ‘ on some log file and have iterm 2 let you know whenever a particular phrase shows up in a log file.

Hope this helps.






Happy 20th Birthday PHP

Twenty years ago today, Rasmus Lerdorf, the creator of PHP announced to the world the release of a collection of scripts to help developers build web pages that do more than HMTL can do on its own. Here we are, 20 years later and PHP is running something like 80% of the web. That’s pretty impressive! I’ve been working with PHP for most of that time but haven’t ever written down how that came to be. I started working on PHP back in the late 90’s, probably 1998 based on what I remember. I’ve thought it was 1997 but based on the timeframe, I don’t think that is right. I remember working with PHP 3 and then shortly afterwards upgrading to PHP 4.elephpants

My start with PHP happened back in college. One of my professors had some NSF (National Science Foundation) money for the ACM-W (Association of Computing Machinery’s Women in Computing) to build something that would allow you to more easily find articles about women in computing/technology. At this time, Google was basically a twinkle in the eye of Page and Brin. So I did some research about how I could get something on the web. I think ASP was there but that came with licensing. I stumbled on PHP and a few tutorials from I’m certain this was not great code and the site I produced was likely jammed full of SQL injection and XSS issues and some terrible database design (model tables after Excel spreadsheets anyone?). But we had a working interactive site that allowed users to search and find articles about women in tech and computing. You could search by author, title, publication, year, etc. It was AMAZING. Much of it was extremely procedural and definitely mixed PHP with HTML. I built, ran and tested it on a server called OmniHTTP because it was available for free on windows and I could hook PHP into it.

View full article »

If you’re reading this to figure out how to do the hard drive upgrade on a MacBook Pro that came with Lion installed, I’d recommend either reading all the way through before starting since it will save you some time, or skip to the bottom as it will save you time. If you follow along, you’ll end up doing the same stuff I did which will make your upgrade take longer than it should.

Last weekend (10/2/2011) I picked up a brand new 13″ MacBook Pro (Dual-Core Core i7) from the Apple store. I also picked up 8GB of RAM and an OCZ Agility 3 120GB SSD to upgrade it with.

Both of these upgrades are within allowable modifications for the MacBook Pro without compromising your warranty. Also, for the most part, they are pretty easy upgrades, especially the RAM upgrade. I did, however run into some issues with the HDD –> SSD upgrade which is why I am writing this.

View full article »