Skip to content

Instantly share code, notes, and snippets.

View lachie's full-sized avatar

Lachie Cox lachie

View GitHub Profile
define [
"easel_filters"
], ({ColourFilter}) ->
# split hex colour into r,g,b
#
# Usage:
# hex2rgb 0xff0000 # => [255, 0, 0]
define [
"easel"
"easel_filters"
], ({}, {ColourFilter}) ->
# tint helper
# pass in r,g,b or a HEX value
# HEX value in this form: 0xFFFFFF
# gup and friends
function git_current_branch() {
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///'
}
alias grb='git rebase -p'
alias gup_base='git fetch origin && grb origin/$(git_current_branch)'
@lachie
lachie / application.js
Created August 18, 2011 11:56
rails 3.1 asset pipeline + stitch/CommonJS
// in app/assets/javascripts/application.js
//= require jquery
//= require jquery_ujs
//= require ./stitch_header
//= require_tree .
@lachie
lachie / gist:1028745
Created June 16, 2011 05:48
run Spotlight's core, temporarily
$ sudo /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Support/mds
task :eg => %w[eg:examples eg:acceptance]
namespace :eg do
ExampleRoot = Rails.root+'examples'
task :examples => :test_env do
in_example_root do
FileList.new(ExampleRoot+'*.eg.rb').each {|eg| run_eg eg }
end
end
upstream <%= @app.id %> {
server unix:<%= @app.socket.to_s %> fail_timeout=0;
}
server {
listen 80;
root <%= @app.docroot.to_s %>;
# arb change
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
# this includes ^
require File.expand_path('../lib/rake_dev',__FILE__)
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
" http://gist.github.com/gists/412549
"
" Paste syntax highlighted code into Keynote for presentational yum.
" by Lachie Cox
"
" put all this into your .vimrc
" (I might wrap it into a plugin one day)
"
" You could probably do the whole thing from vim, but I wanted to tweak to HTML
" a bit before pasting, so I pass the HTML to a ruby script (Gisted below)
task :cache => :environment do
hydra = Typhoeus::Hydra.hydra
LocationWalker.each_location do |url|
req = # build request
hydra.queue
end
hydra.on_complete do |response|
if response.success?
LocationCacher.cache(response.body) # can give you headers too if you need 'em