Skip to content

Instantly share code, notes, and snippets.

View mrm8488's full-sized avatar
🏠
Working from home

Manuel Romero mrm8488

🏠
Working from home
View GitHub Profile
@mrm8488
mrm8488 / highfive.js
Last active August 27, 2015 11:13 — forked from kmoe/highfive.js
module['exports'] = function highFive(hook) {
// hook.io has a range of node modules available - see
// https://hook.io/modules.
// We use request (https://www.npmjs.com/package/request) for an easy way to
// make the HTTP request.
var request = require('request');
// The parameters passed in via the slash command POST request.
var params = hook.params;
module['exports'] = function registerIO(hook) {
// hook.io has a range of node modules available - see
// https://hook.io/modules.
// We use request (https://www.npmjs.com/package/request) for an easy way to
// make the HTTP request.
var request = require('request');
var mongoose = require('mongoose');
mongoose.connect('mongodb://moelia:basel2015@ds035663.mongolab.com:35663/employees_activity');
var mongoose = require('mongoose');
var schema = new mongoose.Schema({
name: {
type: String,
required: true,
index: {unique: true}
},
banned: {
var User = require('route/to/models/User.js');
// Find a user by his ID
User.findById(<here_the_id>, function (error, user) {
if (error) throw error;
console.log(user);
});
var User = require('route/to/models/User.js');
// Find a user by his ID
User.findById(<id>, function(error, user) {
if (error) throw error;
user.banned = true;
// Save the changes
user.save(function(error) {
var User = require('route/to/models/User.js');
// Find a user by his ID
User.findById(<id>, function(error, user) {
User.getFriends(user.id, function(error2, friends) {
User.getJobs(user.id, function(error3, jobs) {
...
var mongoose = require('mongoose');
var schema = new mongoose.Schema({
name: {
type: String,
required: true,
index: {unique: true}
},
banned: {
var User = require('route/to/models/User.js');
User.findUserById(<id>).then(function(user) {
user.banned = true;
return User.saveUser(user);
}).then(function() {
return User.removeUserByName('manuel');
Promise.all([User.findAllUsers(), User.findUserById(<id>)]).then(function(results) {
// results[0] contains the result of the first promise
// results[1] contains the result of the second promise
});
Promise.all([User.findAllUsers(), User.findUserById(<id>)]).then(function(results) {
// results[0] contains the result of the first promise
// results[1] contains the result of the second promise
});