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 "paperclip_migrations" | |
class AddPaperclipColumnsToProducts < ActiveRecord::Migration | |
include PaperclipMigrations | |
def self.up | |
add_paperclip_fields :items, :vignette | |
Product.reset_column_information | |
Product.all.each do |product| | |
attachment = Asset.find(:first, :conditions => ["assetable_type = ? and assetable_id = ? and type = ?", "Item", product.id, "Vignette"]) |
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
# mongo_template.rb | |
# remove unneeded defaults | |
run "rm public/index.html" | |
run "rm public/images/rails.png" | |
run "rm public/javascripts/controls.js" | |
run "rm public/javascripts/dragdrop.js" | |
run "rm public/javascripts/effects.js" | |
run "rm public/javascripts/prototype.js" |
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 LongPollHttpServer < EM::Connection | |
def unbind | |
end | |
def receive_data(data) | |
end | |
end | |
EM.epoll if EM.epoll? | |
EM.run do |
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 LongPollHttpServer < EM::Connection | |
def receive_data(data) | |
# some code here to extract path and params from the HTTP request | |
case path | |
when '/join' | |
when '/send' |
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 Room < EM::Channel | |
def say(nick, type, text = nil) | |
# some code here to build the string that will be sent back | |
push(str) | |
end | |
end | |
class LongPollHttpServer < EM::Connection | |
def receive_data(data) |
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 Person | |
include Mongoid::Document | |
field :name | |
field :number, Integer | |
embeds_many :phones | |
... | |
end | |
class Phone | |
include Mongoid::Document |
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 Person | |
include MongoMapper::Document | |
key :name | |
key :number, Integer | |
many :phones | |
... | |
end | |
class Phone |
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
Person | |
.where(:last_name => "Zorg") | |
.and(:middle_initial => "J") | |
.and(:age.gt => 30) | |
class Player | |
include Mongoid::Document | |
include Mongoid::Versioning | |
field :status |
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
User.where(:age.gt => 27).sort(:age).all, | |
User.where(:age.gt => 27).sort(:age.desc).all, | |
User.where(:age.gt => 27).sort(:age).limit(1).all | |
class User | |
include MongoMapper::Document | |
scope :johns, where(:name => 'John') | |
scope :bills, :name => 'Bill' | |
scope :by_name, lambda { |name| where(:name => 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
Fatal error: Out of memory (allocated 31719424) (tried to allocate 312569 bytes) in /homepages/7/d283029777/htdocs/pot/wp-includes/wp-db.php on line 478 |
OlderNewer