Skip to content

Instantly share code, notes, and snippets.

View foliosus's full-sized avatar

Brent Miller foliosus

View GitHub Profile
module Sanitizer
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def sanitizes(method_names)
method_names.each do |new_method_name|
old_method_name = :"#{method_name}_with_sanitization"
alias_method old_method_name, new_method_name
@foliosus
foliosus / tic-tac-toe-count-fun-bug.rb
Created December 7, 2011 08:36 — forked from jhelwig/tic-tac-toe-count-fun-bug.rb
PDX.rb I Spy 2011-12-06: simple Class-ification
require 'rubygems'
class Board
attr_reader :number
def initialize(n)
@number = n
@array = board(@number)
end
@foliosus
foliosus / delayed_job.conf
Created October 6, 2011 08:28
Upstart script to run delayed_job, with a weird rvm hack
# /etc/init/delayed_job.conf
# Note that you have to modify script/delayed_job's shebang line to have the correct ruby path
description "Delayed_job for a Rails app"
author "Brent Miller <foliosus@foliosus.com>"
start on started mysql
stop on stopping mysql
@foliosus
foliosus / .git-completion.sh
Created September 13, 2011 17:39
Git completion script
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@foliosus
foliosus / .irbrc
Created May 24, 2011 22:28
Interesting .irbrc hacks, including getting logging to your console, making easy calls to the app from the console, easy loading of accounts
ANSI = {}
ANSI[:RESET] = "\e[0m"
ANSI[:BOLD] = "\e[1m"
ANSI[:UNDERLINE] = "\e[4m"
ANSI[:LGRAY] = "\e[0;37m"
ANSI[:GRAY] = "\e[1;30m"
ANSI[:RED] = "\e[31m"
ANSI[:GREEN] = "\e[32m"
ANSI[:YELLOW] = "\e[33m"
ANSI[:BLUE] = "\e[34m"