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
// NO! NO! NO! DON'T EVER DO THIS EVER EVER AGAIN | |
// Now, remove everything except the zip we just made | |
exec("rm -rf `ls | grep -v 'p.zip$'`; rm -rf .git", { | |
cwd: repoPath | |
}, function(error, stdout, stdett){ | |
// Don't care... | |
}); |
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
function _checkForBSONId(queryObject){ | |
if (queryObject.hasOwnProperty('_id')){ | |
// If we're keying on an autogenned one, MongoDB expects an objectId to look like: ObjectId( "505cfee6d94d451252000001" ) not just "" | |
if (queryObject._id.length === 24){ | |
var BSON = require('mongodb').BSONPure; | |
queryObject._id = BSON.ObjectID.createFromHexString(queryObject._id); | |
} | |
} | |
return queryObject; | |
} |
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 util = require('util'); | |
var request = require('request'); | |
exports.getCurrentTime = function(params, callback) { | |
request({uri : 'http://www.timeanddate.com/worldclock/city.html?n=78'}, function(err, response, body){ | |
return callback(null, { | |
'response' : body | |
}); | |
}); | |
} |
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
function(e, r){ | |
var a = r.data.Forms; | |
for (var i=0; i< a.length; i++){ | |
var b = a[i]; | |
console.log(b.Hash); | |
} | |
} |
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
currentLocation = 'waterford'; | |
function whereAreYa(){ | |
console.log('1: ' + currentLocation); | |
var currentLocation = 'Dublin'; | |
console.log('2: ' +currentLocation); | |
} | |
whereAreYa(); | |
console.log('3: ' + currentLocation); |
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 counter = function(count){ | |
console.log("Count is " + count); | |
return { | |
getNext: function(){ | |
return ++count; | |
} | |
}; | |
} | |
myCounter = counter(0); |
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
function Car(){ | |
this.wheels = 4; | |
} | |
var redCar = new Car(); | |
console.log('1: ' + typeof redCar); | |
console.log('2: ' + redCar.wheels); | |
var otherCar = Car(); | |
console.log('3: ' + typeof otherCar); |
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
function Person(){ | |
} | |
var jos = new Person(); | |
var molly = new Person(); | |
Person.prototype.age = "28"; | |
Person.prototype.printAge = function(){ | |
console.log('Age is: ', this.age); |
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 autoMobile = function(config) { | |
var that = {}; | |
that.getName = function() { | |
return config.name; | |
}; | |
that.getNumberOfWheels = function() { | |
return config.wheels; | |
}; | |
return that; | |
} |
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 name = 'Jose'; | |
var myObject = { | |
name : "Molly", | |
getName: function() { | |
return this.name; | |
}, | |
getWrongName: function() { | |
return name; | |
} | |
}; |