Skip to content

Instantly share code, notes, and snippets.

View victorluissantos's full-sized avatar
🎯
Focusing

Victor Santos victorluissantos

🎯
Focusing
View GitHub Profile
@victorluissantos
victorluissantos / media-manager.js
Created June 10, 2014 19:17
Media Manager Suported IE8
(function($, window, undefined){
function bytesToSize(bytes){
var sizes = ['Bytes', 'KB', 'MB'];
if (bytes == 0) return 'n/a';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
}