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
{ "_id" : { "$oid" : "57037ae071df3738ecf2b4d7" }, "companyId" : 102, "active" : true, "name" : "Owen Convey", "age" : 29, "location" : "Barcelona", "createdAt" : { "$date" : 1457009690129 }, "updatedAt" : { "$date" : 1457014037417 } } | |
{ "_id" : { "$oid" : "57037b4571df3738ecf2b4d8" }, "companyId" : 102, "active" : true, "name" : "John Doe", "age" : 43, "location" : "London", "createdAt" : { "$date" : 1451825690129 }, "updatedAt" : { "$date" : 1454497637417 } } | |
{ "_id" : { "$oid" : "57037b9371df3738ecf2b4d9" }, "companyId" : 102, "active" : false, "name" : "Lionel Messi", "age" : 28, "location" : "Barcelona", "createdAt" : { "$date" : 1404412461129 }, "updatedAt" : { "$date" : 1404385637417 } } | |
{ "_id" : { "$oid" : "57037bc671df3738ecf2b4da" }, "companyId" : 68, "active" : true, "name" : "Cristiano Ronaldo", "age" : 31, "location" : "Madrid", "createdAt" : { "$date" : 1435948461129 }, "updatedAt" : { "$date" : 1435921637417 } } | |
{ "_id" : { "$oid" : "570cb47724845339111ace28" }, "companyId" : 68, "active" : tr |
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
body { | |
background: red !important; | |
} |
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 'couchbase' | |
require 'elasticsearch' | |
require 'hashie' | |
couchbase = Couchbase.connect(:bucket => "users", :hostname => "localhost") | |
client = Elasticsearch::Client.new log: true | |
response = client.search index: 'users', | |
body: { | |
query: { |
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
{ | |
"id": "-2qc0BRRUzfFcE9tSXI0Tw", | |
"doc_type": "user", | |
"join_date": "2014-04-12 21:18:07 UTC", | |
"last_active": "2014-04-13 03:09:15 UTC", | |
"number_of_visits": 4953, | |
"origin": "FR", | |
"offers": [ | |
"343-645-121", | |
"888-756-343" |
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 'json' | |
require 'securerandom' | |
require 'couchbase' | |
couchbase = Couchbase.connect(:bucket => "users", :hostname => "localhost") | |
def generate_offers | |
offers = ['324-567-343', '888-756-343', '343-645-121', '691-809-507', '192-343-572', '298-897-673'] | |
number_of_offers = rand(1..3) | |
selected_offers = [] |
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
sudo ufw allow proto tcp from YOUR_IP to any port 8092 |
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
function (doc, meta) { | |
if(meta.type == 'json') { | |
if(doc.doc_type == "offers_collected" && doc.date) { | |
emit(dateToArray(doc.date)); | |
} | |
} | |
} |
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
{ | |
"date": "2014-02-23 17:46:47 UTC", | |
"doc_type": "offers_collected", | |
"[192-343-572]": 165, | |
"[298-897-673]": 171, | |
"[324-567-343]": 184, | |
"[343-645-121]": 160, | |
"[691-809-507]": 148, | |
"[888-756-343]": 172 | |
} |
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 'json' | |
require 'couchbase' | |
@couchbase = Couchbase.connect(:bucket => "users",:hostname => "localhost") | |
def retreive_offer_data | |
design_doc = @couchbase.design_docs["users"] | |
offers_collected = {} | |
offers_collected['date'] = Time.now.utc.to_s |
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
function (doc, meta) { | |
if(meta.type == "json") { | |
if(doc.doc_type == "user") { | |
if(doc.offers) { | |
emit(doc.offers); | |
} | |
} | |
} | |
} |
NewerOlder