set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
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
#!/usr/bin/env python | |
""" | |
Your task is as follows: | |
- read the provided Excel file | |
- find and return the min, max and average values for the COAST region | |
- find and return the time value for the min and max entries | |
- the time values should be returned as Python tuples | |
Please see the test function for the expected return format | |
""" |
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 countUser = function (callback) { | |
database.getCollection('User').find(function (err, nbUsers) { | |
if (err) return callback(err); | |
return callback(null, nbUsers.length); | |
}); | |
}; | |
var countRestaurantByCity = function(city, callback) { | |
database.getCollection('Restaurant').count({'adresse.ville': city}, function (err, nbR) { | |
if (err) return callback(err); | |
return callback(null, nbR); |
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
docker ps -a | awk '{print $1}' | xargs --no-run-if-empty docker rm |
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 database = require('../../../models'); | |
var async = require('async'); | |
var VisitorApi = (function() { | |
/** | |
* Public Functions | |
*/ | |
var _countVisitorsByOperator = function(operator,value,callback) { | |
var query = {}; | |
query[operator] = value; |
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
app.factory('authInterceptor', function ($cookies) { | |
return { | |
// Add authorization token to headers | |
request: function (config) { | |
config.headers = config.headers || {}; | |
config.headers.post['x-csrf-token'] =$cookies['XSRF-TOKEN']; | |
return config; | |
} | |
}; | |
}); |
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
//Enable Express csrf protection | |
app.use(express.csrf()); | |
app.use(function(req, res, next) { | |
res.locals.csrftoken = req.csrfToken(); | |
next(); | |
}); |
db.users.update({}, {$rename: {'username': 'email', 'password': 'hashedPassword'}, false, true});
Before : [{username: "[email protected]", password: "pwd"}]
after : [{email: "[email protected]", hashedPassword: "pwd"}]
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
sudo npm cache clean -f | |
sudo npm install -g n | |
sudo n stable | |
sudo n 0.12.7 |
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
module.exports = exports = function mongoosePluginRestaurant (schema, options) { | |
schema.pre('save', function (next) { | |
if (this.isModified('description')) { | |
this.descriptionUpdated = new Date; | |
} | |
if(this.isModified()) | |
this.updated = new Date; | |
next() | |
}); | |
}; |