Skip to content

Instantly share code, notes, and snippets.

View xolubi's full-sized avatar

Ezra Olubi xolubi

View GitHub Profile
files:
"/tmp/nginx.conf":
content: |
# Elastic Beanstalk Managed
# Elastic Beanstalk managed configuration file
# Some configuration of nginx can be by placing files in /etc/nginx/conf.d
# using Configuration Files.
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/customize-containers.html
@xolubi
xolubi / swap.js
Last active August 29, 2015 14:27
/*
12590 = 10592 (sort array. ignore 0. 1 is next smallest and already in front. pay attention to 0. swap with number after 1 )
21045 = 12045 (sort array. ignore 0. 1 is next smallest but not in front. swap with number in front)
21450 = 12450 (sort array. ignore 0. 1 is next smallest but not in front. swap with number in front)
10390 = 10039 (sort array. ignore 0. 1 is next smallest and already in front. pay attention to 0. we have a 0 after 1 already. move to next 0, swap with third number)
20305 = 20035 (sort array. ignore 0. 2 is next smallest and already in front. pay attention to 0. we have a 0 after 2 already. move to next 0, swap with third number)
21352 = 12352 (sort array. no zero. 1 is smallest but not in front. swap with number in front)
16289 = 12689 (sort array. no zero. 1 is smallest and already in front. move to next)
*/
@xolubi
xolubi / stripuniques
Last active August 29, 2015 14:11
Strip uniques before update (SAILS)
stripUniques: function(id, data, cb){
this.findOne({id: id}).exec(function findCB(err, result){
if (err) {
//bubble error back to callback
return cb(err);
} else if (!result) {
//id passed is invalid. return empty object and deal with this in callback
return cb(null, {});
} else {
if (data) {