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
(minuteOfDay >= 1260 && minuteOfDay <= 1439 && contains([3,4,5], dayOfWeek)) || | |
(minuteOfDay >= 0 && minuteOfDay <= 240 && contains([4,5,6], dayOfWeek)) && | |
(distance(originLatitude, originLongitude, 52.924345, -1.216398) <= 400) |
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
{ | |
"components": [ | |
{ | |
"type": "geo", | |
"origins": [ | |
{ | |
"type": "originDistance", | |
"latitude": 52.924345, | |
"longitude": -1.216398, | |
"distance": 400 |
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 evaluateRule = require('./uber-rule-evaluator'); | |
var isInteger = "floor(x) === x"; | |
var floatFact = { | |
x: 10.5, | |
floor: Math.floor | |
}; | |
var intFact = { | |
x: 10, |
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 evaluateRule = require('./uber-rule-evaluator'); | |
var rule = "x > y + z"; | |
var facts = { | |
x: 30, | |
y: 15, | |
z: 10 | |
}; | |
console.log(evaluateRule(rule, facts)); | |
// true |
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 esprima = require('esprima'); | |
var evaluate = require('static-eval'); | |
module.exports = function evaluateRule(rule, fact) { | |
var ruleAST = esprima.parse(rule); | |
return evaluate(ruleAST.body[0].expression, fact); | |
} |
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
module.exports = function handleOrForward(ringpop, key, req, res, arg2, arg3, handle) { | |
var dest = ringpop.lookup(key); | |
if (dest === ringpop.whoami()) { | |
// Handle request on local node | |
handle(ringpop, key, res, arg2, arg3); | |
return; | |
} | |
// Forward request | |
var channel = ringpop.channel; |
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
service StatementClient { | |
// Service: "I'm making weekly statements for last week. Do any of your users want any?" | |
// Client: "Yes, I want statements for users uuid1, uuid2, …" | |
getStatementCandidates(request); | |
// Service: "Okay, what does user uuid1 need in its statement for last week?" | |
// Client: "All this information …" | |
getStatementCandidateDetails(request); |
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
# We instantiate a client for talking with the Schemaless instance. | |
schemaless_client = SchemalessClient(datastore='mezzanine') | |
# We register the bill_rider function for the BASE column. | |
@trigger(column='BASE') | |
def bill_rider(row_key): | |
# row_key is the UUID of the trip | |
status = schemaless_client.get_cell_latest(row_key, '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
table: driver_partner_index # Name of the index. | |
datastore: trips # Name of the associated datastore | |
column_defs: | |
– column_key: BASE # From which column to fetch from. | |
fields: # The fields in the cell to denormalize |
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
struct Animal { | |
1: i32 id | |
2: string name | |
3: string sound | |
} | |
exception NotFoundException { | |
1: i32 what | |
2: string why | |
} |
NewerOlder