Reverberations

Internet Explorer’s Trailing Comma Woes

Posted in AJAX, Coding, Computing, Hax0r, Search, javascript, trick by Brajesh on March 18th, 2008

Internet Explorer is notorious for breaking on trailing commas in JavaScript array declaration. e.g.

var obj = {
     a: 1,
      b: 2,
};

fails on IE, while all other browsers just ignore the innocuous trailing comma after second element.

Weeding out these commas from JavaScript code is absolute PITA. However, here is a regular expression search string I wrote to search such instances in the code.

,\s*\n+\s*[\}\)\]]

Even better,
,\s*\n+(\s*\/\/.*\n)*\s*[\}\)\]]
matches multiple new lines and comments.

Safari on Windows Crashes Too Often

Posted in Apple, Coding, Computing, Design, Desktop, Linux, Rant, Windows, javascript by Brajesh on January 23rd, 2008

I’m not much of a fan of Apple softwares on Windows. I like iTunes though, even if it’s a bit bulky. I’ve tried using Safari on Windows for its super pleasing font rendering, aesthetics and, of late, some testing on WebKit/KHTML. However, it crashes just too often to be of any serious use and, of course, doesn’t have any DOM inspector. It has a barely usable JavaScript console though.
On a side-note, I’ve read that Safari can work on Linux under Wine. I’ll give it a try sometime. Now, if only I could run iTunes under Wine :) .

safaricrashonwindows2.png

Compiling Greasemonkey Scripts to xpi (Firefox Extension)

Posted in Coding, Firefox, Hax0r, greasemonkey, javascript, trick by Brajesh on November 28th, 2007

Bulls**t

Posted in Asides, Coding, Culture, Freedom of Speech, WTF, greasemonkey, humour, javascript by Brajesh on April 28th, 2007

This fscking awesome greasemonkey script to uncensor the Internet. Ingenious.

Need Firefox extension to open xls in Google Spreadsheet

Posted in Coding, Firefox, Google, greasemonkey, javascript by Brajesh on December 13th, 2006

I need one Firefox extension/greasemonkey script to add an option to open xls/doc links directly in Google docs & spreadsheets. This is something Google itself should be providing like they do in Gmail. Perhaps, I’ll write one myself in case I can’t find it.

[Update]- Whooaa! Same day Google releases its Firefox toolbar (beta) with this exact same functionality I’m looking for and have blogged. Now, is it just one wish a day, or - I want to be king :-D , please.

Quick Proxy Browsing

Posted in Coding, javascript by Brajesh on August 10th, 2006

When: Your ISP is stupid enough to block sites it shouldn’t.

How: Create a bookmarklet of the following JavaScript code. All the line breaks below needed to be removed for this to work.

javascript:void((function(){window.location.href=
‘http://www.boxofprox.com/index.php?q=’+base64_encode(window.location.href);})());
function%20base64_encode(str){
var%20alnum=’ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._’;
var%20out=”;var%20t,x,y,z;for(var%20i=0;i<str.length;i+=3){t=Math.min(3,str.length-i);
if(t==1){x=str.charCodeAt(i);out+=alnum.charAt((x>>2));
out+=alnum.charAt(((x&0X00000003)<<4));out+=’–’;}
else%20if(t==2){x=str.charCodeAt(i);y=str.charCodeAt(i+1);
out+=alnum.charAt((x>>2));out+=alnum.charAt((((x&0X00000003)<<4)|(y>>4)));
out+=alnum.charAt(((y&0X0000000f)<<2));out+=’-';}
else{x=str.charCodeAt(i);y=str.charCodeAt(i+1);z=str.charCodeAt(i+2);
out+=alnum.charAt((x>>2));out+=alnum.charAt((((x&0×00000003)<<4)|(y>>4)));
out+=alnum.charAt((((y&0X0000000f)<<2)|(z>>6)));out+=alnum.charAt((z&0X0000003f));}}
return%20out;}

This little code lets one browse with a base64 encoded url to bypass any phrase blocks. Use it on your own risk etc. Thanks ’someone unknown’ for base64 encoding function.