Skip to content

Instantly share code, notes, and snippets.

View lachie's full-sized avatar

Lachie Cox lachie

View GitHub Profile
@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
#!/usr/bin/env ruby
# [You need dropbox - http://dropbox.com/]
# cd ~/Dropbox
# mkdir ssh
# cd ssh
# git init
# cd .git/hooks
# [paste this file into post-commit]
# chmod 755 post-commit
# Simple script for adding and updating vim bundles to your setup.
#
# Throw it into your .vim diretory.
#
# cd ~/.vim
# thor vim:update
# thor vim:add git://github.com/tpope/vim-rails.git
#
require 'pathname'
require 'pp'
delimiter = "[-/.]+"
century_prefix = "(?:19|20)"
under_ten = "(?:0[1-9]+)"
ten_to_twelve = "(?:1[012]+)"
ten_and_under_thirty = "(?:[12]+[0-9]+)"
thirties = "(?:3[01]+)"
pattern = %r[
(