Skip to content

Instantly share code, notes, and snippets.

View caius's full-sized avatar
👻

Caius Durling caius

👻
View GitHub Profile
# ============
# = Take One =
# ============
module Something
# Setup some exceptions
class ZOMGError < Exception; end
class UserFail < Exception; end
class NeedMoarCowbell < Exception; end
end

List my stashes:

Julius:myapp(311-features) caius$ git stash list
stash@{0}: WIP on 445-specs: ac063a3 Fleshing out specs.

As you can see I have a stash on a different branch, now I want to see what the changes in the stash are. I wonder if git stash show will tell me that:

Julius:myapp(311-features) caius$ git stash show stash@{0}
 spec/models/my_model_spec.rb |   18 ++++++++++++++----

1 files changed, 14 insertions(+), 4 deletions(-)

# Lists all require's in a rails project, excluding vendor/*
egrep -r "require (['\"])\w+\\1" `for i in \`ls\`; do if [[ "$i" != "vendor" ]]; then echo -n "$i " ; fi ; done` | sed "s/^.*require //g" | sed "s/['\"]//g" | awk '{ print $1 }' | grep -v rubygems
[alias]
rebase-on-master = !sh -c \"git rebase -i HEAD~`git log --format=oneline master.. | wc -l | awk '{ print $1 }'`\"
--
-- Script to beat the "How fast can you type" game on facebook.
-- http://apps.facebook.com/typea-z/?ref=mf
--
-- Created by Caius Durling on 2009-07-26.
-- Copyright 2009 Caius Durling. All rights reserved.
--
-- Click "Start" on the quiz, switch to script editor and hit run.
--
class SecureController < ApplicationController
layout 'secure'
def booking
@secure = Secure.find(:first, :conditions => {
:email => params[:secure][:email],
:reference => params[:secure][:reference]
})
# Redirect if we have the data
redirect_to secure_booking2_path and return unless @secure.nil?
#
# update_slicehost_dns.rb
# Updates the A record of a domain to your
# current IP address
#
# Created by Caius Durling on 2009-07-30.
# Copyright 2009 Caius Durling.
#
# MIT Licence
irb(main):004:0> @b.goto "file:///Users/caius/Desktop/input.html"
=> "file:/Users/caius/Desktop/input.html"
irb(main):005:0> @b.button(:index, 1).html
=> "<input type=\"image\" src=\"avatar.png\"/>\n"
irb(main):006:0> @b.image(:index, 1).html
Celerity::Exception::UnknownObjectException: Unable to locate Image, using :index and 1
from /Volumes/SSD/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/celerity-0.0.6.16/lib/celerity/element.rb:163:in `assert_exists'
from /Volumes/SSD/opt/local/share/java/jruby/lib/ruby/gems/1.8/gems/celerity-0.0.6.16/lib/celerity/element.rb:211:in `to_xml'
require "extend_regex_concat"
a = /foo/
b = /bar/m
c = /(sed)/i
Regexp.concat(a, b, c) # => /foobar(sed)/mi
### HABARI START
RewriteEngine On
# Redirect index.php?id=5 to ?id=5
# This assumes your blog is located at /habari
# If it isn't, remove or change "habari" in the next two lines
RewriteCond %{THE_REQUEST} ^\w+\ /habari/index.php\?id=(\d+)
RewriteRule ^(.*)$ /habari/?id=%1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f