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
String.prototype.toLuhn = function() { | |
var sum = 0 | |
this.replace(/\D+/g,'').replace(/[\d]/g, function(c, p, o){ | |
sum += [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]][(o.length-p) & 1][parseInt(c, 10)] | |
}) | |
return this + ((10 - sum % 10) % 10) | |
} |
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') | |
http.createServer(function(req, res) { | |
var proxy = http.get({ hostname: process.argv[process.argv.length -1], port: 80, path: req.url }, function(r) { | |
r.pipe(res) | |
}) | |
}).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
.filter('bytes', [function(){ | |
return function bytes(a, b, c, d, e){ | |
return (b=Math,c=b.log,d=1e3,e=c(a)/c(d)|0,a/b.pow(d,e)).toFixed(2) + (e?'kMGTPEZY'[--e]+'B':'Bytes') | |
} | |
}]) |
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
.directive('ngFile', ['$parse', function($parse){ | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
link: function($scope, $element, attrs){ | |
$element.bind('change', function(event){ | |
$scope.$apply(function($scope){ | |
$parse(attrs.ngModel).assign($scope, event.target.files) | |
}) | |
}) |
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
.directive('ngFile', ['$parse', function($parse){ | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
link: function($scope, $element, attrs){ | |
$element.bind('change', function(event){ | |
$scope.$apply(function($scope){ | |
Array.prototype.push.apply($parse(attrs.ngModel)($scope), event.target.files || []) | |
}) | |
}) |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.docker.boot2docker</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/boot2docker</string> | |
<string>up</string> |
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
# app/app.coffee | |
express = require 'express' | |
app = express() | |
app.use require 'controllers/status' | |
app.listen(80) |
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 = (keys, values) -> keys.reduce ((p, v, i) -> p[v] = values[i]; p), {} |
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
function scrolledIntoView(element) { | |
var rect = element.getBoundingClientRect() | |
, h = (window.innerHeight || document.documentElement.clientHeight) | |
, w = (window.innerWidth || document.documentElement.clientWidth) | |
, verticalVisibility = (rect.top <= h) && ((rect.top + rect.height) >= 0) | |
, horizontalVisibility = (rect.left <= w) && ((rect.left + rect.width) >= 0) | |
return verticalVisibility && horizontalVisibility | |
} |
OlderNewer