This file contains 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
the alchemist turned lead to gold | |
as tales through the ages have told | |
but alpha decay | |
meant the gleam didn't stay | |
so those isotopes never got old |
This file contains 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
git for-each-ref --sort=-committerdate refs/remotes/origin/ --format='%(committerdate:short) %(refname:short)' |
This file contains 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 'benchmark' | |
include Benchmark | |
class Weeble | |
attr_reader :name, :age, :salary, :language | |
def initialize(name, age, salary, language) | |
@name, @age, @salary, @language = name, age, salary, language | |
end | |
def sorter |
This file contains 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
options.scan(/\w+=\w+/).inject({}) { |h,opt| k,v = opt.split('=',2); h[k] = v; h } | |
This file contains 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 'benchmark' | |
class Validated | |
def valid? | |
true | |
end | |
end | |
c1 = [Validated.new] | |
c10 = c1 * 10 |
This file contains 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
Host project1.github.com | |
HostName github.com | |
User git # Probably not needed but just a note if you want to skip it | |
IdentityFile ~/.ssh/your_key_file | |
IdentitiesOnly yes # This is only if you want to avoid trying other identities which can speed things up a bit. | |
This file contains 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
# at the very least, use inheritance! | |
class Object | |
alias_method :try, :send | |
end | |
class NilClass | |
def try(*args) | |
nil | |
end |
This file contains 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 ApplicationController < ActionController::Base | |
around_filter :you_are_here | |
def you_are_here | |
puts "***** NEW ACTION: #{controller_name} - #{action_name} *****" | |
begin | |
yield | |
ensure | |
puts "<pre>" | |
if $! then |
This file contains 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
export PS1="\[\033[36m\]\h:\W>\[\033[0m\] " | |
export PS1="\[\033[36m\]\h:\w \[\033[33m\]\$(parse_git_branch)\$(parse_svn_branch)\[\033[00m\]$\[\033[00m\] " |
This file contains 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
# drop this in config/initializers/count_fix.rb to work around | |
# hmt/named_scope count bug https://rails.lighthouseapp.com/projects/8994/tickets/2189 | |
class ActiveRecord::Base | |
protected | |
def self.construct_count_options_from_args(*args) | |
name_and_options = super | |
name_and_options[0] = '*' if name_and_options[0].is_a?(String) && name_and_options[0] =~ /\.\*$/ | |
name_and_options | |
end |
OlderNewer