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
pkg = {}; | |
pkg.foo = function(a, b, c) { | |
alert(a + ' ' + b + ' ' + c); | |
} | |
pkg.bar = function(a, b) { | |
alert(a + ' ' + b + ' '); | |
} |
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 Parent() { | |
this.array = [1, 2, 3]; | |
} | |
function Child() { | |
} | |
Child.prototype = new Parent; |
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 ForwardingList = (function () { | |
var proto = { | |
constructor:ForwardingList, | |
size:function () { | |
return this._array.length; | |
}, | |
toString:function () { | |
return 'ForwardingList[' + this._array.toString() + ']'; | |
} | |
}; |
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 LargeInt(asString) { | |
this.asString = asString.replace(/^0+/, ''); | |
} | |
LargeInt.LARGER = 'LARGER'; | |
LargeInt.EQUAL = 'EQUAL'; | |
LargeInt.SMALLER = 'SMALLER'; | |
LargeInt._compare = function(one, another) { | |
var digitsOne = one.split(''), |
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 List = function() { | |
return new Proxy({ | |
constructor: List, | |
_array: [].slice.call(arguments), | |
size: function() { | |
return this._array.length; | |
}, | |
toString: function() { | |
return 'List[' + this._array.toString() + ']'; | |
} |
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 myObject = { | |
__noSuchProperty__: function(name) { | |
return name; | |
} | |
}; | |
var myProxyObject = new Proxy(myObject, { | |
get: function(target, name) { | |
return name in target? | |
target[name]: |
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 myObject = { | |
__meta__: { | |
public: ['publicMethod'] | |
}, | |
privateMethod: function() { return 'private'}, | |
publicMethod: function() {return 'public' } | |
}; | |
var myProxyObject = new Proxy(myObject, { | |
get: function(target, name) { |
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
<?php | |
function fizzBuzz($from, $to) { | |
$fizzActions = array('Fizz', '', ''); | |
$buzzActions = array('Buzz', '', '', '', ''); | |
$text = $fizzActions[$from % 3] . $buzzActions[$from % 5]; | |
$renderAction = array(); | |
$renderAction[$text] = $text; |
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 fizzBuzz(from, to) { | |
var text = | |
'Fizz,,'.split(',')[from%3] + | |
'Buzz,,,,'.split(',')[from%5] | |
var _ = {} | |
_[text] = '' | |
_[''] = from | |
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 fizzBuzz(from, to) { | |
function print() { | |
var text = | |
'Fizz,,'.split(',')[from%3] + | |
'Buzz,,,,'.split(',')[from%5] | |
var _ = {} | |
_[text] = '' | |
_[''] = from |
NewerOlder