Skip to content

Instantly share code, notes, and snippets.

View blurymind's full-sized avatar

Todor Imreorov blurymind

View GitHub Profile
@lanqy
lanqy / bytesToSize.js
Created March 19, 2013 03:05
JavaScript To Convert Bytes To MB, KB, Etc
// from http://scratch99.com/web-development/javascript/convert-bytes-to-mb-kb/
function bytesToSize(bytes) {
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes == 0) return 'n/a';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
if (i == 0) return bytes + ' ' + sizes[i];
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
};
@cheeming
cheeming / find_bad_revisions
Created June 23, 2012 03:29
A bash script to use git bisect to help bad revisions
#!/bin/bash
function print_usage () {
echo usage: $0 LAST_KNOWN_GOOD_REVISION '"TEST_COMMAND"'
echo LAST_KNOWN_GOOD_REVISION = you can specify this as sha1 hash
echo TEST_COMMAND = the script to run, it should return 0 if success
echo NOTE: Ensure that the current revision is the bad \(broken\)
exit 1;
}
@matiaskorhonen
matiaskorhonen / acegist.user.js
Created April 10, 2012 13:55 — forked from abernier/acegist.user.js
ACE editor for editing your gists
// ==UserScript==
// @id acegist
// @name ACEgist
// @author Antoine BERNIER (abernier)
// @version 0.1.1
// @description ACE editor in your gists
// @match https://gist.github.com/gists/*/edit
// ==/UserScript==
(function (d, cb) {