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
class Animal { | |
constructor(name, legs) { | |
this.name = name; | |
this.legs = legs; | |
} | |
} | |
class Dog extends Animal { | |
constructor(name) { | |
super(name, 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
class Animal { | |
constructor(name, legs) { | |
this.name = name; | |
this.legs = legs; | |
} | |
} | |
class Dog extends Animal { | |
constructor(name) { | |
super(name, 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 hasLegsMaker = num => ({ legs: num }); | |
const noiseMaker = noise => { | |
return { makeNoise: () => { console.log(`All day I just ${noise}`) } }; | |
}; | |
var fido = Object.assign({}, hasLegsMaker(4), noiseMaker('woof!')); | |
fido.makeNoise(); //All day I just woof! |
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 express = require('express'); | |
var app = express(); | |
var path = require('path'); | |
app.use(express.static(path.join(__dirname))); | |
app.use("/styles", express.static(__dirname)); | |
app.use("/images", express.static(__dirname + '/images')); | |
app.use("/scripts", express.static(__dirname + '/scripts')); | |
// viewed at based directory http://localhost:8080/ |
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 express = require('express'); | |
var app = express(); | |
var path = require('path'); | |
// make express look in the public directory for assets (css/js/img) | |
app.use(express.static(path.join(__dirname))); | |
app.use("/styles", express.static(__dirname + '/css')); | |
app.use("/scripts", express.static(__dirname + '/scripts')); | |
app.use("/images", express.static(__dirname + '/img')); | |
app.use("/components", express.static(__dirname + '/bower_components')); |
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 http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
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
"use strict" | |
var LimitedArray = function (limit) { | |
var storage = []; | |
var limitedArray = {}; | |
limitedArray.get = function (index) { | |
checkLimit(index); | |
return storage[index]; | |
}; |
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
"use strict" | |
var LimitedArray = function (limit) { | |
var storage = []; | |
var limitedArray = {}; | |
limitedArray.get = function (index) { | |
checkLimit(index); | |
return storage[index]; | |
}; |
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 Bee = function () { | |
Grub.call(this); | |
this.age = 5; | |
this.color = 'yellow'; | |
this.job = 'keep on growing'; | |
}; | |
Bee.prototype = Object.create(Grub.prototype); | |
Bee.prototype.constructor = Bee; |
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 puke(object) { | |
return <pre>{JSON.stringify(object, null, ' ')}</pre>; | |
} |