Tutorial – Create a POST hook on BitBucket

A powerful tool offered by both GitHub (GH) and BitBucket (BB) are so-called “Hooks” which allow certain actions in your repository to trigger other actions. BitBucket’s definition:

Hooks allow you to extend what Bitbucket does when the repository changes (for example, new code is pushed or a pull request is merged).

There are many different kinds of Hooks and I invite you to check out GitHub and Bitbucket‘s documentations for a full list of possible options and how to implement them.

In this tutorial, I’m going to set up a BitBucket “POST” hook. My goal is to force all of my front-end machines to update their local clones of the main repository when a git push is done on the Master branch.

Continue reading Tutorial – Create a POST hook on BitBucket

View xdebug cachegrind files on Mac OS

Xdebug is key when it comes to optimizing PHP code. Today, I heard my colleague boot up a Windows machine just to run an application that could interpret a cachegrind file generated by our development server… surely there must be a Mac equivalent! The following instructions will let you interpret cachegrind files locally on your Mac. Continue reading View xdebug cachegrind files on Mac OS

Network Link Conditioner Built right into iOS6

A few months ago, I discussed how you could use the Network Link Conditioner on your Mac to simulate different network connections. As of iOS6, Apple has added a Network Link Conditioner right into the OS meaning that you can set the quality of the network you wish to simulate right from your device allowing for even more accurate testing.

Continue reading Network Link Conditioner Built right into iOS6

Fix “/tmp/.tmp.err” error on your website

I woke up one morning to find that all the websites hosted on my server (VPS-based) were returning an error that looked something like this :

Warning: Unknown: SAFE MODE Restriction in effect. The script whose uid is 10012 is not allowed to access /tmp/.tmp.err owned by uid 0 in Unknown on line 0
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Warning: Unknown: SAFE MODE Restriction in effect. The script whose uid is 10012 is not allowed to access /tmp/.tmp.err owned by uid 0 in Unknown on line 0

Fixing this turned out to be quite easy but not necessarily obvious.
Continue reading Fix “/tmp/.tmp.err” error on your website

[PHP] Faster array lookup than using in_array()

If you use arrays in PHP, one of the most common tasks you’ll find yourself doing is determining if Item A is in Array X. The function you would probably use in this case is PHP’s in_array.

bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )

This function works great and I recommend sticking to it when it makes sense. However, when you’re dealing with a very large haystack and need to run in_array() on thousands of values, you’ll discover that in_array isn’t particularly fast when cumulated over thousands of calls. Having recently run into this situation, I set up a little experiment to try two different approaches to in_array().

Continue reading


Faster array lookup than using in_array()