Skip to content

Instantly share code, notes, and snippets.

View airblade's full-sized avatar

Andy Stewart airblade

View GitHub Profile
==== start log session ====
0.000024 function gitgutter#process_buffer[10]..gitgutter#diff#run_diff[73]..gitgutter#utility#system[1]:
0.000024 cd /Users/cody && (git ls-files --error-unmatch .vimrc && (git -c "diff.autorefreshindex=0" diff --no-ext-diff --no-color -U0 -- .vimrc | grep --color=never -e '^@@ ' || exit 0))
==== start log session ====
0.000042 function gitgutter#process_buffer[10]..gitgutter#diff#run_diff[73]..gitgutter#utility#system[1]:
-- See article here: http://daringfireball.net/2007/07/simple_inbox_sweeper
-- The following should be one long line:
set _description to "All unflagged, read messages in each IMAP account
inbox will be moved to the “Archive” mailbox corresponding to that
account. This action is not undoable."
tell application "Mail"
display alert "Archive read messages from IMAP inboxes?" buttons ¬
{"Cancel", "Archive"} cancel button 1 message _description
@airblade
airblade / config.ru
Created December 15, 2011 09:08 — forked from mislav/config.ru
Shortest simplest sweetest web "hello {NAME}" in Ruby
run ->(e){ p=Hash[*e['QUERY_STRING'].split(/[&=]/)]; [200, {'Content-type'=>'text/html'}, ["Hello #{p['name']}!"]] }
@airblade
airblade / new-git.sh
Created June 9, 2011 17:50 — forked from topfunky/new-git.sh
Create a new git repository on a remote server. Assumes that you're sitting in an initialized Git repo.
function new-git () {
ssh git@example.com "mkdir $1.git && cd $1.git && git --bare init"
git remote add origin git@example.com:$1.git
git push origin master
git config branch.master.remote origin
git config branch.master.merge refs/heads/master
git config push.default current
}
# Rackup file for serving up a static site from a "public" directory
#
# Useful for chucking a static site on Heroku
class IndexRewriter
def initialize(app) @app = app end
def call(env)
env["PATH_INFO"].gsub! /\/$/, '/index.html'
@app.call(env)
end
@airblade
airblade / html.rb
Created May 12, 2010 09:02 — forked from mislav/html.rb
require 'nokogiri'
ugly = Nokogiri::HTML ARGF
tidy = Nokogiri::XSLT File.open('tidy.xsl')
nice = tidy.transform(ugly).to_html
puts nice
class ApplicationController < ActionController::Base
include Intercession
before_filter :load_skin
before_filter :require_user
before_filter :require_matching_skin
before_filter :require_admin
def load_skin
session.skin = Skin.for_request(request)