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
import csv as csv | |
filename = '<FILENAME>' | |
data = [] | |
f = open(filename) | |
reader = csv.reader(f) | |
for row in reader: | |
data.append(row[5]) |
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
// server.js | |
var http = require('http') | |
http.createServer( function (req, res) { | |
res.writeHead(200, { 'Content-Type': 'application/json' }) | |
var obj = { | |
firstname: 'John', | |
lastname: 'Lee' | |
} |
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
// classes.js | |
'use strict' | |
var Person = class Person { | |
// function Person (args) {} | |
constructor (firstname, gender) { | |
this.firstname = firstname | |
this.gender = gender | |
} |
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
// emitter.js | |
// returns a Function Constructor | |
function Emitter () { | |
this.events = {} | |
} | |
// Listener is the code that responds to an event | |
// analogy: a person taking a cue from an event to execute his task | |
// @type : type of event. Ie, onClick | |
// @listener: code to be executed |
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 | |
module.exports = function greet () { | |
console.log('greet1 [module.exports]') | |
} | |
console.log(exports) | |
console.log(module.exports) |
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
// understanding the Event Loop and async nature of nodejs | |
// resource help from : https://www.codeschool.com/blog/2014/10/30/understanding-node-js/ | |
function submitOrder(orderNumber){ | |
console.log('Submitted order and cooking: ' + orderNumber) | |
cookingFood(function afterEvent(){ | |
console.log('food is cooked and ready to be delivered') | |
}) | |
} | |
// 5s operation |
NewerOlder