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
var h = require("virtual-dom/h"), | |
createElement = require("virtual-dom/create-element"); | |
var shards = [{ | |
"num_keys": "224123", | |
"replicas": [ | |
{ | |
"configured_primary": false, | |
"currently_primary": true, | |
"id": "8a25d0c4-9d04-4596-8101-7574be54ba67", |
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
var config = { | |
host: 'localhost', | |
port: 31157, | |
db: 'reqlitetest', | |
authKey: '' | |
}; | |
var r = require('./js'); | |
var assert = require('assert'); |
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
var r = require('rethinkdb'), | |
connection; | |
r.connect( {host: 'localhost', port: 28015} ) | |
.then(function(conn) { | |
console.log('connected to RethinkDB'); | |
connection = conn; | |
return r.dbList().run(conn); | |
}).then(function(dbs){ | |
console.log('dbs: ' + dbs); |
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
[{"gamesPlayed":15,"login":"Grelp","score":14},{"gamesPlayed":13,"login":"KittyBot","score":67},{"gamesPlayed":1,"login":"neumino","score":98},{"gamesPlayed":15,"login":"JoeyZwicker","score":147},{"gamesPlayed":9,"login":"VeXocide","score":120},{"gamesPlayed":19,"login":"deontologician","score":125},{"gamesPlayed":16,"login":"gchpaco","score":141},{"gamesPlayed":19,"login":"danielmewes","score":104},{"gamesPlayed":3,"login":"AtnNn","score":129},{"gamesPlayed":1,"login":"mglukhovsky","score":38},{"gamesPlayed":14,"login":"timmaxw","score":43},{"gamesPlayed":16,"login":"coffeemug","score":129},{"gamesPlayed":11,"login":"mlucy","score":140},{"gamesPlayed":9,"login":"segphault","score":91},{"gamesPlayed":15,"login":"ahruygt","score":109},{"gamesPlayed":7,"login":"jessskuo","score":198},{"gamesPlayed":17,"login":"Thinker-Bot","score":5},{"gamesPlayed":3,"login":"Tryneus","score":148},{"gamesPlayed":13,"login":"chipotle","score":189},{"gamesPlayed":12,"login":"larkost","score":7},{"gamesPlayed":6,"login":"thejsj"," |
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
// hello world | |
var event = require('value-event/event'); | |
var Event = require('geval'); | |
var changeEvent = require('value-event/change'); | |
var insertCSS = require('insert-css'); | |
var ObservStruct = require('observ-struct'); | |
var Observ = require('observ'); | |
var EventEmitter = require("event-emitter").EventEmitter; | |
var mainLoop = require('main-loop'); |
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 history_query(table): | |
return table.filter( | |
lambda this_user: this_user.has_fields({'meta': {'title': True}}) | |
).filter( | |
lambda this_user: this_user.has_fields({'meta': {'updated_at': True}}) | |
).filter( | |
r.row['meta']['updated_at'].during(r.now() - int(past), r.now() + 3600) | |
).order_by( | |
r.desc(r.row['meta']['updated_at']) | |
).coerce_to('array') |
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 KamilionORM(object): | |
required_fields = [] | |
db = None | |
table = None | |
@classmethod | |
def create(cls, message, **properties): | |
""" | |
Create a new KamilionORM object. |
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
r.db('Playlists').table('Main').merge(function(playlist){ | |
return {'songs': playlist('song_ids').map(function(song_id){ | |
return r.db('Playlists').table('songs').get(song_id); | |
}).coerceTo('array') | |
} | |
}); |
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
macro ? { | |
case infix { | |
$test:expr | _ $succeed:expr : $fail:expr | |
} => { | |
return #{r.branch($test, $succeed, $fail)} | |
} | |
} | |
operator (-) 12 left | |
{ $a, $b } => #{ r.expr($a).sub($b) } |
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
var username = 'username'; | |
r.db('x').table('users').getAll('username', {index: 'username'}).merge(function(user){ | |
return {posts: r.table('posts').getAll('username', {index: 'username'}).coerceTo('ARRAY')}; | |
}) |