I also blogged about the tracking branches in a bit more detail if you’re interested.
Yearly Archives: 2014
Understanding Tracking Branches in Git
Some branches in git (such as your origin/master branch) will usually track the remote branch that they are related to. But what if you want to create a relationship between local and remote branches? Or stop them from tracking? Here’s some pointers Continue reading
Running Pull Request Builds with Jenkins
What Got You Involved in Open Source?
Logging to Stdout with Monolog
I’m a huge fan of Monolog so I grabbed that, but it wasn’t immediately obvious which of the many and varied options I would need for this fairly simple addition. It turns out that the right thing to use is the ErrorLogHandler, so now my code looks like this:
<?php
require "vendor/autoload.php";
$logger = new \Monolog\Logger("log");
$logger->pushHandler(new \Monolog\Handler\ErrorLogHandler());
$logger->addInfo("Something happened");
And the output is neatly in lines like this:
[2014-06-05 17:00:47] log.INFO: Something happened [] []
You can do a lot of different things with Monolog, but since I had to look up this simplest of all options, I thought I’d share.
Colourless Git Output
Try putting the following into .git/config:
[color]
branch = false
diff = false
interactive = false
status = false
I had expected to be able to set color.ui to false but that didn’t seem to make much difference, so I now use the settings above. I thought I’d drop it here in case anyone else is looking for the same thing.
PHP 5.6 Benchmarks
Recently I ran it again for versions PHP 5.3 through PHP 5.6 and I thought I’d share my results:
Easy Lint Check for JavaScript
Beanstalk, Pheanstalk and Priorities
<?php
define("LOW_PRIORITY", 2048); // default is 1024
$queue = new Pheanstalk_Pheanstalk($config['beanstalkd']['host'] . ":" . $config['beanstalkd']['port']);
$queue->useTube("scorem")->put(json_encode(array("action" => "my_important_task")), LOW_PRIORITY);
This will add the job to the queue, but anything with a higher priority value (where 1 is the highest priority!) will take precendence. This way I can add as many non-urgent jobs as I want to to the queue without impacting my website performance. My setup has multiple workers and also I tend to write a script that puts loads of tiny jobs on the queue rather than putting one monster task on there. I find this approach a bit more fault-tolerant and also means that incoming tasks can get a chance to get serviced rather than waiting for some crazy huge thing to finish.
I had real issues finding information about the priority settings for beanstalkd and PHP, so hopefully if anyone is looking for it, they will find this post :)
Copy/Pasting and Vim
To paste between vim and something else, use the + (plus) buffer in vim. It contains the contents of your system clipboard, and you can also write to it. If you’re not already using buffers in vim, then you should probably read the excellent documentation but for a very quick start:
- To copy something into the buffer, select it in visual mode and type
"+y - To paste from the buffer, type
"+P
I had no idea how I’d missed this really fundamental trick, so I thought I’d share!

