Pragmatism in the real world

Jerry-rigging pygments to support new PHP keywords

I use rst2pdf to create my presentations and noticed that the syntax highlighter wasn't highlighting instanceof. rst2pdf uses pygments for syntax highlighting, so I wondered what was going on. A short investigation led to me realise that the current stable version of pigments is 1.6 and they are working on 2.0. It seems that 2.0 has a number of changes to the PHP lexer, which aren't in 1.6. While I'm waiting, I modified my local… continue reading.

View status of all Vagrant environments

I've just upgraded to Vagrant version 1.6, and vagrant global-status is possibly my favourite new feature. This command lists all currently up Vagrant environments wherever they may be on your computer: $ vagrant global-status id name provider state directory ————————————————————————————– dbc7770 joindin virtualbox running /Users/rob/www/thirdparty/joindin-vm 0683c7a default virtualbox running /Users/rob/www/thirdparty/joindin-zs7 The above shows information about all known Vagrant environments on this machine. This data is cached and may not be completely up-to-date. To interact with… continue reading.

Z-Ray for Zend Server 7

I see that Zend Server 7 has now been released. I've been running the beta for all my development work for a while now and the main reason is the new Z-Ray feature. Z-Ray is a bar that is injected into the bottom of your page showing lots of useful information. This is what it looks like in its closed state when run on my development version of joind.in: At a glance, I can see… continue reading.

Styling a Chosen select to fit Bootstrap 3 better

One project that I'm currently working on is an internal business application that's using stock Bootstrap 3. I needed a searchable select box and Chosen fitted the bill, so I'm using that. However, the default styles for the Chosen select box differ slightly from Bootstrap. The most noticeable being the height of the control.

Perl syntax highlighting in Sublime Text 3

I'm currently writing a project in Perl for a client and have discovered that the default Perl syntax highlighting in Sublime Text is terrible. Fortunately, the community has stepped up and Blaise Roth has created the ModerlPerl package. Install via Package Control. To get all Perl files to open with the new syntax highlighter, use View > Syntax > Open all with current extension as… and select ModernPerl from the sub-menu.

Setting up Zend Server 6 on OS X for PHP development

I recently decided to upgrade my Mac's PHP to 5.4. One of the available options is Zend Server 6.1, Free edition. These are my notes how to set it up so that it works the way I develop. Installation Mount the disk image and follow the installation wizard. On OS X, Zend Server installs PHP, Apache and MySQL inside /usr/local/zend. The Zend Server admin interface is at at http://localhost:10081. On first run you have to… continue reading.

Adding Diff syntax highlighting to Sublime Text

My chosen colour scheme for Sublime Text doesn't include support for diff/patch files, so I added my own. To the bottom of my .tmTheme file, I added this just above the closing </array>: <dict> <key>name</key> <string>diff.header</string> <key>scope</key> <string>meta.diff, meta.diff.header</string> <key>settings</key> <dict> <key>foreground</key> <string>#009933</string> </dict> </dict> <dict> <key>name</key> <string>diff.deleted</string> <key>scope</key> <string>markup.deleted</string> <key>settings</key> <dict> <key>foreground</key> <string>#DD5555</string> </dict> </dict> <dict> <key>name</key> <string>diff.inserted</string> <key>scope</key> <string>markup.inserted</string> <key>settings</key> <dict> <key>foreground</key> <string>#3333FF</string> </dict> </dict> <dict> <key>name</key> <string>diff.changed</string> <key>scope</key> <string>markup.changed</string> <key>settings</key> <dict> <key>foreground</key>… continue reading.

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.