- Inheritence in general
- Prototypal vs clasical inheritence
- Constructors in javascript vs literals
- Primitive types and what it means to 'extend' their prototypes
- Creating constructors
- Initializing contstructors with the
new
keyword and what the value ofthis
is - Extending classes with
Object.create
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 compute() { | |
return distance(points()); | |
} | |
function distance(points) { | |
var deltaY = points[3] - points[1]; | |
var deltaX = points[2] - points[0]; | |
return Math.sqrt(Math.pow(deltaY, 2) + Math.pow(deltaX, 2)); | |
} |
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
// contrived example | |
$box-height: 30px; | |
$box-width: 30px; | |
// optional args | |
@mixin box-me-bro ($width: $box-width, $height: $box-height) { |
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 err = { | |
message: 'You are a human, here is the error', | |
exception: new Error('this is for the system') | |
}; |
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 a = Object.create(null); | |
a.toString = function() { | |
return 4; | |
}; | |
a == 4; | |
// truthy! | |
typeof a == typeof 4; |
Amazon S3 now supports versioning on objects. This means you can send new versions of objects to S3 and they persist older verions. The version numbers are arbitraty strings, so semantic versioning would work just fine. Potentially you could have a client application that allows you to store private npm packages on s3. If the package 404s, then you can fallback to the main npm registry. This is effectively a quick and dirty private npm.
My question is, what am I missing? Is there more to npm that versioned s3 objects can provide?
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
find ./views -type f -name \*.jade | while IFS="" read i; do expand -t2 "$i" > "$i-"; mv "$i-" "$i"; done |
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
/** | |
* Self constructing constructor? | |
*/ | |
function Dog (props) { | |
if (!(this instanceof Dog)) return new Dog(props); | |
this.props = props || {}; | |
}; | |
Dog.prototype.bark = 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
'use strict'; | |
var key = 'your client key'; | |
var secret = 'your secret key'; | |
var fs = require('node-foursquare-venues')(key, secret); | |
function getHours(venue, callback) { | |
fs.venues.venue(venue, function(err, data){ | |
if (err) return callback(err, null); |
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'; | |
/** | |
* Typical constructor | |
*/ | |
function Human (props) { | |
this.props = props || {}; | |
}; |
NewerOlder