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
/** | |
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 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 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 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 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 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 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']); | |
}); |
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 http = require('http'); | |
var body = JSON.stringify({ | |
Name:"OMITTED", | |
PhoneNumber: "OMITTED", | |
Email:"OMITTED", | |
Position:"Javascript Developer", | |
Urls:[ |
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
# Load balancer configuration | |
upstream exampleApp { | |
# Directs to the process with least number of connections. | |
least_conn; | |
# One failed response will take a server out of circulation for 20 seconds. | |
server 127.0.0.1:10080 fail_timeout=20s; | |
#server 127.0.0.1:10081 fail_timeout=20s; | |
#server 127.0.0.1:10082 fail_timeout=20s; | |
#server 127.0.0.1:10083 fail_timeout=20s; |
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
module.exports = function () { | |
this.$get = [function () { | |
return function directiveBuilder(config) { | |
var options = config || {}; | |
return { | |
replace: true, | |
restrict: "E", |
OlderNewer