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 'rubygems' | |
require 'mongoid' | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db("mongoid_key_test") | |
end | |
Mongoid.master.collection("users").drop | |
class User |
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
def new | |
client = Client.create!(:name => 'border', :description => 'lala') | |
content = Content.new(:key => 'help_about', :value => 'hello there') | |
content.client = client | |
end | |
class Client | |
include Mongoid::Document | |
field :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
class User < ActiveRecord::Base | |
end | |
class Post | |
include Mongoid::Document | |
references_many :comments | |
end | |
class Comment |
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
jquery.hover (arg) -> | |
... | |
, (arg) -> | |
... |
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
#!/usr/bin/env sh | |
source "$HOME/.rvm/scripts/rvm" | |
rvm default | |
__rvm_load_rvmrc | |
cd . | |
export BUNDLE_PATH=$GEM_HOME | |
exec ruby "$@" |
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
file 'Gemfile', <<-GEMS | |
source 'http://gemcutter.org' | |
gem "rails", "3.0.0.rc1" | |
gem "bson_ext" | |
gem "mongoid", "2.0.0.beta.12" | |
gem "haml", ">= 3.0" | |
gem "compass", "0.10.0.rc4" | |
group :test do | |
gem "rspec-rails", ">= 2.0.0.beta.12" |
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
#!/usr/bin/env ruby | |
require 'bundler' | |
Bundler.require | |
Mongoid.configure do |config| | |
config.master = Mongo::Connection.new.db('foo') | |
end | |
class Author | |
include Mongoid::Document | |
references_many :books,:inverse_of => :author |
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
$.fn.extend | |
myplugin: (options) -> | |
self = $.fn.myplugin | |
opts = $.extend {}, self.default_options, options | |
$(this).each (i, el) -> | |
self.init el, opts | |
self.log el if opts.log | |
$.extend $.fn.myplugin, | |
default_options: |
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
$ = jQuery | |
$.fn.extend | |
myplugin: (options) -> | |
self = $.fn.myplugin | |
opts = $.extend {}, self.default_options, options | |
$(this).each (i, el) -> | |
self.init el, opts | |
self.log el if opts.log | |
$.extend $.fn.myplugin, |
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
module Sinatra | |
module AmbiguousRoutes | |
module RouteWithAmbiguousPath | |
def route(verb, path, options={}, &block) | |
# don't modify routes that already defined with a format extension | |
case path | |
when Regexp | |
else | |
if path =~ /\..*$/ |
OlderNewer