Skip to content

Instantly share code, notes, and snippets.

View ryan-blunden's full-sized avatar

Ryan Blunden ryan-blunden

  • Brisbane, Australia
View GitHub Profile
@ryan-blunden
ryan-blunden / xslt.py
Last active October 6, 2022 15:48
XSLT Preview Tool
#!/usr/bin/env python
'''Basic XSLT previewer'''
__author__ = 'Ryan Blunden'
__copyright__ = 'Copyright 2010, Ryan Blunden'
__license__ = 'GPL'
__email__ = '[email protected]'
__status__ = 'Development'
@ryan-blunden
ryan-blunden / handlebars.render_from_remote.js
Created July 5, 2011 00:05
Handlebars remote template renderer
/**
* HandleBars remote template loader
*
* Allows for direct insertion into dom if jQuery selector string is passed (el).
* Returns $.ajax promise regardless so code can attach callbacks externally.
*
* @example
* // Direct insertion into dom
* Handlebars.renderFromRemote('/media/templates/hello.handlebars', { name: 'Ryan' }, '#content');
*
@ryan-blunden
ryan-blunden / random_password
Created October 31, 2011 01:37
Random password generator
#!/usr/bin/env node
/**
* Create a random password of variable length and copy it to the clipboard
* Usage: 'random_password 4' produces a 4 character password
*/
var pass = '';
while(pass.length < process.argv[2]) {
@ryan-blunden
ryan-blunden / addClass.js
Created December 19, 2011 06:23
Basic BDD example for addClass method
/**
* Experimenting with no frills BDD to write a simple addClass method
*/
function TestSuite(name, setup, teardown) {
var leftPadding = 60;
this.name = name || '';
this.tests = [];
this.setup = setup || function() {},
@ryan-blunden
ryan-blunden / gist:1498586
Created December 19, 2011 19:51
CSS Transitions experimentation
<!doctype html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge;chrome=1" >
<title>Slide Up using CSS3 Transitions</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Ryan Blunden">
<style type="text/css">
@ryan-blunden
ryan-blunden / timer.js
Created February 1, 2012 22:05
Timing functions for Rhino
/**
* Timer for Rhino, original functions from http://stackoverflow.com/questions/2261705/how-to-run-a-javascript-function-asynchronously-without-using-settimeout#answer-5767884
* written by Weston C.
* Packaged by Ryan Blunden
*/
(function () {
var root = this, // global context
timer = new java.util.Timer(),
counter = 1,
@ryan-blunden
ryan-blunden / valgrind-install
Created April 2, 2012 21:03
Valgrind install script
#!/bin/bash
# Valgrind install - inspired by http://c.learncodethehardway.org/book/learn-c-the-hard-waych5.html
# Ryan Blunden, 2012
# Update as Valgrind is updated
version="3.7.0"
verified_checksum="a855fda56edf05614f099dca316d1775"
# 1) Change into tmp
@ryan-blunden
ryan-blunden / gist:2418993
Created April 19, 2012 05:58
Upgrade pip, virtualenv and virtualenvwrapper on OSX Lion
#!/bin/bash
# Upgrade pip, virtualenv, virtualenvwrapper to the latest versions for the current version of python
# Ryan Blunden
site_packages=`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
sudo rm -fr $site_packages/pip-*
sudo rm -fr $site_packages/virtualenv-*
sudo rm -fr $site_packages/virtualenvwrapper-*
@ryan-blunden
ryan-blunden / gist:2418996
Created April 19, 2012 05:59
Get python site-packages location
python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
@ryan-blunden
ryan-blunden / blinksale.py
Created July 2, 2012 06:09
Transform a Blinksale XML document into list of invoices in CSV format
#!/usr/bin/env python
'''Transform a Blinksale XML document into list of invoices in CSV format'''
__author__ = 'Ryan Blunden'
__copyright__ = 'Copyright 2012, Ryan Blunden'
__license__ = 'GPL'
import sys
import csv