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 Template | |
def initialize(content) | |
@content = content | |
end | |
def render(context) | |
context = Hashie::Mash.new(context) | |
@content.gsub(/(%{([^}]+)})/) do | |
context[Regexp.last_match[2]] |
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
# Load the rails application | |
require File.expand_path('../application', __FILE__) | |
# Initialize the rails application | |
UbuReporting::Application.initialize! | |
Dir[File.expand_path('../../lib/reports/*.rb', __FILE__)].each { |f| load f } | |
Dir[File.expand_path('../../app/reports/*.rb', __FILE__)].each { |f| load f } |
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 Game | |
constructor: -> | |
@drawInterval = 150 | |
@characterX = 2 | |
@characterY = 2 | |
@imageRepository = null | |
@imagesLoadedCallback = (loadedImages) -> | |
alert "Hey!" | |
@imageRepository = loadedImages | |
setInterval(@draw, @drawInterval) |
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
NoMethodError: undefined method `best_available' for ExecJS::Runtimes:Module | |
/Users/clockwize/.rvm/gems/ruby-1.8.7-p334/gems/execjs-0.1.0/lib/execjs.rb:30:in `runtime' | |
/Users/clockwize/.rvm/gems/ruby-1.8.7-p334/gems/execjs-0.1.0/lib/execjs.rb:22:in `compile' | |
/Users/clockwize/.rvm/gems/ruby-1.8.7-p334/gems/coffee-script-2.2.0/lib/coffee_script.rb:31:in `context' | |
/Users/clockwize/.rvm/gems/ruby-1.8.7-p334/gems/coffee-script-2.2.0/lib/coffee_script.rb:57:in `compile' |
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
Rendered reports/filters/date_range.html.haml (32.0ms) | |
Rendered reports/filters/multi_select.html.haml (48.0ms) | |
Rendered reports/filters/multi_select.html.haml (10.2ms) | |
Rendered reports/_table.html.haml (34642.6ms) | |
Rendered reports/view.html.haml within layouts/application (35273.0ms) | |
::_table.html.haml:: | |
%table | |
%thead | |
%tr |
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 self.by_id(id) | |
cached_supplier = @suppliers.find { |s| s.db_id == id } | |
return cached_supplier if cached_supplier | |
supplier = from_row(DB[:supplier].filter(:supplier_id => id).first) | |
@suppliers << supplier | |
supplier | |
end | |
def self.all | |
return @suppliers unless @suppliers.empty? |
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 TagCloud | |
MAP = <<-JS | |
function () { | |
this.tags.forEach(function (tag) { | |
emit(tag, 1); | |
}); | |
} | |
JS | |
REDUCE = <<-JS |
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
app/views/energy/index.html.haml: | |
-page_title = "Test title" | |
%h1 energy page | |
app/views/layouts/application.html.haml: | |
%title= page_title | |
app/helpers/application_helper.rb: |
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
view: | |
= f.inputs :name => "Contract details", :class => "accordion" do | |
= f.input :mpan | |
= f.input :kva | |
= f.input :voltage, :as => :radio, :collection => {"Low" => "LV", "High" => "HV"} | |
= f.input :estimated_annual_consumption | |
model: |
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
g++ -I. -I/Users/clockwize/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0 -I/Users/clockwize/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/i686-darwin10.8.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch x86_64 -g -Os -pipe -no-cpp-precomp -fno-common -pipe -fno-common -c MyClass.cpp | |
MyClass.cpp: In function ‘void Init_MyClass()’: | |
MyClass.cpp:11: error: invalid conversion from ‘VALUE (*)(VALUE, VALUE)’ to ‘VALUE (*)(...)’ | |
MyClass.cpp:11: error: initializing argument 3 of ‘void rb_define_method(VALUE, const char*, VALUE (*)(...), int)’ |
OlderNewer