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
unless Function::bind? | |
Function::bind = (scope, args...) -> | |
target = this | |
if typeof target isnt "function" then throw new TypeError | |
bound = -> | |
unless this intanceof bound | |
return target.apply scope, [args..., arguments...] | |
F = -> | |
F.prototype = target.prototype | |
self = new F |
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
commit 30b81beab62b14fb9bc81240cb9e91a57d9baf5e | |
Author: Michael Ficarra <[email protected]> | |
Date: Mon Aug 9 17:12:28 2010 -0400 | |
don't require the *protect* instance method when we can use | |
Function.protect instead | |
diff --git a/Source/Core/Core.js b/Source/Core/Core.js | |
index 9eb9f68..30e0b92 100644 | |
--- a/Source/Core/Core.js |
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.TRACE_ALL = Function.TRACE_NONE = 0 | |
constants = [ | |
'TRACE_ARGUMENTS' | |
'TRACE_CONTEXT' | |
'TRACE_RETURN' | |
'TRACE_TIME' | |
'TRACE_STACK' | |
] | |
for constant, n in constants | |
# calculate powers of two to assign to the constants. this allows |
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
__extends = function(parent, child) { | |
var ctor = function(){}; | |
ctor.prototype = parent.prototype; | |
child.prototype = new ctor; | |
child.prototype.constructor = child; | |
if(typeof parent.extended === 'function') parent.extended(child); | |
child.__super__ = parent.prototype; | |
return child; | |
}; |
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
if false | |
#comment | |
else if true | |
### | |
block comment | |
### | |
else |
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
arrayEq = (a, b) -> | |
if a is b | |
# 0 isnt -0 | |
a isnt 0 or 1/a is 1/b | |
else if a instanceof Array and b instanceof Array | |
return no unless a.length is b.length | |
return no for el, idx in a when not arrayEq el, b[idx] | |
yes | |
else | |
# NaN is NaN |
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
forkNode = -> | |
args = process.argv[1..] | |
nodeArgs = [] | |
while (idx = args.indexOf '--nodejs') > -1 | |
nodeArgs = nodeArgs.concat args.splice(idx,2)[1].split(/\s+/) | |
spawn process.execPath, nodeArgs.concat(args), | |
cwd: process.cwd() | |
env: process.env | |
customFds: [0, 1, 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
for x, index in [1, 2, 3] | |
func = -> | |
console.log index | |
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
for x, index in [1, 2, 3] | |
console.log index | |
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 F = function(){}; | |
F.prototype = klass.prototype; | |
var o = new F(); | |
klass.apply(o,arguments) | |
return o; |
OlderNewer