Skip to content

Instantly share code, notes, and snippets.

# When specifying :template
merb : worker (port 4000) ~ Starting Mongrel at port 4000
merb : worker (port 4000) ~ Successfully bound to port 4000
merb : worker (port 4000) ~ Started request handling: Wed Nov 19 20:22:57 -0800 2008
merb : worker (port 4000) ~ Routed to: {"format"=>nil, "action"=>"index", "id"=>nil, "controller"=>"merb_plume_theme_silver/main_silver"}
merb : worker (port 4000) ~ Params: {"format"=>nil, "action"=>"index", "id"=>nil, "controller"=>"merb_plume_theme_silver/main_silver"}
merb : worker (port 4000) ~ No layout found at /home/max/Documents/merb/merb_plume/app/views/layout/template/path/to/silver.html.erb - (Merb::ControllerExceptions::TemplateNotFound)
/usr/lib/ruby/gems/1.8/gems/merb-core-1.0.1/lib/merb-core/controller/mixins/render.rb:380:in `_get_layout'
/usr/lib/ruby/gems/1.8/gems/merb-core-1.0.1/lib/merb-core/controller/mixins/render.rb:143:in `render'
class Array
def sum
inject {|sum, n| sum + (n || 0)} || 0
end
# Sum two numeric arrays
def add(other_array)
raise ArgumentError unless other_array.is_a? Array
(length > other_array.length ? zip(other_array) : other_array.zip(self)).collect(&:sum)
end
<html>
<head>
<!--
<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.js" type="text/javascript"></script>
<script src="http://ui.jquery.com/bugs/export/1659/tags/1.6rc4/ui/jquery.ui.all.js" type="text/javascript"></script>
<!-- -->
<!-- -->
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.js" type="text/javascript"></script>
<script src="http://ui.jquery.com/bugs/export/1659/tags/1.6rc5/ui/jquery.ui.all.js" type="text/javascript"></script>
@nanodeath
nanodeath / Logged In: Badges
Created February 11, 2009 03:26
WriteTogether Mockups
/--------------------------
|
|
|
|
undefined method `state=' for #<Fiber:0x98d5820>
/home/max/Projects/writetogether/controller/news.rb:8:in `block in index'
#<Ramaze::Request
@params={}
@cookies={"_ramaze_session_id"=>"149c015a2ddd186fcd421e3595a79cae2d055197e9c1169b15cdcaa28f301a58"}
@env={"PATH_INFO"=>"/news",
"QUERY_STRING"=>"",
"REMOTE_ADDR"=>"127.0.0.1",
"REMOTE_HOST"=>"localhost",
/usr/local/lib/ruby/gems/1.9.1/gems/sequel-2.10.0/lib/sequel_model/record.rb:52:in `[]=': undefined method `include?' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/sequel-2.10.0/lib/sequel_model/base.rb:445:in `block (3 levels) in def_column_accessor'
from /home/max/Projects/writetogether/model/init.rb:16:in `<top (required)>'
from start.rb:14:in `require'
from start.rb:14:in `<main>'
require 'stringio'
class Tree
attr_accessor :value
attr_reader :children
def initialize(value)
@value = value
@children = []
end
class SlateBinding < ::Tenjin::Context
def initialize(binding)
super(Slate::TemplateEngine::get_instance_variables_from(binding))
@binding = binding
end
def method_missing(meth, *args)
eval("#{meth}(\"#{args.join('","')}\")", @binding)
end
end
def method_missing(meth, *args)
i = 0
attributes = args.map do
i += 1
"var#{i}"
end
st = Struct.new("TempVar", *attributes).new
target_inst = eval('self', @binding)
target = eval("self", binding)
unless target.respond_to? :start_capture
target.class.instance_eval { include ::Tenjin::ContextHelper; include ::Tenjin::HtmlHelper; }
end
result.render(target)