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
/** | |
* AddDropdown : appends a dropdown box to an element, and provides a callback to further style the element and the dropdown | |
* | |
@param elem an html node object, or the id of an html node object | |
@param css an object literal containing css to apply to the dropdown box | |
@param callback allows the user to do more with the dropdown box | |
*/ | |
function AddDropdown(elem,css,callback){ | |
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
/** | |
Constructor function which keeps an array of objects, and makes sure they are all equal. | |
Used for checking consistency between many objects easily. | |
for example: | |
create a bunch of objects that should be exactly the same. | |
var data1 = object.serialize(); |
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
/** | |
Used to synchronize multiple types of storage and their timestamps. | |
options{ | |
data : {}, the state that all storage should take. | |
date: int, the modified date that all storage should take | |
interval : int, sync interval in milliseconds. | |
callbacks : [], an ARRAY of callback functions which are to each be executed with data | |
and date as params. Each callback should be used to update a single storage medium. | |
} |
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
/** | |
Pass in a dom ID string or a dom node and to make it draggable. | |
*/ | |
var Draggable = function(elem) { | |
var that = this; | |
var el = (typeof elem === 'string') ? document.getElementById(elem) : elem; | |
var offX, offY; | |
this.mouseDown = function(e) { | |
offX = e.clientX - parseInt(el.offsetLeft); | |
offY = e.clientY - parseInt(el.offsetTop); |
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
/** | |
* | |
options:(OBJECT){ | |
type : element type we're shooting. | |
x : x coordinate | |
y : y coordinate | |
color : color of element | |
} | |
*/ |
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
var LinkedList = function() { | |
var head, tail; | |
var Node = function(dat) { | |
var _node = this, | |
_next = null, | |
_previous = null, | |
_data = dat; |
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
var http = require('http'); | |
var fileReader = require('fs'); | |
http.createServer(function(req,res){ | |
var path = __dirname+req.url; | |
fileReader.readFile(path,function(err,fl){ | |
res.end(fl); | |
}); | |
}).listen(8080); |
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
var app = angular.module('app', []); | |
app | |
.factory('AuthToken', [ | |
'$http', | |
'$q', | |
'$window', | |
function($http, $q, $window) { | |
var authToken = {}; | |
//gets the token and sets it on the windows session storage |
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
describe('An object which relies on promises', function () { | |
it('Should pass if provided the proper parameters', function () { | |
/** | |
* our real object would normally depend on promiseDependency, | |
* but we're replacing it with our mock promise chain here. | |
*/ | |
sut.promiseDependency = PromiseMocks.ResolveMock(); | |
var params = { | |
name : 'alex' |
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
angular.element(document).ready(function() { | |
angular.bootstrap(document, ['app']); | |
}); |
OlderNewer