Skip to content

Instantly share code, notes, and snippets.

hello world! lol
@smoofles
smoofles / lol.js
Created July 11, 2011 12:30
lol.js
console.log("lol");
Site.first.pages.where(:extradata.interview_number => "MP1").count
NoMethodError: undefined method `interview_number' for :extradata:Symbol
from (irb):47
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/console.rb:44:in `start'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands/console.rb:8:in `start'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/commands.rb:23:in `<top (required)>'
from ./script/rails:6:in `require'
from ./script/rails:6:in `<main>'
ruby-1.9.2-p0 :048 >
ruby-1.9.2-p0 :046 > Site.first.pages.where(:extradata => {"interview_number" => "MP1"}).count
NoMethodError: undefined method `new' for nil:NilClass
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.3/lib/active_support/whiny_nil.rb:48:in `method_missing'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/bundler/gems/mongoid-da404f47e1c2/lib/mongoid/matchers/strategies.rb:52:in `matcher'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/bundler/gems/mongoid-da404f47e1c2/lib/mongoid/matchers.rb:23:in `block (2 levels) in matches?'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/bundler/gems/mongoid-da404f47e1c2/lib/mongoid/matchers.rb:22:in `each'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/bundler/gems/mongoid-da404f47e1c2/lib/mongoid/matchers.rb:22:in `block in matches?'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/bundler/gems/mongoid-da404f47e1c2/lib/mongoid/matchers.rb:20:in `each_pair'
from /Users/smoofles/.rvm/gems/ruby-1.9.2-p0/bundler/gems/mongoid-da404f47e1c2/lib/mongoid/matchers.rb:20:
@smoofles
smoofles / gist:1009900
Created June 6, 2011 07:57
Mongoid hashes
class Page
include Mongoid::Document
include Mongoid::Timestamps
field :name, :type => String
field :author, :type => String
field :titles, :type => Hash
...
field :extradata, :type => Hash
field :history, :type => Hash
@smoofles
smoofles / _edit.block.html.haml
Created February 25, 2011 21:44
resulting HTML
= link_to t("lpl.manipulate.destroy"), block_path(blck.object.id), :method => :delete, :confirm => t('lpl.delete.block.confirm'), :remote => true, :class => 'remove-block'
= blck.fields_for :contents do |cntnt|
%div{ :class => "lpl content #{blck.object.kind}", :data => { :lpl_language => cntnt.object.language, :lpl_content => "localized" } }
= cntnt.hidden_field :id, :class => "block-id"
@smoofles
smoofles / gist:638175
Created October 21, 2010 09:14
SproutCore View Creation suggestion
Blahblah._360621062 = SC.Page.create({
mainView: SC.View.design({
layout: {
height: 465,
width: 250,
left: 10,
top: 13
}
})
});
.mouse{
position: absolute;
background-image: url('../images/cursor.png');
width: 15px;
height: 22px;
z-index: 100;
}
smoofles:test_r3_dm smoofles$ ./script/generate dm_model Page
/Library/Ruby/Gems/1.8/gems/do_sqlite3-0.9.6/lib/do_sqlite3_ext.bundle: unhandled exception
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.pre/lib/active_support/dependencies.rb:167:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.pre/lib/active_support/dependencies.rb:537:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.pre/lib/active_support/dependencies.rb:167:in `require'
from /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.9.6/lib/do_sqlite3.rb:4
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.0.pre/lib/active_support/dependencies.rb:167:in `require'
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness