Skip to content

Instantly share code, notes, and snippets.

Christian Hanvey christianhanvey

  • Sydney
Block or report user

Report or block christianhanvey

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
christianhanvey / app.js
Created Apr 16, 2014
angular radio switch directive - an on/off switch
View app.js = angular.module('mainApp', []);
app.controller('mainCtrl', function ($scope) {
$scope.include = 'yes';
app.directive('radioSwitch', ['analyticsSettings', function (analyticsSettings) {
return {
restrict: 'A',
scope: {
View gist:10820339
angular.module('ng').run(['$rootScope', function($rootScope) {
$rootScope.safeApply = function(fn) {
var phase = this.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
if(fn && (typeof(fn) === 'function')) {
} else {
christianhanvey / jquery.equalHeights.js
Created Oct 2, 2013
Ye olde jQuery equal heights plugin
View jquery.equalHeights.js
// jQuery plugin to create equal height elements
// Will make all elements that match the seletor the same height - matching the tallest of all of the elements.
// usage:
// $('.selector').equalHeights();
(function ( $ ) {
$.fn.equalHeights = function(els) {
var maxHeight = 0;
christianhanvey /
Last active Nov 1, 2017
A shell script to help automate the upgrade of a MODX Revolution installation
# ---------------
# A shell script to help automate the upgrade of a MODX Revolution installation
# This script is for traditional installations only - not advanced
# Instructions:
# 1. Update the config section with your own site specific details
# 2. Upload this file to your server, preferably outside of web root
christianhanvey / modx-content-search-and-replace.php
Last active Dec 15, 2017
MODX utility snippet: replace absolute formed links in site content eg -> [[~99]] note: backing up modx_site_content table is a good idea before running this :) (original author: BobRay)
View modx-content-search-and-replace.php
$docs = $modx->getCollection('modDocument');
$pattern = '/\d+)/';
$replacement = '[[~$1]]';
$count = 0;
foreach ($docs as $doc) {
$content = $doc->getContent();
$hash1 = sha1($content);
christianhanvey / MODX
Last active Jun 14, 2017
Some links on caching for MODX

If you are using git, so you can take advantage of static elements within MODX, you will need to be aware that simply updating your files does not mean MODX will pick that up. It will pick up changes in a file IF you the element is being called uncached.

This is not a big deal while working on a development site, performance is not your initial priority at that point. But when you get to deploying, you'll need to know that updating a file will not necessarily update how your site runs, and you don't want to be clearing your entire site cache. A big site would be taking a heavy server hit as its visitors trigger all pages regenerating their cache...

For an overview of MODX caching strategy, start at the documentation (of course) if you havn't already:

View Contract Killer

Website Contract

Revised date: 13/03/2013

Between us: Crunch Design

and you: [customer name]


christianhanvey / links
Created Jul 24, 2012
some useful reference links - in markdown
View links
christianhanvey / modx object examiner
Created Jul 22, 2012
modx revo object debug helper snippet
View modx object examiner
* File viewRevoObjects.php (requires MODx Revolution 2.1)
* Created on: 9/17/11 at 9:49 AM
* Project shawn_wilkerson
* @elements
* @version 1.0
* @category
* @author W. Shawn Wilkerson
christianhanvey /
Created Jul 2, 2012 — forked from harthur/
console.log() key binding for Sublime Text

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }, "context":
You can’t perform that action at this time.