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
| ClimateDataIntervals: (self.w_ban_cell_hourlys.select_all.map do |hourly| | |
| hash = { | |
| Year: hourly.Year, | |
| Month: hourly.Month, | |
| Day: hourly.Day, | |
| Hour: hourly.Hour, | |
| GlobalHorizRad_WhPerMeterSquared: hourly.GlobalHorizRad, | |
| DirectNormalRad_WhPerMeterSquared: hourly.DirectNormalRad, | |
| DiffuseHorizRad_WhPerMeterSquared: hourly.DiffuseHorizRad, | |
| DryBulbTemperature_C: (hourly.DryBulbTemperature / 10.0).to_f, |
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
| rectPosition: (rect) -> | |
| rx = + rect.getAttribute('x') | |
| ry = + rect.getAttribute('y') | |
| rctm = rect.getCTM() | |
| xn = rctm.e + rx * rctm.a | |
| yn = rctm.f + ry * rctm.d | |
| r = | |
| x: xn | |
| y: yn |
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 ApplicationController < ActionController::Base | |
| protect_from_forgery | |
| def current_search | |
| Search.find(session[:search_id]) | |
| end | |
| def current_search? | |
| session[:search_id].present? | |
| 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
| require 'spec_helper' | |
| describe ContentController, :type => :controller do | |
| describe "root" do | |
| it "should work" do | |
| get :index | |
| 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 | |
| # 40000.times { $stdout << 'x' } | |
| 17500.times { $stderr << 'x' } |
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 "open4" | |
| require "stringio" | |
| require "ruby-debug" | |
| Open4::popen4("./muchoutput") do |pid, stdin, stdout, stderr| | |
| # stdin.puts "echo 42.out" | |
| # stdin.puts "echo 42.err 1>&2" | |
| stdin.close | |
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
| for (i=0; i < Math.min(arr_length, 4); i=i+1) { | |
| idx = arr.shift(); | |
| new_loading = loading.clone(true); | |
| loading.parentNode.appendChild(new_loading); | |
| new_loading.show(); | |
| new Ajax.Updater(new_loading, '/goals/' + idx + '/list', | |
| { method: 'get', | |
| insertion: 'after', | |
| onSuccess: function(response) { new_loading.remove(); } | |
| }); |
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
| for (i=0; i < Math.min(arr_length, 4); i=i+1) { | |
| idx = arr.shift(); | |
| new_loading = loading.clone(true); | |
| loading.parentNode.appendChild(new_loading); | |
| new_loading.show(); | |
| new Ajax.Updater(new_loading, '/goals/' + idx + '/list', | |
| { method: 'get', | |
| insertion: 'after', | |
| onSuccess: function(response) { new_loading.remove(); } | |
| }); |
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 matches?(stringlike) | |
| @document = Webrat::XML.document(stringlike) | |
| @element = @document.inner_text | |
| case @content | |
| when String | |
| @element.gsub(/\s+/, ' ').include?(@content) | |
| when Regexp | |
| @element.match(@content) | |
| end |