Pragmatism in the real world

Notes on embedding fonts in rst2pdf

I wanted to use Helvetica Light in a PDF that I'm creating using rst2pdf and this proved a little tricker than I expected. Note that to use fonts with rst2pdf, you need to install fontconfig using brew: brew install fontconfig Now, on to the problem! In this case, I discovered that setting stdFont: Helvetica-Light or stdFont: HelveticaLight in the style file resulted in Verdana being used in the PDF file! Fortunately, the -v switch to… continue reading.

Improved Sublime Text 2 PHP getter and setter generation

As I've been using Sublime Text 2 for all coding for the last year, I've noticed a significant problem with my simple 'getset' snippet that I created last year: it doesn't handle underscores in property names correctly. I've finally got around to fix it! As with a lot of editors, Sublime Text supports snippets which are essentially text expansions of a short phrase into more text. This snippet creates a getXxx() and setXxx() method from… continue reading.

Gittyup – Easily keep master in sync with upstream

If, like me, you use git and have an upstream remote which is not your origin, then I highly recommend that you use Evan Coury's gittyup script. This is a very simple script that does the following: 1. Verify that you are in a valid Git repo. 2. Remember which branch you are on. 3. Stash any uncommitted changes you have. 4. Checkout master. 5. Fetch all remotes. (nice to track other remotes) 6. Merge… continue reading.

Sublime Text 2 Plugin: Function Name Display

As I'm using Sublime Text 2 more and more, I thought it would be useful to display the current method name in the status bar. I poked around on the forums and created a plugin from ideas I found in a couple of different threads. This plugin is imaginatively titled Sublime Function Name Display! As I've hooked into the on_selection_modified event handler, I was keen to avoid slowing down the editor too much when you… continue reading.

Two new Sublime Text 2 packages for PHP

Stuart Herbert has written two new Sublime Text packages for PHP: Additional PHP Snippets PHPUnit The best way to install these is to install Package Control first and then use shift+cmd+P -> install package. Even better, Stuart has rolled my getter/setter creation snippet into Additional PHP Snippets, so you can now have it without any hassle! Update: Also, Ben Selby has created a package for DocBlox!

Sublime Text 2 Snippet for PHP getter and setter generation

Update: This article has been superseded by Improved Sublime Text 2 PHP getter and setter generation I've been playing with Sublime Text 2 recently and have quite enjoyed how quiet my ageing laptop is when the fans aren't running due to a Java-based IDE. As with a lot of editors, Sublime Text supports snippets which are essentially text expansions of a short phrase into more text. I needed to create a few getXxx() and setXxx()… continue reading.

Using PDT with Zend Framework Projects

I original wrote this as a comment on Victor Nicollet's blog, but I thought I should document it here too so that I can refer other people to the information. These are some tips and tricks when using PDT with Zend Framework that make my life easier: Autocompletion for dynamic properties Zend_Db_Table_Row_Abstract uses __get() and __set() magic in order to map to the underlying database table row in question. This means that you can use… continue reading.

The watch Linux command line tool

I'm sure everyone else already knows about watch, but it's new to me. This little utility executes a program repeatedly at a set interval and displays its output. I've been using it with mysqladmin's processlist command like this: watch -n 1 /usr/bin/mysqladmin -uroot -pMYPASSWORD processlist Note that this does put your password on display at the top of the command window whilst watch is running. If you don't want that, you could write a little… continue reading.

Flickr Uploadr

The new Flickr Uploadr was written using Xul. Richard Crowley has put up a post at the Flickr blog with links to various articles that he's written about devloping with XUlrunner. Fascinating stuff and a must read for anyone who writes Xulrunner apps. Even better, the full source to Uploadr is available!

On Mail.app

As I mentioned a while ago, I'm now using a MacBook Pro. All is going well, and I like Mail.app's search and data detectors very much. There are some niggles though that I miss from Thunderbird. My top 3 are: * GPG integration (Thunderbird's Enigmail) * Mail.app's insistence on attached PDFs and images inline * Filing mails to arbitrary folders using the keyboard (Thunderbird's nostalgy) It turns out that there are solutions to all three… continue reading.