Monthly Archives: July 2012

benjy

imgur: the simple image sharer.

Posted in Uncategorized | Leave a comment

Javascript charts and graphs for your website using RGraph

Javascript charts and graphs for your website using RGraph.

Posted in Uncategorized | Leave a comment

String.prototype.trim

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, “”) }; String.prototype.ltrim = function() { return this.replace(/^\s+/, “”) }; String.prototype.rtrim = function() { return this.replace(/\s+$/, “”) }; String.prototype.lpad = function(padString, length) { var str = this; while(str.length < length) { str = padString … Continue reading

Posted in Uncategorized | Leave a comment

function formatBytes($size, $precision = 2) { $base = log($size) / log(1024); $suffixes = array(”, ‘k’, ‘M’, ‘G’, ‘T’); return round(pow(1024, $base – floor($base)), $precision) . $suffixes[floor($base)]; }

Posted in Uncategorized | 1 Comment

javascript – format number with grouping digit (regexp)

“222222222222222223222”.replace(/(\d)(?=(\d{3})+$)/g, ‘$1.’); Number.prototype.format = function () { if ((1.1).toLocaleString().indexOf(“.”) >= 0) { return this.toString().split( /(?=(?:\d{3})+(?:\.|$))/g ).join( “,” ); } else { return this.toString().split( /(?=(?:\d{3})+(?:,|$))/g ).join( “.” ); } };

Posted in Uncategorized | 2 Comments

javascript – addListener()

function addListener(obj, eventName, listener) { if(obj.addEventListener) { obj.addEventListener(eventName, listener, false); } else { obj.attachEvent(“on” + eventName, listener); } } addListener(document, “DOMContentLoaded”, finishedDCL); addListener(window, “load”, finishedLoad); if(!window.addEventListener) { document.getElementById(‘DCL’).innerHTML = “(not supported)”;

Posted in Uncategorized | Leave a comment

batch optimize jpegs with jpegtran

mkdir tmp for %i in (*.jpg) do @jpegtran -copy none -optimize -perfect %i tmp\%i cd tmp for %i in (*.jpg) do @touch -r ..\%i %i move /y *.jpg .. commonly you can save up to 40% on image size without … Continue reading

Posted in Uncategorized | Tagged | Leave a comment