Build an API for grocery list mobile app.
POST /groceries
{
title: "Milk",
category: "Milk based products",
amount: 1
function convertApolloToV3Interaction( | |
apolloInteraction: ApolloGraphQLInteraction, | |
states?: V3ProviderState[], | |
): V3Interaction { | |
const interaction = apolloInteraction.json(); | |
return { | |
states, | |
uponReceiving: interaction.description, | |
withRequest: { | |
method: interaction.request.method, |
function getTodos(listId, callback) { | |
helpers.makeHttpCall({ | |
url: '/todo/' + listId + '/items', | |
success: function (data) { | |
// Node-style CPS: callback(err, data) | |
callback(null, data); | |
} | |
}); | |
} | |
// This wrapper is required for our stubbing to work |
function magic() { | |
console.log("MAGIC") | |
} |
{ "presets": ["es2015"] } |
user nginx; | |
worker_processes {{ workers }}; | |
error_log /var/log/nginx.log; | |
events | |
{ | |
worker_connections 1024; | |
accept_mutex off; | |
} |
// Functional | |
var log = function(tag,val) { console.log(tag, val); return val; } | |
var isLightBackground = function(color) { | |
// 765 - max distance | |
log("color:",color); | |
return log("result:", log("distance:", xcolor.distance(color, 'white')) < (765/2)); | |
}; |
filterMenuItems = function (menuItems, level, parentId) { | |
var childLevel = level + 1; | |
// filter out admin-only items if needed | |
if (!Users.is.admin(Meteor.user())) { | |
menuItems = _.reject(menuItems, function (item) { | |
return item.adminOnly; | |
}); | |
} |
sum: R.reduce(this.add, 0), | |
totalVotes: R.compose(this.sum, R.drop(1))(?votes?), | |
calculatePercent: R.compose(R.curry(Math.round), R.multiply(100), R.divide(R.__, this.totalVotes)), |
createLogo() { | |
R.compose(R.map(function (v) { | |
return <img src={v}/> | |
}), R.pluck('logo'), RF.Maybe); | |
}, | |
defaultLogo() { | |
return undefined; | |
}, | |
render() { |