This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
@@caller_counter = {} | |
def include_with_caller?(value) | |
key = caller[0,4].join('|') | |
@@caller_counter[key] = (@@caller_counter[key] || 0) + 1 | |
include_without_caller?(value) | |
end | |
alias_method_chain :include?, :caller | |
def self.callers | |
@@caller_counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
@irb_extensions = [] | |
def require_for_irb_with_fallback_for_bundler_constraints(gem_name, load_file = nil) | |
load_file ||= gem_name | |
begin | |
begin | |
require load_file | |
rescue LoadError => e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show Term::ANSIColor effects | |
(Term::ANSIColor.methods - Module.methods).sort.each{|x| print "#{x}: ".ljust(15); begin; puts Term::ANSIColor.send(x, 'foo bar'); rescue; puts 'error'; end } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveSupport::BufferedLogger | |
def add(severity, message = nil, progname = nil, &block) | |
return if @level > severity | |
message = (message || (block && block.call) || progname).to_s | |
# If a newline is necessary then create a new message ending with a newline. | |
# Ensures that the original message is not mutated. | |
message = "#{message}\n" unless message[-1] == ?\n | |
buffer << message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \1 $SYM/' | |
} | |
BLUE="\[\e[1;34m\]" | |
BLUE_="\[\e[0;34m\]" | |
BROWN_="\[\e[0;33m\]" | |
RESET="\[\e[0;0m\]" | |
SYM="$BLUE_Δ" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class I18n::Backend::Simple | |
module Implementation | |
protected | |
def lookup(locale, key, scope = [], options = {}) | |
init_translations unless initialized? | |
keys = I18n.normalize_keys(locale, key, scope, options[:separator]) | |
keys.inject(translations) do |result, _key| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/buffered_logger' | |
class ActiveSupport::BufferedLogger | |
def add(severity, message = nil, progname = nil, &block) | |
add_debugging_details(severity) | |
@log.add(severity, message, progname, &block) | |
end | |
private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'looksee' | |
Looksee.styles.each_key { |key| Looksee.styles[key] = "%s" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install git curl build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev libffi-dev tk-dev |