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
# Be sure to replace the three <> parts | |
# New ubuntu machines annoying locale warnings | |
#sudo locale-gen en_US en_US.UTF-8 | |
#sudo dpkg-reconfigure locales | |
sudo apt update -y && sudo apt upgrade -y && sudo apt autoremove -y | |
sudo apt-get install nginx -y | |
sudo systemctl status nginx | |
sudo systemctl start nginx |
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
const waterfall = require('async-waterfall'); | |
waterfall([ | |
function(callback){ | |
callback(null, 'one', 'two'); | |
}, | |
function(arg1, arg2, callback){ | |
callback(null, 'three'); | |
}, | |
function(arg1, callback){ |
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 one() { | |
setTimeout(function() { | |
console.log('1. First thing setting up second thing'); | |
setTimeout(function() { | |
console.log('2. Second thing setting up third thing'); | |
setTimeout(function() { | |
console.log('3. Third thing setting up fourth thing'); | |
setTimeout(function() { | |
console.log('4. Fourth thing'); | |
}, 2000); |
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
fs.readFile('/foo.txt', function(err, data) { | |
// TODO: Error Handling Still Needed! | |
console.log(data); | |
}); |
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
const q = require('q'); | |
function doSomething(data) { | |
data.one = 1; | |
return q(data); | |
} | |
function somethingElse(data) { | |
const deferred = q.defer(); | |
setTimeout(function() { |
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
typeof async function(){} | |
/// 'function' |
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
async function waitAndPrint(toPrint) { | |
await new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log(toPrint); | |
resolve(); | |
}, Math.random() * 1000); | |
}); | |
} | |
const arrayOfNumbers = [1, 2, 3, 4]; |
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
const co = require('co'); | |
const request = require('request'); | |
const bluebird = require('bluebird'); | |
const requestPromisified = bluebird.promisifyAll(request); // This just adds Async to everything | |
function* goToThere(url) { | |
console.log('Just started'); | |
const someData = yield const requestPromisified.getAsync(url) | |
console.log('Yes, I DO have data ' + someData); | |
return someData; |
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
async function waitAndPrint(toPrint) { | |
await new Promise((resolve, reject) => { | |
setTimeout(() => { | |
console.log(toPrint); | |
resolve(); | |
}, Math.random() * 1000); | |
}); | |
} | |
const arrayOfNumbers = [1, 2, 3, 4]; |