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 hex2rgb = function (hex) { | |
return hex.match(/(\w{2})/gi).map(function(n){return parseInt(n,16);}); | |
}; |
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
// Case 1: | |
// Bind clean way. | |
var obj = { | |
a: 'obj ', | |
fn: function (b) { | |
console.log(this.a + b); | |
}, | |
attachEvents: function () { | |
this.attachEvent('onSomething', this.fn.bind(this, 'argB')); | |
} |
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'), | |
app = express(), | |
http = require('http'), | |
httpProxy = require('http-proxy'); | |
//Express config | |
//app.set('view engine', 'ejs'); | |
//app.set('views', __dirname + '/views'); | |
app.use(express.cookieParser()); | |
app.use(express.methodOverride()); |
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
/** | |
* r-proto-class.js | |
* Ruby's semantics | |
* | |
* Features: | |
* - super calls | |
* - using Object.create for inheritance | |
* - Class.new is a wrapper over Class.allocate and Class.initialize | |
* | |
* by Dmitry Soshnikov <[email protected]> |
NewerOlder