This file contains hidden or 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 Publisher | |
extend self | |
def broadcast_event(event_name, payload={}) | |
if block_given? | |
ActiveSupport::Notifications.instrument(event_name, payload) do | |
yield | |
end | |
else | |
ActiveSupport::Notifications.instrument(event_name, payload) |
This file contains hidden or 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 Address | |
include Mongoid::Document | |
field :line1, type: String | |
field :line2, type: String | |
field :city, type: String | |
embedded_in :addressable, polymorphic: true | |
end | |
class Person |
This file contains hidden or 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 Activity | |
# include Mongoid::Document | |
# | |
# field :trackable, type: ShallowDocument | |
# end | |
## | |
class ShallowDocument | |
include Mongoid::Fields::Serializable |
This file contains hidden or 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
curl -X DELETE "http://localhost:9200/test_users" | |
curl -X POST "http://localhost:9200/test_users" -d ' | |
{ | |
"mappings":{ | |
"user":{ | |
"properties":{ | |
"email":{ "index":"no", "type":"string" }, | |
"alma_info":{ | |
"type":"object", |
This file contains hidden or 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":{ | |
"properties":{ | |
"profile_completeness":{ "type":"double" }, | |
"created_at":{ "format":"dateOptionalTime", "type":"date" }, | |
"user_type":{ "type":"string" }, | |
"professions":{ | |
"type":"nested", | |
"properties":{ | |
"to":{ "format":"dateOptionalTime", "type":"date" }, |
This file contains hidden or 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
pry(main)> UserFilter.new(:college => College.first, :user_type => User::ALUMNI).tire_name_facets('virgil') | |
=> {"name"=>{"_type"=>"terms", "missing"=>0, "total"=>0, "other"=>0, "terms"=>[]}} |
This file contains hidden or 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
Tables: | |
Users(:id, :username, etc.) | |
Questions(:id, :text) | |
Answers(:id, :question_id, :text) | |
UserAnswers(:id, :user_id, :question_id, :answer_id, :importance) | |
AcceptedAnswers(:id, :user_answer_id, :answer_id) | |
Relations | |
Questions <-> Answers: one-to-many | |
Questions <-> UserAnswers: one-to-many |
This file contains hidden or 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
rubish@elastic1:~$ free -m | |
total used free shared buffers cached | |
Mem: 496 476 19 0 6 71 | |
-/+ buffers/cache: 397 98 | |
Swap: 1023 677 346 |
This file contains hidden or 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
excon (0.6.2) lib/excon/connection.rb:262:in `initialize' | |
excon (0.6.2) lib/excon/connection.rb:262:in `open' | |
excon (0.6.2) lib/excon/connection.rb:262:in `open_socket' | |
excon (0.6.2) lib/excon/connection.rb:203:in `connect' | |
excon (0.6.2) lib/excon/connection.rb:268:in `socket' | |
excon (0.6.2) lib/excon/connection.rb:148:in `request' | |
fog (0.7.2) lib/fog/core/connection.rb:20:in `request' | |
fog (0.7.2) lib/fog/providers/rackspace.rb:17:in `authenticate' | |
fog (0.7.2) lib/fog/storage/rackspace.rb:86:in `initialize' | |
fog (0.7.2) lib/fog/core/service.rb:58:in `new' |
NewerOlder