Sorting lists of complex elements

JavaScript JQuery
In researching the best ways of sorting flight tickets displayed to end users in the DOM I did some research to compare to scenarios: Given that a list of items exists on the dom (and is recreate-able in JavaScript):
  • Sort the items in JavaScript and re-render the entire list
  • Extract the dom items using jQuery, sort them, and re-append them to the dom
Surprisingly the jQuery way wins consistently (even on iPad). You can see the result at
Read more ›

Real world JavaScript performance of large element lists

At Rome2rio we're working on improving the front-end performance of our large booking ticket lists which present upwards of 150 combinations to users. When considering front-end performance we consider both the DOM speed as well as the Javascript execution time.
Read more ›

Give all user permissions to the admin role in Drupal

Drupal permissions
I've seen, especially on older Drupal websites, situations in which the default admin role has either not been set or the role has had to be changed. Changing the admin role in Drupal however doesn't automatically give the role all the permissions on the site - to do that you'll need to either use a macro to tick all the boxes on the admin/people/permissions form or use the following update script.
Read more ›

Using Backbone.js with CoffeeScript

Backbone.js CoffeeScript

If you want an example of just how elegant CoffeeScript can get, look no further then how it integrates with Backbone.js. In this tutorial we're creating a model and a collection in Backbone.js in it's simplest form, then expanding it to include API variable mapping - something you're going to have to do when integrating with API's in the future.

Read more ›

Testing in QUnit with CoffeeScript

QUnit CoffeeScript

During an interview process recently I was asked to create a CoffeeScript powered AJAX widget for displaying external content. Having never used CoffeeScript before I decided to go about learning it in a completely test driven way instead of the standard of the usual “hack a few things together and recover” way I’ve done in the past.

Read more ›

Field Paywall walkthrough


Field paywall is a Drupal module I produced for News Corp Australia that allows Drupal editors to assign paywalls to entities choosing which fields to hide and what kind of message to display. Using the core Drupal Field API framework, Field Paywall can be retrofitted on to existing nodes without having to make major changes to system configuration as all configuration is done through field instance settings and is Features exportable.

Read more ›

How to use the $user->data property

Drupal Entity API
Everything you need to know about how to use the highly performant $user->data property whilst maintaining data integrity with a bit of best practise Single Responsibility Principle and Single-Entry, Single-Exit thrown in for good measure.
Read more ›

Resetting a module schema with Drush

Drupal Drush
There are times when you're testing hook_update_N hooks and need to revert to a previous schema version to re-run your update hook. For example if your developing an update called my_custom_module_update_7002 and you run it there are only two ways you can re-run that update hook; 1, incrementing the update name to my_custom_module_update_7003 or 2, resetting my_custom_module's schema in the system table to be 7001.
Read more ›