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
@mixin co($name) | |
.co-#{$name} | |
@content | |
@mixin el($name) | |
&__#{$name} | |
@content | |
@mixin is($name) | |
&-is-#{$name} |
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
internal extension Dictionary { | |
func merge(dictionary: Dictionary<Key, Value>) -> Dictionary<Key, Value> { | |
var new = self | |
for (key, value) in dictionary { | |
new[key] = value | |
} | |
return new | |
} | |
} |
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 File.join( File.dirname(__FILE__), '../..', "spec_helper" ) | |
module Templating | |
def template(opts) | |
template = { | |
:name => "Default Template", | |
:file_name => "default", | |
:type => "view", | |
:format => "html", | |
:language => "haml" |
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
Merb.logger.info("Compiling routes...") | |
Merb::Router.prepare do | |
# Administration | |
match('/admin').to(:namespace => "admin") do | |
resources :locations | |
resources :users | |
resources :links | |
match("/offer").to(:controller => "offer") do | |
match(:method => "get").to(:action => "show").name(:offer) | |
match("/edit", :method => "get").to(:action => "edit").name(:edit_offer) |
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
NameError: wrong constant name MelonTest::Jam | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/many_to_many.rb:60:in `const_defined?' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations/many_to_many.rb:60:in `setup' | |
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/associations.rb:122:in `has' | |
from ./assoc_test.rb:8 | |
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' | |
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' | |
from (irb):2 | |
from :0 |
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
different prefix: "/" and "." | |
/usr/lib/ruby/1.8/pathname.rb:709:in `relative_path_from' | |
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/default_exception/default_exception.rb:24:in `frame_details' | |
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/default_exception/views/index.html.erb:69:in `__usr__lib__ruby__gems__1_8__gems__merb__core__0_9_8__lib__merb__core__dispatch__default__exception__views__index_html_erb' | |
/usr/lib/ruby/1.8/pathname.rb:709:in `each_with_index' | |
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/default_exception/views/index.html.erb:68:in `each' | |
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/default_exception/views/index.html.erb:68:in `each_with_index' | |
/usr/lib/ruby/gems/1.8/gems/merb-core-0.9.8/lib/merb-core/dispatch/default_exception/views/index.html.erb:68:in `__usr__lib__ruby__gems__1_8__gems__merb__core__0_9_8__lib__merb__core__dispatch__default__exception__views__index_html_erb' | |
/usr/lib/ruby/1.8/path |
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
# This allows users to publish the path to the public pages | |
Merb::Router.extensions do | |
def gluttonberg_pages(prefix = nil) | |
path = prefix ? "/#{prefix}/:path" : "/:path" | |
match(path, :path => /\S+/). | |
to(:controller => "gluttonberg/content/public", :action => "show"). | |
name(:gluttonberg_public_page) | |
end | |
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
class SalesTotals | |
include DataMapper::Resource | |
include DataMapper::Caching | |
property :id, Serial | |
property :sales, Integer | |
property :items, Integer | |
property :value, Money | |
property :start_at, Time | |
property :end_at, Time |
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
# Called like: | |
@page = Page.first_with_localization(:path =>"about_us", :dialect_id => 2, :locale_id => 1) | |
def self.first_with_localization(options) | |
if options[:path] == "" or options[:path].nil? | |
options.delete(:path) | |
page = Page.first(:home => true) | |
raise DataMapper::ObjectNotFoundError unless page | |
localization = page.localizations.first(options) | |
raise DataMapper::ObjectNotFoundError unless localization |
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
The idea is to be able to examine a path inside a #defer_to block and | |
optionally rewrite parts of the request — path, subdomain etc. After the | |
rewrite, the request will go through the router again, where any matching | |
routes will then pick it up. |
OlderNewer