This content was initially published on the Phase2 blog.

I gave a 5-minute lightning presentation at the October 2011 Drupal NYC meetup about Roger Lopéz’s phpsh plugin for drush.

phpsh is a project by Facebook that provides a much more useful REPL (read-eval-print-loop) environment for PHP, similar to Ruby or Scala. The Drush phpsh plugin adds an easy way to generate ctags for code completion in your phpsh (as well as your favorite editor) and a way to run a persistent PHP session with a fully bootstrapped Drupal instance. It’s really useful for testing out APIs.

If you missed it in person, you can watch the video embedded below.

This content was initially published on the Phase2 blog.

How many times have the following issues happened on a project you’ve worked on?

  • Notices (or worse) appeared on production because of a PHP version mismatch between a developer’s machine and the production web servers.
  • A new PHP extension or PECL extension had to be installed on production because it was installed in WAMP or MAMP?
  • A team member ran into difficult setting up their local environment and spent many hours stuck on something.
  • Team members didn’t set up SSL or Varnish on their local machines and issues had to be caught on a dev server.
  • A team member would like to switch to Homebrew, but can’t set aside the many hours to redo their setup until a project is done.

This content was initially published on the Phase2 blog.

We’ll be doing a screencast series soon on using the Vagrant gem to distribute and manage virtual machines so that your entire team (yes, even Windows folks!) can do development on their local machine with the same software that’s on your production Linux servers.

Another useful tool in the Vagrant user’s arsenal is Veewee. Veewee lets you automate the VirtualBox application to install a full operating system with just the packages you want and need. Veewee does have some built-in validation tools, such as vagrant basebox validate BOXNAME, which will run a set of Cucumber acceptance tests to ensure that the virtual machine should work properly when brought up with Vagrant, as well as with the Chef and Puppet configuration management tools.

Say what you will about node.js, but it is certainly an easy way to build IRC bots with the Jerk library.

The PHP-based bot that runs in the Treehouse Agency IRC channels knows to respond to “Sweet!” with “Dude!” and vice versa. Brian McMurray said that he’d like to someday write a quick-and-dirty bot that would put our other bot into an infinite loop.

I accepted that challenge, and 10 minutes later, the bot was done.

The code is an example of how to build a bot that accepts environmental variables for configuration and otherwise does a pretty silly task.

Do you enjoy your hair? Would you prefer not to pull it out while waiting for your local Apache server on Mac OS X to deliver a page to you?

If you use Mac OS X Lion and have development sites set up at .local addresses, you should immediately move them to any other fake TLD. The .local address space is resolved for Bonjour and as a result any request to a .local name will not hit /etc/hosts first, but will search for Bonjour hosts first.

I found this Stack Exchange question on the subject tonight after getting frustrated with curl seemingly hanging for several seconds on each request.

Instead, I switched all of my local dev sites from $DOMAIN.local to $ The results are staggering.

TL;DR: Add “noapic” to your kernel line if your VBoxHeadless process uses far too much CPU.

I’ve been working on making space-efficient CentOS 5.6 and 6 images for VirtualBox recently. I’m building the images as part of a pilot program to start using the Vagrant gem to allow our developers to test the Drupal code they write on the real production OS before pushing it to the dev server. (I’m also learning Puppet, both for this project and as a way to more easily re-use tested configurations as we launch new sites.)

The CentOS 5.6 images I made worked like a charm, but ran into a problem wherein the VBoxHeadless process that hosted my CentOS 6 image would always use 25% CPU on my MacBook Air (one full core) despite the guest OS showing between 98% and 100% idle.

Biking to the George Washington Bridge was just not going to work on the day before Memorial Day. The crowds were too packed in the park on the way up to the GW Bridge, and so I turned around and decided to do a nice brisk ride along the Hudson River Greenway and through Central Park.

I’m a big guy. I’m currently around 280 pounds, and yet when I ride I tend to be faster than most cyclists on the path by quite a bit. On this particular evening, I pedaled hard up the uphill entry ramp to the Greenway and saw in my rear-view mirror that I had another cyclist who was following pretty closely behind me.

I shot down the Greenway, passing cyclists and genuinely enjoying the cool breeze and the fresh smell of the Hudson River. My unknown cycling companion was generally only one or two bike lengths behind me. As much as I love to bike, I do not take it to the level that some folks in New York City do. I don’t have a set of “real” biking shorts or a real biking jersey, nor do I have a super-expensive road bike. My anonymous companion, however, did appear to have all these trappings: a bike that looked like it could have been made of carbon fiber and a set of biking shorts and a jersey from some race or event.

When Firefox 4 came out, I switched to it. I was mainly impressed by its speed (relative to the stable version of Chrome at the time) and the efficacy of Firefox Sync.

Several weeks later, I abandoned it for the stable build of Chrome. There were several things that contributed to its downfall in my eyes. Chief among them was its effect on my battery life on my MacBook Pro. Despite being nearly as fast as Chrome in user-perceived speed, Firefox generally used more CPU. There was also a very annoying bug that resulted in a ton of modal popups.

About a month back, I switched from the Chrome stable released to the Chrome dev channel and I’ve been in general very pleased. There’s one feature that has been slowly gnawing away at my sanity, however, and it’s gotten serious enough that I’m switching back to Firefox 5 to see if my complaints about Firefox 4 have been addressed.