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
// Checks the equality of arrays based on value | |
const assertEqual = (arr1, arr2) => { | |
if (arr1.length !== arr2.length) | |
return false; | |
for (var i = arr1.length; i--;) { | |
if (arr1[i] !== arr2[i]) | |
return false; | |
} |
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
"use strict"; | |
const rp = require("request-promise"); | |
const Promise = require("bluebird"); | |
// Get Random Chuck Norris Quote | |
const getRandomChuckNorrisQuote = () => { | |
return rp({ | |
uri: "https://api.chucknorris.io/jokes/random", | |
json: true |
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 FileProxy = function () { | |
this.stream = function (source, sourceHeaders, destinationHeaders, res) { | |
var rem; | |
res.writeHead(200, destinationHeaders); | |
rem = request(source, sourceHeaders); | |
rem.on('data', function (chunk) { | |
res.write(chunk); | |
}); |
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
#EC2 Node Setup Guide | |
##Install Node and NPM | |
* `sudo yum update` | |
* `sudo yum install gcc-c++ make` | |
* `sudo yum install openssl-devel` | |
* `sudo yum install git` | |
* `git clone git://github.com/joyent/node.git` | |
* `cd node` | |
* `git pull origin master` |
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
// Thanks http://uncorkedstudios.com/blog/multipartformdata-file-upload-with-angularjs | |
.directive('fileModel', ['$parse', function ($parse) { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
var model = $parse(attrs.fileModel); | |
var modelSetter = model.assign; | |
element.bind('change', function(){ | |
scope.$apply(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
ng-class="{selected: $index==selectedIndex}" | |
ng-class="{admin:'enabled', moderator:'disabled', '':'hidden'}[user.role]" | |
thank you: http://stackoverflow.com/a/8309832/1883201 |
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
'use strict'; | |
app.run(function($interval){ | |
// Timeout | |
var countDown = 4, limit = 0, timer; | |
timer = $interval(function(){ | |
if(countDown<=limit){ | |
// Trigger | |
$interval.cancel(timer); | |
} |
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
'use strict'; | |
app.directive('holderFix', function () { | |
return { | |
link: function (scope, element, attrs) { | |
Holder.run({ images: element[0], nocss: true }); | |
} | |
}; | |
}); |