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
r.table("events").getAll(r.args([["bad_person", "buy"], ["real_person", "buy"], ["person", "buy"]]), { | |
index: "person_action" | |
}).group("person", "thing").max("created_at").ungroup().limit(10).group(r.row("group")(0)) | |
.ungroup().map(function(var_43) { | |
return r.object(var_43("group"), var_43("reduction").map(function(var_44) { | |
return { | |
thing: var_44("group").nth(1), | |
last_actioned_at: var_44("reduction")("created_at").toEpochTime() | |
} | |
})) |
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
bb.try(-> | |
rethinkdb_esm.drop_tables(r) | |
) | |
.then( -> | |
rethinkdb_esm.init_tables(r) | |
) | |
.then( -> | |
rethinkdb_esm | |
) |
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
drop_tables = (r) -> | |
promises = [] | |
r.tableList().run().then((list) -> | |
["events","actions","most_common_things","most_common_people"].forEach (t) -> | |
if(list.indexOf t is -1) | |
promises.push(r.tableDrop(t).run().error((err) -> console.log(err))) | |
bb.all(promises) | |
) | |
init_tables = (r) -> |
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
ReqlRuntimeError: Expected type DATUM but found SEQUENCE: | |
VALUE SEQUENCE in: | |
r.table("events").getAll("p1", { | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
index: "person" | |
^^^^^^^^^^^^^^^ | |
}).filter(function(var_416) { | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
return r.expr(["view"]).contains(var_416("action")) | |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
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
DELETE FROM events e1 | |
USING events e2 | |
WHERE e1.person = $1 AND e1.expires_at is NULL AND e1.id <> e2.id AND e1.person = e2.person | |
AND e1.action = e2.action AND e1.thing = e2.thing AND | |
(e1.created_at < e2.created_at OR (e1.created_at = e2.created_at AND e1.id < e2.id) ) |
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
function retry(isDone, next) { | |
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false; | |
var id = window.setInterval( | |
function() { | |
if (isDone()) { | |
window.clearInterval(id); | |
next(is_timeout); | |
} | |
if (current_trial++ > max_retry) { | |
window.clearInterval(id); |
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
disabled = false | |
selector = sep2014 | |
domain = mail.aidax.com.br | |
headers_to_sign = From, Sender, Reply-To, Subject, Date, Message-ID, To, Cc, MIME-Version |
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
Possibly unhandled TypeError: Cannot read property 'profile' of undefined | |
at /app/delivered/2014-09-21_06-02-46_3b1c3d_master/node_modules/rethinkdbdash/lib/connection.js:278:44 | |
at tryCatch1 (/app/delivered/2014-09-21_06-02-46_3b1c3d_master/node_modules/rethinkdbdash/node_modules/bluebird/js/main/util.js:43:21) | |
at Promise$_callHandler [as _callHandler] (/app/delivered/2014-09-21_06-02-46_3b1c3d_master/node_modules/rethinkdbdash/node_modules/bluebird/js/main/promise.js:649:13) | |
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/app/delivered/2014-09-21_06-02-46_3b1c3d_master/node_modules/rethinkdbdash/node_modules/bluebird/js/main/promise.js:663:18) | |
at Promise$_settlePromiseAt [as _settlePromiseAt] (/app/delivered/2014-09-21_06-02-46_3b1c3d_master/node_modules/rethinkdbdash/node_modules/bluebird/js/main/promise.js:826:14) | |
at Promise$_settlePromises [as _settlePromises] (/app/delivered/2014-09-21_06-02-46_3b1c3d_master/node_modules/rethinkdbdash/node_modules/bluebird/js |
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
var field = ["properties","type"], | |
value = "event"; | |
// ... some query | |
.filter(function(row) { | |
var _row; | |
if(Array.isArray(field)) { | |
for(i = 0; i < field.length; i++) { | |
_row = row(field[i]); | |
} |
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
var r = require('rethinkdbdash')(); | |
setInterval(function() { | |
r.table("logs").insert({ | |
date: r.now() | |
}).run({noreply: true}) | |
, 1000) | |
r.table("logs").changes().run().then(function(feed) { |