Chris Ashton

The difference between on_delete: :restrict, :nullify, and :cascade

13 December 2019

I was working on a Rails project today and came across this: I knew what a foreign key was, but I didn’t know the impact of the on_delete callback. Looking around the codebase, other options were used too: :nullify and :cascade. And several searches online didn’t help to explain what any of these actually did…. [Read More]

Why we set a `Cache-Control: Max-Age` of 1 year

24 April 2019

It’s standard practice to set a Cache-Control: max-age=31536000 on assets which are expected not to change, such as images. This header instructs the browser to cache the asset for 31536000 seconds, which is one year. Which raises two questions for me: Why a year? Why not ten years, or six months? Do we actually expect browsers… [Read More]

Use RequireJS with WordPress (plugins) & jQuery (UI)

19 June 2016

I recently found myself really wanting to use RequireJS with WordPress, to manage the various JavaScript dependencies a client site had. Unfortunately, this was easier said than done. WordPress is historically not very compatible with RequireJS, as it provides jQuery and a myriad of other JavaScript files out of the box, which are difficult to… [Read More]

The discipline of ‘good enough’

06 October 2016

As a perfectionist, by definition, something is only ‘good enough’ if it is perfect. I really struggle to live with untested code, or shoddy code, or duplicated code. I come from a world where code can be beautiful, and code is the thing I have complete control over; something I understand and can make better through… [Read More]

Localised CSS

04 February 2015

Localised CSS is the only long-term, maintainable responsive development methodology for large-scale websites developed by multiple teams.

The five-line rule

29 January 2015

I run with a metaphor far too much to try to explain a programming principle I think more developers should adhere to.