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 PostsController < InheritedResources::Base | |
belongs_to :blog, :optional => true # The controller can be nested (/blog/1/posts) or flat (/posts) | |
# How do make load_and_authorize_resource accept optional :blog? | |
load_and_authorize_resource :blog | |
load_and_authorize_resource :post, :through => :blog | |
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
href2selector = (href) -> href.match(/(#.+)/)[1] | |
class App.ContentSwitcher extends Spine.Controller | |
elements: | |
'li': 'items' | |
events: | |
'click li a': 'clickLink' | |
constructor: -> | |
super |
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
it("can understand checkboxes as booleans", function(){ | |
var form = $('<form />'); | |
form.append('<input name="available" value="1" checked="checked" />'); | |
var asset = Asset.fromForm(form); | |
expect(asset.available).toEqual(true); | |
form.find('input').prop('checked', false); | |
expect(Asset.fromForm(form).available).toEqual(false); | |
}); |
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
files = %w{ajax.js list.js local.js manager.js relation.js route.js spine.js tabs.js tmpl.js} | |
all = files.inject('') {|m, c| m + File.read("lib/#{c}") } | |
puts "Initial size: #{all.length / 1024}kb" # => | |
require 'closure-compiler' | |
content = Closure::Compiler.new.compile all | |
puts "Compressed size: #{content.length / 1024}kb" | |
File.write('spine-min.js', content) |
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 'closure-compiler' | |
packages = { | |
bare: %w{spine.js}, | |
core: %w{spine.js ajax.js route.js tmpl.js}, | |
full: %w{ajax.js list.js local.js manager.js relation.js route.js spine.js tabs.js tmpl.js} | |
} | |
packages.each_pair do |package, files| | |
all = files.inject('') {|m, c| m + File.read("lib/#{c}") } |
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
shared_examples_for "weird" do |options={}| | |
# Uncomment to make it work in jruby | |
#options = {} unless options.respond_to? :to_hash | |
it "should be a hash" do | |
options.should be_a Hash | |
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
......................***......FFFFFFFF.FFF.....F...*..............FFFFFFFFFF*.F...............**........F..FFFF.FF.....FFF.FFFFF...F.......F** | |
Pending: | |
Architect4r::Server execute_cypher should return an array of nodes | |
# No reason given | |
# ./spec/core/cypher_methods_spec.rb:9 | |
Architect4r::Server execute_cypher should return an array of relationships | |
# No reason given | |
# ./spec/core/cypher_methods_spec.rb:15 | |
Architect4r::Server execute_cypher should the data unprocessed |
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
# | wall time | specs | | |
# JRuby | 69s | 34s | | |
# Ruby 1.9.3 | 28s | 16s | | |
# x faster | x2.5 | 2.1 | | |
> ruby -v | |
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java] | |
> time bundle exec rspec spec | |
Finished in 33.8 seconds |
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
> rvm use jruby | |
Using /Users/dnagir/.rvm/gems/jruby-1.6.5 | |
> bundle exec rspec spec/models/user_spec.rb --backtrace | |
NameError: uninitialized constant ActiveRecord | |
> rvm use 1.9.3 | |
Using /Users/dnagir/.rvm/gems/ruby-1.9.3-p0 |
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
> rvm info | |
jruby-1.6.5: | |
system: | |
uname: "Darwin dima-mac.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64" | |
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)" | |
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)" | |
rvm: |