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 'optparse' | |
optparse = OptionParser.new do |opts| | |
opts.banner = 'Usage: shift_subtitle.rb --operation add|sub --time ss,mmm input_file output_file' | |
opts.on('--operation OPERATION', /^add|sub$/, 'OPERATION must be add or sub'){|o| @operation=o} | |
opts.on('--time TIME_SHIFT', /^\d{2},\d{3}$/, | |
'TIME_SHIFT must be in format ss,mmm, where ss are the seconds and mmm are the milliseconds to shift') do |o| | |
@time_shift = o.sub(',', '.').to_f | |
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
file_cache_path "/root/chef-solo" | |
cookbook_path "/root/chef-solo/cookbooks" | |
json_attribs "/root/chef-solo/node.json" |
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
Gitorious::Messaging.default_implementation = :in_memory | |
Gitorious::Messaging.start | |
Gitorious::Messaging.publish_to_queue('queue_name', :something => 1) | |
Gitorious::Messaging.publish_to_queue('queue_name', :something => 2) | |
messages = [] | |
Gitorious::Messaging.subscribe_to_queue('queue_name'){|msg| puts "message: #{msg}"; messages << msg} |
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
# spec/js/show-terms-and-conditions.spec.coffee: | |
require './jasmine-sinon' # wouldn't you love if vanilla JavaScript also supported 'require'? | |
dom = require 'jsdom' | |
#f = (fn) -> __dirname + '/../../web-app/js/' + fn # if you prefer to be more explicit | |
f = (fn) -> '../../web-app/js/' + fn | |
window = $ = null |
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 'nokogiri' | |
require 'benchmark' | |
require 'thread' | |
require 'open-uri' | |
# for JRUBY: export JRUBY_OPTS="--1.9 -J-Xmx2048m" | |
# JRuby 1.6.7 doesn't support File.write yet in 1.9 mode. Just doing some cache here - not important | |
File.open('test.html', 'w'){|f| f.write(open('http://www.sec.gov/Archives/edgar/data/1129623/000095012310064472/d73737ddefm14a.htm').read) } unless File.exists?('test.html') | |
content = File.read('test.html') |
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
# ruby client.rb SheetName > output.xls | |
require 'drb/drb' | |
SERVER_URI="druby://localhost:8787" | |
DRb.start_service | |
service = DRbObject.new_with_uri(SERVER_URI) | |
puts service.get_excel_output('sheet_name' => ARGV.first || 'Test') |
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 Life | |
attr_reader :live_cells | |
def initialize(live_cells) | |
@live_cells = live_cells | |
end | |
alias :to_a :live_cells | |
def next_generation |
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 fake_ajax_server | |
createProducts = -> [ | |
{id: 1, name: 'One'} | |
{id: 2, name: 'Two'} | |
] | |
extendClass 'specs.ShoppingCartSpec', -> | |
createFakeServer: -> | |
@fakeServer = new FakeAjaxServer (url, settings)-> |
OlderNewer