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
| environment = Rails.application.assets | |
| asset = nil | |
| environment.send :expire_index! | |
| FileUtils.rm_rf environment.cache.instance_variable_get :@root | |
| puts Benchmark.measure{File.write '/tmp/application-orig.js', (asset = environment['application']).source}.total | |
| puts(Benchmark.measure do |
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
| #!/bin/bash | |
| . /lib/lsb/init-functions | |
| . ~/.rvm/scripts/rvm | |
| # or for rbenv installed with Chef: | |
| # . /etc/profile.d/rbenv.sh | |
| PWD=~/ecore/src/jvm_bridge | |
| PIDFILE=$PWD/tmp/pids/puma.pid | |
| STATUSFILE=$PWD/tmp/pids/state.pid | |
| PORT=4002 |
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
| Simple script that should work if you follow the convention of declaring a single outer class per file with simple class names and structure. | |
| Some files may not be compatible with refinements and should have some comment like "#skip-refinement-conversion" in the file header (first 10_000 chars of the file). The "class" line should also be in the header section of the file. | |
| Files skipped will be copied "as is" to the new directory. |
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
| #!/lib/init/init-d-script | |
| ### BEGIN INIT INFO | |
| # Provides: my-script-name | |
| # Required-Start: $local_fs | |
| # Required-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Description: Run my app on Puma | |
| ### END INIT INFO |
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 '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 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
| 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 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
| # 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 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 '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 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 Life | |
| attr_reader :live_cells | |
| def initialize(live_cells) | |
| @live_cells = live_cells | |
| end | |
| alias :to_a :live_cells | |
| def next_generation |
OlderNewer