Skip to content

Instantly share code, notes, and snippets.

View michaelblyons's full-sized avatar

Michael michaelblyons

View GitHub Profile
@michaelblyons
michaelblyons / Mariana.sublime-color-scheme
Created July 12, 2020 17:32
Mariana color scheme overrides
{
// Refs:
// - https://www.sublimetext.com/docs/3/color_schemes.html
// - https://github.com/twolfson/sublime-files/blob/master/Packages/Color%20Scheme%20-%20Default/Mariana.sublime-color-scheme
"variables": {
// "black": "hsl(0, 0%, 0%)",
// "blue": "hsl(210, 50%, 60%)",
// "blue2": "hsl(209, 13%, 35%)",
// "blue3": "hsl(210, 15%, 24%)",
// "blue4": "hsl(210, 13%, 45%)",
@michaelblyons
michaelblyons / bigRound
Last active August 29, 2015 14:06
Make a number into rounded text in quasi-engineering notation. Idea taken from Facebook Like count display.
function bigRound(num, prcn) {
if (num < 1000) {
return num;
};
var rndup = 0.000001;
var sfxs = ['k', 'M', 'B', 'T', 'Q'];
var expt = Math.floor(Math.log(num) / Math.LN10 + rndup);
var sfx = sfxs[Math.floor(expt / 3) - 1];
var clip = +(num * 1.0 / Math.pow(10, expt - expt % 3)).toPrecision(prcn || 2);
return clip + sfx;