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('secondsToDateTime', [function() { | |
/** | |
* This code returns a date string formatted manually. | |
* Code "new Date(1970, 0, 1).setSeconds(seconds)" returns malformed output on days. | |
* Eg. 4 days, magically becomes 5, 15 becomes 16 and so on...; | |
* */ | |
return function(seconds) { | |
var days = Math.floor(seconds/86400); | |
var hours = Math.floor((seconds % 86400) / 3600); | |
var mins = Math.floor(((seconds % 86400) % 3600) / 60); |
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('bytes', function() { | |
return function(bytes, precision) { | |
if (bytes == 0 || isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-'; | |
if (typeof precision === 'undefined') precision = 1; | |
var units = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'], | |
number = Math.floor(Math.log(bytes) / Math.log(1024)); | |
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; | |
} | |
}); |
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
# I managed to get the compiled version with patched QT working on ubuntu precise 64bit (12.04 LTS) and thought I'd share my bash history in the hopes it might spare others some trouble shooting. | |
# Also note that this install process takes rather long, you might want to consider running it in a screen or something | |
# you will be needing git if you haven't got it yet | |
sudo apt-get install git-core | |
# as per installation instructions, install dependencies for wkhtmltopdf | |
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev | |
# clone the repo | |
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf |