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.module('humanize', []) | |
.filter('humanize', function(){ | |
return function humanize(number) { | |
if(number < 1000) { | |
return number; | |
} | |
var si = ['K', 'M', 'G', 'T', 'P', 'E']; | |
var exp = Math.floor(Math.log(number) / Math.log(1000)); | |
var result = number / Math.pow(1000, exp); | |
result = (result % 1 > (1 / Math.pow(1000, exp - 1))) ? result.toFixed(2) : result.toFixed(0); |
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 tsvToJson = function(input){ | |
var info = input.replace(/['"]/g,''), | |
lines = info.split('\n'), | |
firstLine = lines.shift().split('\t'), | |
json = []; | |
// Helper function to remove quotes | |
// and parse numeric values | |
var removeQuotes = function(string){ | |
string = string.replace(/(['"])/g, "\\$1"); |
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.directive('imgPreload', ['$timeout', function($timeout) { | |
return { | |
restrict: 'A', | |
scope: { | |
ngSrc: '@' | |
}, | |
link: function(scope, element, attrs) { | |
var loaded = false; | |
element.on('load', function() { | |
loaded = 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
.parent-element | |
-webkit-transform-style: preserve-3d | |
-moz-transform-style: preserve-3d | |
transform-style: preserve-3d | |
@mixin vertical-align | |
position: relative | |
top: 50% | |
-webkit-transform: translateY(-50%) | |
-ms-transform: translateY(-50%) |
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.7.1/jquery.js"></script> | |
<script> | |
window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js">\x3C/script>') | |
</script> |
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
@mixin clear() | |
&:before, &:after | |
content: "\0020" | |
display: block | |
height: 0 | |
overflow: hidden | |
&:after | |
clear: both |
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.filter('orderObjectBy', function(){ | |
return function(input, attribute) { | |
if (!angular.isObject(input)) return input; | |
var array = []; | |
for(var objectKey in input) { | |
array.push(input[objectKey]); | |
} | |
array.sort(function(a, b){ | |
a = parseInt(a[attribute]); | |
b = parseInt(b[attribute]); |
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
@mixin text-truncate | |
overflow: hidden | |
text-overflow: ellipsis | |
white-space: nowrap |
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
@mixin clearfix() | |
& | |
*zoom: 1 | |
&:before, | |
&:after | |
content: "" | |
display: table | |
&:after | |
clear: both |
NewerOlder