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
def top_three_scores | |
player_scores = [2,1,4,3].sort | |
player_scores.reverse! | |
player_scores.tap{|a| a.pop } | |
end | |
top_three_scores # => [4,3,2] |
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
def top_three_scores | |
[2,1,4,3].tap{|a| a.sort! }.tap{|a| a.reverse! }.tap{|a| a.select!{|s| s > 1}} # => [4,3,2] | |
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
def bond | |
Mechanize.new.tap{|a| a.log = Logger.new(log_path)} | |
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
def bond | |
agent = Mechanize.new | |
agent.log = Logger.new(log_path) | |
agent | |
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
module Frank | |
class Sinatra | |
def self.inherited(subclass) | |
(@@subclasses ||= []) << subclass | |
@@subclasses.uniq! | |
end | |
def self.for_namespace(filter) | |
@@subclasses.select{|c| c.to_s.include? filter.to_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
plotOptions: { | |
line : { | |
dataLabels : { | |
enabled : true, | |
formatter: function() { | |
var first = this.series.data[0], | |
last = this.series.data[this.series.data.length - 1]; | |
if ((this.point.category === first.category && this.point.y === first.y) || | |
(this.point.category === last.category && this.point.y === last.y)) { | |
return this.point.y; |
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' | |
require "net/https" | |
require "uri" | |
require "json" | |
login = ENV['BF_GITHUB_USER'] | |
pass = ENV['BF_GITHUB_PASS'] | |
repos = ENV['BF_GITHUB_REPO'] | |
file_to_upload = 'http/git.ref' |
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
module Commands | |
class << self | |
%w{one one two two three three}.each_with_index do |button, index| | |
current = 4 + index | |
method_prefix = (current % 2 == 0 ? "off" : "on") | |
define_method "outlet_#{button}_#{method_prefix}" do |tty| | |
current | |
end | |
end | |
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
#!/usr/bin/ruby | |
require 'fileutils' | |
include FileUtils | |
here = File.expand_path(File.dirname(__FILE__)) | |
git_dirs = Dir.glob("#{here}/*/.git") | |
svn_dirs = Dir.glob("#{here}/*/.svn") | |
def git_pull(path) | |
cd path |
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
#!/usr/bin/ruby | |
require 'fileutils' | |
include FileUtils | |
$here = File.expand_path(File.dirname(".")) | |
git_dirs = Dir.glob("#{$here}/*/.git").reject{|x| x == "." || x == ".." } | |
@total = {} | |
def translate(user) | |
case user |