Skip to content

Instantly share code, notes, and snippets.

View ghuntley's full-sized avatar
minimalist

Geoffrey Huntley ghuntley

minimalist
View GitHub Profile
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
@ghuntley
ghuntley / network_grabber.rb
Created June 2, 2011 03:32 — forked from callumj/network_grabber.rb
Grab all CITS3230 pdfs
require 'nokogiri'
require 'open-uri'
root_path = "http://undergraduate.csse.uwa.edu.au/units/CITS3230"
Nokogiri::HTML(open("#{root_path}/schedule.html")).css('a').each { |link| File.open("#{Dir.home}/#{File.basename(link['href'])}", 'wb') {|f| f.write(open("#{root_path}/#{link['href']}").read()) } if link['href'] =~ /\b.+.pdf/ }
@ghuntley
ghuntley / post-checkout
Created June 27, 2011 11:24 — forked from drichert/post-checkout
git post-checkout hook for compressing javascript (via uglifyjs)
#!/bin/bash
branch=$(git symbolic-ref -q HEAD |sed 's/refs\/heads\///')
gitroot=$(git rev-parse --show-toplevel)
jsdir="js"
targetdir="$gitroot/$jsdir"
files=$(find $targetdir -maxdepth 1 -type f -name '*.js' ! \( -name '*.min.js' \))
echo -n "Uglifying javascript... "
for f in $files; do
@ghuntley
ghuntley / router.js
Created July 22, 2011 02:52
Resourceful Routing with Sencha Touch
Ext.apply(Ext.Router, {
/**
* Alias a named route to an existing named route for laziness.
*
* map.connect('messages', { controller: 'messages', action: 'index' });
* map.alias('message_center', 'messages');
*
* @param {String} alias The name of the alias to create
* @param {String} existing The name of the existing route to map the alias to
@ghuntley
ghuntley / Pandora on command line with Pianobar, homebrew install instructions, Snow Leopard
Created August 6, 2011 11:47
Pianobar command line Pandora client homebrew install instructions
# OS X install instructions http://www.reddit.com/r/linux/comments/a3snu/pianobar_is_a_command_line_client_for_pandora_no/c0fupws
brew install libao
# brew install libfaad2 # not available with brew, skipped and is working ok...
brew install libmad
brew install cmake # (this takes a while)
# install
git clone git://github.com/PromyLOPh/pianobar.git
cd pianobar
@ghuntley
ghuntley / server.js
Created October 1, 2011 01:36 — forked from kusor/server.js
Sample node-restify server
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var nopt = require('nopt');
var restify = require('restify');
// Custom libraries
// var foo = require('./lib/foo');
///--- Globals
@ghuntley
ghuntley / get_itunes_movie_art.py
Created October 5, 2011 05:31 — forked from worksology/get_artwork.py
A quick command line script to get full movie cover art from iTunes. Just run the script using: python get_itunes_movie_art.py and then follow the prompts.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import urllib, urllib2
import json
SEARCH_URL = "http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?entity=movie&term="
SAVE_TO = "%s/Artwork/" % os.environ["HOME"] # Directory must exist
TITLES = [] # Optionally populate this with a list of titles for batch processing
@ghuntley
ghuntley / hack.sh
Created March 31, 2012 10:45 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ghuntley
ghuntley / fabfile.py
Created April 10, 2012 06:52 — forked from onyxfish/fabfile.py
Chicago Tribune News Applications fabric deployment script
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
@ghuntley
ghuntley / customer.js
Created April 26, 2012 01:10 — forked from geek0x23/customer.js
A mongoose model that takes advantage of the handy invalidate method to run multiple validations
var mongoose = require('./db-connect'),
Schema = mongoose.Schema,
ObjectId = Schema.ObjectId,
uuid = require('node-uuid'),
Validator = require('validator').Validator,
val = new Validator(),
bcrypt = require('bcrypt');
Validator.prototype.error = function(msg) { return false; };