Posted by & filed under Linux.

By running these commands, you will download the necessary fonts required to render Emoji on your Linux machine.

mkdir ~/.fonts && cd ~/.fonts
unzip && rm

Interestingly enough, I didn’t even have to restart my apps. Pidgin, for example, immediately displayed the new font. It seems the OS is smart enough to find the fonts, see that they display the missing symbols, and re-render the text.

Please note, these will not be the full-color bitmapped images like on OS X, but will instead be colored vectors like the rest of the font glyphs.

Emoji on Linux

Emoji on Linux

Posted by & filed under Personal.

I’ve been having a bad few days. Work just isn’t as fun as it used to be. I find myself throwing coworkers under the bus left and right; something I never used to do. Yesterday I sent an email to a third party that sounded a bit snarky (unintentional, but still). These are all classic signs of the burned out developer.

I’ve been on an exercise kick recently. Just a few days ago I ran a Half Marathon distance for fun. Today, I went ice skating with some coworkers (they talked me into buying a season pass). I stepped out onto the ice, made a few passes, and then realized everyone had switched directions, and so I attempted to do a 180 and go with the flow.

Well, my attempt seemed to fail. I ended up slamming my hand into the railing which surrounds the court. Apparently they intend only gloved-hockey-players to use this rink, because my pinky came into contact with a sharp corner of exposed aluminum, which runs around the entire perimeter of the rink. My finger instantly began bleeding all over the place.

Sliced Finger

Come to find out, the cut was very deep, slicing not only through flesh but also through fingernail. Judging from the depth of the cut and my amateur knowledge of human anatomy, I’d wager my finger stopped moving once the aluminum came into contact with bone.

I wrapped it up in a bandaid, and finished the open-skate session. But something magical happened once I sliced my finger open; I stopped giving a fuck.

About what you ask? Everything, I suppose. I knew at that point I really wasn’t going to be getting much done at work for the next day or two, so I sent out an email that I was taking the rest of the day off and probably the next as well. I talked with my friends/coworkers who were skating with me, and told them that I needed to just get away.

And here I am, blogging away at a coffee shop in Toronto, Ontario, Canada.

I’ve never done this before. I’ve never taken a road trip just for the hell of it. Truth be told, I was afrad of travel for many years. Especially when it came to traveling alone. This year, however, has involved a lot of progress for me. I took a trip out to California to visit family. I took a trip (flew alone!) to the TechCrunch Disrupt New York conference for work. I even flew to Ireland for a week with a friend (another coworker) just to see the country.

This time, I literally made my decision, and two hours later was on the road.

Unfortunately, this situation is not something the Border Patrol is used to hearing.

Being male, mid twenties, driving alone, to a part of another country you’ve never been to before, while not knowing anybody in said country, looks really suspicious to the border patrol. The conversation went down a lot like you’d expect.

“What are you here for?
Oh, just a mini vacation.
When’s the last time you were here?
About a year ago, just to Windsor though.
Why did you come here then?
Well, my ex had friends here, and we were visiting.
Are you visiting them today?
Where do you work?
I work at a networking company in Michigan.
Are you here for work?
I’m going to place this sheet of paper under your windshield wiper. Please pull ahead to customs.”

At this point, it becomes obvious that I’m going to be here a while. I pull up, get out of my vehicle, and wait for someone to come assist me. A border patrol worker comes and begins going through my car, making sure to check every nook and cranny of the center console, my laptop bag, my suitcase and dopp bags, you name it.

“What are you here for, sir?
Just visiting.
Whose car is this?
What is the license plate number?
Are you here visiting anyone?
Is this your laptop?
Are you here for work?
Why are you here, sir?
Just on a mini vacation.
I see you only have one nights worth of clothing. Why are you here for only one night?
Well, I just wanted to get away.
Why did you choose Canada?
Well, Toronto is a big town that isn’t too far, and I reallly didn’t like Chicago.
Can you give me your phone, sir?
Uhh… Sure.
Can you unlock your phone sir?”

It’s at this point I give the man a look of incredulousness.

“If you do not unlock your phone sir, I will have our IT guys unlock it for me.”

I punch in the code to the phone. He disappears around the back of the car, and him and another guy begin going through my phone. The sort of things they checked included call history, text messages, facebook chat history, and going through my photos. I knew this because the apps were now higher up in the run history, and were scrolled back a surprising distance. The last screen opened when I got the phone back was half way through my Ireland vacation photos (a couple thousand in).

“Sir, can you please help me out here. I’m just trying to put your story together. You came here, on a whim, just to spend a day, in a place you don’t know, with nobody you know, in the middle of the week when you should be at work?”

I did my best to explain. I doubt they believed a word of my story, but seeing as there was in fact no drugs in my car, and I kept telling them that I wasn’t here to work, and they didn’t have anything to pin on me, they finally checked off a box on the sheet of paper and allowed me to enter a nearby building.

In here, the woman behind the counter was a little bit nicer. She asked me the same sets of questions I had heard several times again. This time though, she asked me something I thought was pretty funny.

“Are you here to gamble online?
Uhh, no.
Are you sure?
I’m positive.
Everybody gambles online!
It’s just not for me.
Well, what is this laptop for then? Are you here to work? If so, we have forms you can fill out.
No, I just like to have my laptop.”

I’m not sure if that was an attempt at entrapment or what. I have no idea why someone would want to drive 5 hours into another country, just to whip out their laptop and gamble online. Surely, there are better ways to gamble, such as going to a casino, or playing cards in a basement with friends. Of course, this isn’t even mentioning the concept of using a server in another country as a proxy to get around the regional restrictions that online gambling websites undoubtedly have. (There’s no way I would have said that though; to these people, knowledge is an admittance of guilt).

Posted by & filed under Uncategorized.

A friend linked to this game the other day:

Cookie Clicker

It’s really simple. You click something over and over, and you buy upgrades, and then some automated processes happen in the background.

Open your console, and paste in the following commands. They will allow you to play the game automatically. Notice the $$; this uses MooTools, not jQuery.

// Automatically purchase new products (e.g. Grandmas) each second as they become available
setInterval(function() { $$('.product.enabled')[0].click(); }, 1000);

// Automatically click the big cookie 10 times per second
setInterval(function() {$('#bigCookie').click();}, 100);

// Automatically purchase upgrades each second as they become available
setInterval(function() { $$('.upgrade.enabled')[0].click(); }, 1000);

These simple commands don’t play the game as efficiently as possible. One could graph out the best way to play the game, which would involve saving up for better options instead of always spending money.

For Cookie Clicker to prevent this easy way of cheating the game, they’d probably want to not load MooTools as a global object, and randomize the names of DOM elements each time the game is loaded. Those wouldn’t prevent these cheats 100%, but it would make them harder to perform.

Posted by & filed under OS X.

I’m trying to make use of the latest version of ApacheBench (2.4.3) to perform some benchmarking against my local server. Unfortunately, it seems to be broke as hell.

$ ab -n 100000 http://localhost:3000/analytics
This is ApacheBench, Version 2.3 <$Revision: 1373084 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,

Benchmarking localhost (be patient)
apr_socket_recv: Connection refused (61)

Interestingly, the output of the command tells me that I’m using ab 2.3, when the HomeBrew build version is 2.4.3:

brew info ab
ab: stable 2.4.3

I find that ApacheBench generally doesn’t work very well, especially under OS X. There’s all sorts of quirks (If benchmarking the root of a site, a slash must be added or ab will error out). The most annoying part is that OS X doesn’t have a good way to allow more open ports from a single process.

Does anyone know how to get this tool working again? Or, does anyone know of a better alternative?

Posted by & filed under Personal.

It would be illegal to tell the users of your web service that you have been subpoena’d by the NSA and forced to give access to private customer data.

However, would it be illegal to create a blog post every single day saying that the service has never received a subpoena, then stop creating new posts once it has happened?

Posted by & filed under Linux, OS X.

I use the following command to recursively download a bunch of files from a website to my local machine. It is great for working with open directories of files, e.g. those made available from the Apache web server.

The following can be added to your .bash_profile or .bashrc script, depending on which your OS/distro recommends:

function download-web() {
    wget -r -nH --no-parent --reject='index.html*' "$@" ;

To invoke the command, you run it like so:


It will then download everything linked from the first page, checking each child path, to the current directory. It will not download anything above that directory, and will not keep a local copy of those index.html files (or index.html?blah=blah which get pretty annoying).

This isn’t a simple alias, but is a bash function, so that you can add a URL after the command. It should work fine in both OS X and Linux. If you are using OS X, you can follow my guide for Installing WGET on OS X.

Posted by & filed under Personal.

So, yeah, I wrote this book:

Instant Backbone.js Application Development

The process took a couple months, despite the relatively short length of the book. You wouldn’t believe how many times the book has to go back and forth between the publisher and the writer! I’ll have to write about my experiences in more depth in the future, for those of you interested in publishing works yourself.

The book is currently only available as a digital download, I think it’ll take a few weeks for the copies to get printed before we’ll see physical copies for sale.

The book itself is intended for people who know some JavaScript, and who don’t really know Backbone.js, and are looking to build Single Page Applications. If you like my writing style, and are interested in learning Backbone.js, by all means grab yourself a copy!

Posted by & filed under Reviews.

I just put down my copy of Hands-on Testing with PHPUnit How-to by Michael Lively, published through Packt Publishing.

Overall, this is a pretty good book, and covers all of the topics one would expect from a Unit Testing book. Such topics include getting PHPUnit installed via PEAR, writing and running some basic tests, doing some configuration of PHPUnit, how to incorporate PHPUnit into your project, how to generate PHPUnit tests semi-automatically using an existing codebase, fixtures and providers and mock objects, how to setup test dependencies, testing abstract classes and traits, how to expect good exceptions and errors, using output buffering for the purpose of testing CLI scripts, how one tests private and protected members, testing database connections, and making sense of the automatically generated code coverage HTML.

The book flows from subject to subject smoothly, with each new topic building on the knowledge of previous topics, without ever introducing the reader to an overly-complex topic. The reader is guided along with concise code examples and explanations of why everything is happening. The author also covers alternative libraries for making Unit Testing easier whenever possible, most notably when covering different mocking frameworks such as Mockery or the authors very-own Phake. Another appreciated set of alternatives include using SQLite for keeping track of data and how the same thing can be done with XML or YAML.

One thing I did wish the book covered more is the why behind Unit Testing, and how to get the reader into the Test Driven Development (TDD) mindset, however this is undoubtedly outside of the scope of a book in the Packt Instant series. Personally, I find myself lacking in the Unit Testing department. The last two large PHP projects I’ve worked on both had PHPUnit integrated into the codebase and I always find myself writing my Unit Tests at the last minute, well after the code had been finalized.

Several sections of the book did open my eyes to the true potential of PHPUnit, most notably the ability to automatically create unit test skeletons based on existing codebases. This will make for a great way to introduce Unit Testing to existing projects which otherwise lack testing. I was also surprised to see that PHPUnit had a solution for testing Traits, a new feature of PHP 5.4. I did find it interesting that there are standardized methods for testing database connectivity; I had always been under the impression that doing so was taboo.

If you are new to the concept of Unit Testing, and would like to apply it to PHP in particular, I highly recommend picking up a copy of Hands-on Testing with PHPUnit How-to by Michael Lively. It’s a small book, quickly digested, and will make a nice desk-side companion (heck, I’ve already got friends who want to borrow my copy). While the code is thoroughly explained, the content is terse enough to serve as a reference.