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
module GitCommands | |
class ShellError < RuntimeError; end | |
@logging = ENV['LOGGING'] != "false" | |
def self.run cmd, *expected_exitstatuses | |
puts "+ #{cmd}" if @logging | |
output = `#{cmd} 2>&1` | |
puts output.gsub(/^/, "- ") if @logging | |
expected_exitstatuses << 0 if expected_exitstatuses.empty? |
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 Person | |
def self.region(str, &blk) | |
self.class_eval(&blk) | |
end | |
end | |
class Joe < Person | |
def name; "Joe"; end | |
region "speaking" do |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 Foo | |
attr_accessor :bar | |
def initialize(bar, validator = BarValidator) | |
validator.validate!(bar) | |
@bar = bar | |
end | |
end | |
class BarValidator |
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 Post | |
include FigLeaf | |
include ActiveModel::Validations | |
# ... | |
end |
NewerOlder