Skip to content

Instantly share code, notes, and snippets.

View zapatoche's full-sized avatar

Yannick Schall zapatoche

  • Bish Bash Bosh it
  • London, UK
View GitHub Profile
@zapatoche
zapatoche / mongoid embedded documents error
Created November 12, 2011 21:01
mongoid no method error
NoMethodError in EventsController#update
undefined method `extract_id' for "test":String
Rails.root: /Users/yannick/Dropbox/projects/play/demo
Application Trace | Framework Trace | Full Trace
app/controllers/events_controller.rb:49:in `update'
Request
Parameters:
@zapatoche
zapatoche / nested models
Created November 6, 2011 18:44
nested models in rails 3
/models/survey.erb
class Survey < ActiveRecord::Base
has_many :questions, :dependent => :destroy
accepts_nested_attributes_for :questions
validates_presence_of :name
end
/models/question.erb
class Question < ActiveRecord::Base
belongs_to :survey
@zapatoche
zapatoche / rvm error
Created October 31, 2011 20:59
rvm error
/Users/yannick/.rvm/gems/ruby-1.9.2-p290/gems/yard-0.7.3/lib/yard.rb:38: [BUG] Bus Error
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
-- control frame ----------
c:0019 p:---- s:0074 b:0074 l:000073 d:000073 CFUNC :callcc
c:0018 p:0080 s:0071 b:0071 l:000a40 d:000a40 TOP /Users/yannick/.rvm/gems/ruby-1.9.2-p290/gems/yard-0.7.3/lib/yard.rb:38
c:0017 p:---- s:0068 b:0068 l:000067 d:000067 FINISH
c:0016 p:---- s:0066 b:0066 l:000065 d:000065 CFUNC :require
c:0015 p:0053 s:0062 b:0062 l:0024b8 d:0024b8 METHOD /Users/yannick/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36
c:0014 p:0030 s:0055 b:0055 l:000998 d:000998 METHOD /Users/yannick/.rvm/gems/ruby-1.9.2-p290/gems/yard-0.7.3/lib/yard/rubygems/doc_manager.rb:5
@zapatoche
zapatoche / gist:1226775
Created September 19, 2011 15:37
load markdown with YAML
//in data/test.yml
copy: >
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
body: >
:markdown
But can include **Markdown** using the appropriate Haml filter.
//in the HAML, template
@zapatoche
zapatoche / gist:1226774
Created September 19, 2011 15:37
load markdown with YAML
//in data/test.yml
copy: >
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
body: >
:markdown
But can include **Markdown** using the appropriate Haml filter.
//in the HAML, template
WARN: serve autoloading 'slim' in a non thread-safe way; explicit require 'slim' suggested.
- require 'yaml'
- blah = YAML.load_file('data/test.yml')
$totalCols: 7
$fullWidth: $totalCols
$unitWidth: 118px
$gutterWidth: 20px
//$totalWidth: ($unitWidth * $totalCols) + (($unitWidth * $gutterRatio) * ($totalCols - 1))
$totalWidth: $fullWidth * $unitWidth
//$gutterRatio: ($gutterWidth * 100) / $totalWidth
//function calculate width grid cell
@function getBaseWidth($n)
$baseWidth: $unitWidth * $n
@zapatoche
zapatoche / tabledisplaytest.html
Created August 26, 2011 13:58 — forked from adactio/tabledisplaytest.html
Content-first table-display test
<!DOCTYPE html>
<html>
<head>
<title>Table Display test</title>
<style>
@media screen and (min-width: 30em) {
body {
display: table;
caption-side: top;
}
@zapatoche
zapatoche / gist:1161079
Created August 21, 2011 20:02
middleman report
/Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/em/connection.rb:39:in `new': undefined method `associate_callback_target' for #<Thin::Connection:0x107607838> (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/em/connection.rb:36:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/em/connection.rb:36:in `new'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:1430:in `event_callback'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/pr_eventmachine.rb:815:in `eventable_read'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/pr_eventmachine.rb:812:in `times'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/pr_eventmachine.rb:812:in `eventable_read'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/pr_eventmachine.rb:369:in `crank_selectables'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/pr_eventmachine.rb:369:in `each'
from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/pr_ev