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
| 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 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
| git for-each-ref --sort=-committerdate refs/remotes/origin/ --format='%(committerdate:short) %(refname:short)' |
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 '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 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
| options.scan(/\w+=\w+/).inject({}) { |h,opt| k,v = opt.split('=',2); h[k] = v; h } | |
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 'benchmark' | |
| class Validated | |
| def valid? | |
| true | |
| end | |
| end | |
| c1 = [Validated.new] | |
| c10 = c1 * 10 |
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
| 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 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 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 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
| 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 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
| # 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 |
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_here.rb | |
| # by Josh Susser | |
| class String | |
| # __FILE__.require_here 'foo' # => require 'CURRENT_DIR/foo' | |
| # __FILE__.require_here %w(lib foo) # joins path segments so you don't have to | |
| # __FILE__.require_here # add the current file's directory to the load path | |
| def require_here(path=nil) | |
| here = File.expand_path(File.dirname(self)) | |
| if path |
OlderNewer