Skip to content

Instantly share code, notes, and snippets.


Adrian Rowbotham aderowbotham

View GitHub Profile
aderowbotham /
Created Jun 7, 2012
Django stack setup on EC2 AMI

Django Stack


This is a set of instructions to setup a Django Nginx Gunicorn MySQL/Postgres stack on a single Amazon EC2 instance.

Server - AWS

aderowbotham / Cache-bust Gruntfile.js
Last active May 11, 2020
Set cache-busing file revision using Grunt
View Cache-bust Gruntfile.js
Example using grunt-contrib-concat, but this should work with any package
Inject string-based timestamp into an output filename, e.g. vendor-min.ka2bct2u.js
module.exports = function(grunt) {
aderowbotham / php_argv_environment.php
Created Nov 25, 2012
PHP / Codeigniter - set environment when running in CLI mode
View php_argv_environment.php
# in public_html/index.php
* Where your CodeIgniter ENVIRONMENT is normally defined by the server environment
* variables, and assuming your database settings are automatically set based on
* that environment, this causes a problem when running the application through
* PHP on the command line e.g. in order to run CodeIgniter Migrations
aderowbotham /
Last active Nov 9, 2018
Purge (ban) an entire domain in Varnish Cache 3

How to purge ('ban') an entire domain in Varnish Cache 3

#####EDIT: NB Ban is technically different from Purge. Banned objects remain in memory but banning is faster than purging. Read the Varnish 3 documentation here and here.

Purge may be a more appropriate action for your use-case; although the examples in the gist below work, it's not necessarily the best way of doing this.

aderowbotham / formatted-print_r.php
Last active Jan 14, 2016
PHP debugging shortcut for '<pre>' + print_r() + die(), that formats keys in red and values in blue.
View formatted-print_r.php
# colour-formatted print_r shortcut
if ( ! function_exists('prd')){
function prd($object,$die=TRUE){
# insert span tags
$output = '<span class="die_value">'.$output;
$output = str_replace('[', '<span class="die_key">[', print_r($object,TRUE));
$output = str_replace(']', ']</span>', $output);
$output = str_replace('=> ', '=> <span class="die_value">', $output);
View uploadify_footer.html
aderowbotham / mobile_not_implemented.css
Created Jul 3, 2013
mobile layout not implemented notification message (for sites in development)
View mobile_not_implemented.css
/* mobile
============================================================================================== */
@media screen and (min-width: 0) and (max-width: 700px) {
/* hide everything */
div, span, p
display: none;
body:before {
View gist:5559476
# Copied from
# Thanks to Kristian Lyngstøl / @KristianLyng for putting this together
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
aderowbotham /
Last active Nov 2, 2015
Spreadsheet concatenation formulae

Spreadsheet concatenation formulae

These are tested in Open Office. May need modifying for Excel.

Combine multiple address fields into one

Contatenate cells B5 - F5, inserting a comma and line break, only if the cell is not blank


aderowbotham /
Last active Oct 13, 2015
Developers' Tools

##Developers’ Tools

I’ve created this list as a place to capture some of the handy tools that frequently get shared among developers.

Note: the category anchors were working yesterday, but seem to have stopped working today. GitHub is no longer rendering anchor tags at each header. If anyone knows of a solution let me know!


You can’t perform that action at this time.