This file contains hidden or 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
// | |
// http://www.numericjs.com/ | |
// | |
load('http://www.numericjs.com/lib/numeric-1.2.6.min.js'); | |
a = [[1,2,3], | |
[4,5,6], | |
[7,3,9]]; |
This file contains hidden or 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
// | |
// algebraic equations | |
// in javascript | |
// http://algebra.js.org/ | |
// | |
load('http://algebra.js.org/javascripts/algebra.min.js'); | |
var Expression = algebra.Expression; | |
var Equation = algebra.Equation; | |
var Fraction = algebra.Fraction; |
This file contains hidden or 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
// | |
// A minimal test | |
// for https://lodash.com | |
// | |
load('https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.min.js'); | |
x = _.last([1,2,3]) | |
if (x !==3 ) throw ''; | |
x = _.assign({ 'a': 1 }, { 'b': 2 }, { 'c': 3 }); | |
if (x == undefined) throw ''; |
This file contains hidden or 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
// | |
// validate.js | |
// A declarative way of validating j | |
// javascript objects. | |
// | |
// This test was based on the example | |
// http://validatejs.org/#validate | |
// | |
load("http://cdnjs.cloudflare.com/ajax/libs/validate.js/0.8.0/validate.min.js"); |
This file contains hidden or 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
// | |
// ========= | |
// yolpo | |
// in action | |
// ========= | |
// | |
// | |
// Load a javascript library to test (e.g. lodash) | |
// |
This file contains hidden or 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
// | |
// hello world in react.js | |
// | |
load('https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js'); | |
element = document.createElement('div'); | |
HelloMessage = React.createClass({displayName: 'HelloMessage', | |
render: function() { | |
return React.createElement('element', null, 'Hello ', this.props.name); |
This file contains hidden or 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
// | |
// the 'hello world' for backbone.js | |
// http://backbonejs.org/ | |
// | |
load('http://code.jquery.com/jquery-1.7.1.min.js'); | |
load('http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js'); | |
load('http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js'); | |
ListView = Backbone.View.extend({ |
This file contains hidden or 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
// | |
// isPrime(n) --> returns boolean | |
// returns true if the number is prime. | |
// | |
load('http://www.yolpo.com/prime.0.1.js'); | |
if (isPrime(2) != true) throw ''; | |
if (isPrime(4) == true) throw ''; | |
if (isPrime(169) == true) throw ''; | |
if (isPrime(107777) != true) throw ''; |
This file contains hidden or 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
// | |
// http://handlebarsjs.com/ | |
// minimal templating on steroids | |
// | |
load('http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v2.0.0.js'); | |
// 1 Usage | |
source = "<p>Hello, my name is {{name}}. I am from {{hometown}}. I have " + | |
"{{kids.length}} kids:</p>" + |
This file contains hidden or 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
load('http://underscorejs.org/underscore-min.js'); | |
function json(x) { return JSON.stringify(x); } | |
sum = 0; | |
_.each([1, 2, 3],function(i) { sum+=i }); | |
if (sum !== 6) throw ''; | |
sum = 0; |