I hereby claim:
- I am ilpoldo on github.
- I am ilpoldo (https://keybase.io/ilpoldo) on keybase.
- I have a public key ASCI3ULXK4PMzdY_mc7EJQmansDe2kfKSujs-tEczBaArgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| require "rubygems" | |
| require "geminabox" | |
| Geminabox.data = File.expand_path('data', File.dirname(__FILE__)) | |
| run Geminabox |
| module MobileDetect | |
| class Constraint | |
| def matches?(request) | |
| return false if request.cookies[:full_site_form_mobile] || request.host.match(/^m./) | |
| request.user_agent.to_s.match(/Mobile/) | |
| end | |
| end | |
| # Rack file for local Rubygems server, using YARD | |
| require "rubygems" | |
| require "yard" | |
| libraries = {} | |
| Gem.source_index.find_name('').each do |spec| | |
| libraries[spec.name] ||= [] | |
| libraries[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem) | |
| end |
| import sys,types | |
| class MockCallable(): | |
| """ Mocks a function, can be enquired on how many calls it received """ | |
| def __init__(self, result): | |
| self.result = result | |
| self._calls = [] | |
| def __call__(self, *arguments): | |
| """Mock callable""" | |
| self._calls.append(arguments) |
| // Here is where you can define your constants for your application and to configure the blueprint framework. | |
| // Feel free to delete these if you want keep the defaults: | |
| $blueprint-grid-columns: 24; | |
| $blueprint-container-size: 950px; | |
| $blueprint-grid-margin: 10px; | |
| // Use this to calculate the width based on the total width. | |
| // Or you can set !blueprint_grid_width to a fixed value and unset !blueprint_container_size -- it will be calculated for you. | |
| $blueprint-grid-width: ($blueprint-container-size + $blueprint-grid-margin) / $blueprint-grid-columns - $blueprint-grid-margin; |
| class Sentence < ActiveRecord::Base | |
| has_many :translations | |
| accepts_nested_attributes_for :translations, :allow_destroy => true, :reject_if => proc { |obj| obj[:text].blank? } | |
| end |
| require 'spec_helper' | |
| class Instructor | |
| include Mongoid::Document | |
| embeds_many :courses | |
| references_many :cool_rides | |
| # references_many :trusted_collegues, :class_name => 'Instructor' #- raises NoMethodError 'entries' for #<Instructor:0x1062f1e10> | |
| references_and_referenced_in_many :trusted_collegues, :class_name => 'Instructor' |
| # Create an italian word and add a definition to it | |
| >> w = Word.create(:word => 'cestino', :language => :it) | |
| #<Word _id: 4d41abc38b8e6b3001000002, word: "cestino", language: :it, origin: nil, pronunciation: nil> | |
| >> w.definitions.create :kind => :noun, :text => 'un posto dove buttare le cose' | |
| #<Definition _id: 4d42a9238b8e6b5fa2000003, kind: :noun, text: "un posto dove buttare le cose"> | |
| # Add a translation (a word in another language) to the definition | |
| >> w.definitions.first.translations.create(:word => 'recycling bin', :language => :en) | |
| NoMethodError: undefined method `first' for #<Definition:0x10668c020> |
| @invalid_user = Factory.create(:user) | |
| @invalid_user.stub(:valid?).and_return(false) | |
| User.stub(:new).and_return(@invaild_user) | |
| post :create, :user_name => "some user name that won't even be used" |