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 add = function (a, b) { | |
return a + b; | |
}; | |
var add5 = _.partial(add, 5); | |
add(3,4); | |
// 7 | |
add5(3); | |
// 8 |
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 books = [ | |
{ | |
name: "Little Miss Sunshine", | |
numberOfPages: 32 | |
}, | |
{ | |
name: "Mr. Strong", | |
numberOfPages: 36 | |
}, | |
{ |
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
_.map(books, getNumberOfPages); | |
// undefined, undefined, undefined |
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
//expected call for book[0]: | |
_.result(books[0], "numberOfPages"); | |
//evaluated call: | |
_.result(books[0], 0, books, "numberOfPages"); | |
//which means effectivly | |
_.result(books[0], 0); |
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
_.mixin( | |
{ | |
"preserveCallersFirstNParams" : function (func, n) { | |
n = n || 0; | |
return function () { | |
return func.apply(this, Array.prototype.slice.call(arguments, 0, n)); | |
}; | |
} | |
); |
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 setTimeout, | |
clearTimeout, | |
setInterval, | |
clearInterval, | |
endAllTimers; | |
(function () { | |
var timer = new java.util.Timer(); | |
var counter = 1; | |
var ids = {}; |
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
TextReporter.prototype = new jasmine.Reporter(); | |
TextReporter.prototype.onRunnerFinished = function (callback) { | |
this.callbackEnd = callback; | |
}; | |
TextReporter.prototype.reportRunnerResults = function (runner) { | |
// When all the spec are finished // | |
var result = runner.results(); |
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
//Imported by Rhino on command shell | |
/*global load, print*/ | |
load("lib/Timer.js"); | |
/*global endAllTimers*/ | |
load("lib/TextReporter.js"); | |
/*global TextReporter*/ | |
load("lib/jasmine-1.3.0/jasmine.js"); | |
/*global jasmine*/ |
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 _createJLayoutWrapper = function (handlePosition, predicate, getSize) { | |
var wrapper = { | |
bounds : function (value) { | |
if (value) { | |
handlePosition(value); | |
} | |
return getSize(); | |
}, | |
isVisible : predicate, | |
insets : 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
var complexHandlePosition = function (a, b, c, d, bounds) { | |
... | |
}; | |
//a, b are available in aVal, bVal | |
var easierHandlePosition = _.partial( | |
complexHandlePosition, | |
aVal, | |
bVal | |
); |
OlderNewer