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
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "("${ref#refs/heads/}")" | |
} | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
PS1="$GREEN \w$YELLOW \$(parse_git_branch)\$ " |
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
gem 'oauth' | |
require 'oauth/consumer' | |
@consumer = OAuth::Consumer.new("your api key", "your oauth consumer secret", :site => "http://www.ohloh.net") | |
@request_token = @consumer.get_request_token |
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
# Sample ReportOutputter & child class (FileOutputter) | |
class ReportOutputter | |
attr_accessort :report_generator | |
def initialize(report_generator) | |
@report_generator = report_generator | |
end | |
def write | |
print_all_students |
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 Tester < ActiveRecord::Base | |
include AASM | |
aasm_initial_state :inactive | |
aasm_state :inactive | |
aasm_state :active, | |
:after_enter => :after_active_state | |
aasm_event :activate do | |
transitions :to => :active, | |
:from => [:inactive], |
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 Tester < ActiveRecord::Base | |
include AASM | |
aasm_initial_state :inactive | |
aasm_state :inactive | |
aasm_state :active, | |
:after_enter => :after_active_state | |
aasm_event :activate, | |
:after => :after_event do | |
transitions :to => :active, |
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
pdp-mbp: ~ $ cat hostlist.txt | |
sfo-crawl-4 | |
sfo-crawl-5 | |
sfo-crawl-6 | |
sfo-crawl-7 | |
sfo-crawl-8 | |
sfo-crawl-9 | |
sfo-crawl-11 | |
sfo-crawl-14 | |
pdp-mbp: ~ $ csshX --host hostlist.txt |
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
[1] pry(main)> module Helper | |
[1] pry(main)* def set_stuff | |
[1] pry(main)* @stuff = 'something' | |
[1] pry(main)* end | |
[1] pry(main)* end | |
=> nil | |
[2] pry(main)> class Controller | |
[2] pry(main)* include Helper | |
[2] pry(main)* def index | |
[2] pry(main)* set_stuff |
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
@buffer.each do |elem| | |
@output.write(elem) | |
@output_count += 1 | |
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
def flush | |
return if @buffer.length < @max_length # don't flush yet | |
# ... rest of logic | |
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
links, entries = [], [] | |
data["entityView"].each do |elem| | |
case elem | |
when "links" | |
elem.each{|e| links << Link.new(e)} | |
when "entries" | |
elem.each{|e| entries << Entry.new(e)} | |
else | |
raise "Unknown Element!" |
OlderNewer