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
/** | |
* Used to create a new Vector2 | |
* @param float x Contains the x coord | |
* @param float y Contains the y coord | |
*/ | |
function Vector2(x, y) { | |
this.x = x; | |
this.y = y; | |
} |
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
/* | |
* This is the customized options file for nodelint.js being run through TextMate. | |
* Properties listed here will override the default properties within nodelint.js options. | |
* Commented out properties are the same in the default configuration. | |
* predef handles global variables used throughout different frameworks. | |
* | |
* Changes released into the Public Domain by tav <tav@espians.com> | |
* Options support added by Corey Hart <corey@codenothing.com> | |
* | |
*/ |
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
// Less pretty syntax, super simple to implement, generic reusable implementation | |
flow.exec( | |
function () { | |
new Entity().addComponent('level', this) | |
}, | |
function (err, level) { | |
level.addComponent('level-segment', 'something.json', this) | |
}, | |
function (err, level) { | |
level.addComponent('level-segment', 'something-else.json', this) |
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
Animal - this {} | |
Animal - debug: [ muppet , bert ] | |
Hello, my name is bert and I am a muppet | |
returned: { species: 'muppet', name: 'bert' } | |
**************************************** | |
Muppet - this {} | |
Muppet - debug: [ ernie ] | |
Animal - this {} | |
Animal - debug: [ muppet , ernie ] | |
Hello, my name is ernie and I am a muppet |
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
/*global require*/ | |
require('whom', function (Whom) { | |
if (Whom.allOver18( | |
new Whom('Iain', 27), | |
new Whom('Bob', 53), | |
new Whom('Rob', 19) | |
)) { | |
console.log('Drink!'); | |
} else { | |
console.log('Banned'); |
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
/*global require*/ | |
require(['whom'], function (Whom) { | |
var me = new Whom('Iain', 27); | |
}); |
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
/** | |
* Used to find an intersection between two points. | |
* @param vector2 | |
* @return obj|false if intersection happened returns array of x/y | |
* otherwise fales. | |
*/ | |
lineIntersection: function (v1, v2, v3, v4) { | |
var | |
bx, | |
by, |
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
/*global define console*/ | |
require.config({ | |
baseUrl: '/src', | |
packages: [ | |
{ | |
name: 'underscore', | |
main: 'underscore', | |
location: '/lib/underscore' | |
} | |
], |
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script src="/js/libs/json2.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function () { | |
$.ajax({ | |
url: '/api/login', | |
type: 'POST', | |
data: JSON.stringify({id: 123}), | |
processData: false, | |
contentType: 'application/json', |
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
/*global console window describe xdescribe it expect runs waits*/ | |
(function () { | |
require.paths.unshift(__dirname + '/../../../'); | |
require('thorny/base')('./config/default.json')(function ($) { | |
describe('a vector2', function () { | |
it('should contain the following functions', function () { | |
var vector2 = $('thorny math vector2'); | |
expect(typeof vector2.factory).toEqual('function'); | |
expect(typeof vector2.centroid).toEqual('function'); |