Blog

Latest Entries

If you need to order results from a MySQL query by a specific field value first then there’s a couple of approaches you can use. Let’s use as an example a table of countries where we want to order alphabetically but put the United Kingdom first.

PHP traits provide a convenient means of sharing methods between classes. There are times though that we may need to override or extend a method defined in a trait attached to a class. Let’s take a look at how we can achieve this.

I’ve just released a new beta version of arc_meta for Textpattern 4.6.

As with the previous beta release, this one has a minimum requirement of Textpattern 4.6 which is also still in beta release; so neither of them are recommended for use on a live production site. However, if you use arc_meta and are testing the new version of Textpattern please check out this new release.

I’m a keen advocate for following coding standards. They help maintain consistency in code, especially when developing with others, and can generally help you to write better code. I work with Sublime Text for developing in PHP and have it set up to check against whichever coding standard I am currently using as I code. For PHP development the tool to use is PHP CodeSniffer which I’ve previously written about setting up for Sublime Text 3 on this site.

TinyMCE’s pagebreak plugin is a handy way of providing users a way of marking breaks in content by placing a HTML comment in the source code denoting the break. However, if you are using the editor’s valid_elements attribute to restrict HTML elements used in the content (a good idea if you don’t want all sorts of messy markup getting added) you need to make sure you allow comment tags.

Earlier today I found myself needing to configure Rocketeer to deploy to a server that required commands to be run with sudo. I’m not sure that this is particularly well documented so I thought I’d share how I did this here.

Credit cards
Credit cards photo by NY - http://nyphotographic.com/

Fed up with searching for documentation of test payment cards for specific payment gateways the other day I decided to start compiling a cheatsheet of them. It can be frustrating trying to figure out what card numbers can be used for testing especially considering the many poorly documented payment gateways out there. So I created the Test Payment Cards cheatsheet repository.