Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!
twittercomp.jpg

It’s a common problem we’ve all faced. Sometimes 140 just isn’t enough.

What do you do when your carefully crafted Tweet is too profound to fit in the infernal 140 character limit? What if nothing short of 141 characters will do? You upgrade your browser to enable advanced Twitter compression, that’s what.

var trep = [[ "^", "^ " ], [ "with the ", "^wt " ],[ "that the ", "^tt " ],[ "check out ", "^co " ],[ "in the ", "^nth " ],[ "of the ", "^ot " ], [ "at the ", "^at "], [ "isn't ", "^int " ], [ "cool ", "^c " ], [ "neat ", "^nt " ],[ "when ", "^w " ],[ "with ", "^wi " ], [ "that ", "^h " ], [ "this ", "^s " ], [ "the ", "^e " ], [ "day ", "^d " ], [ "are ", "^r " ], [ "and ", "^n " ] ];

function tcomp( input )
{

   var temp = input;
   for ( var x=0; x<trep.length; x++ )
   {
     temp = temp.replace( new RegExp( trep[x][0].replace(/\^/g,”\\^”).replace(/\’/g,”\\'”), “g” ), trep[x][1] );
   }
   return temp;

}
function tdecomp( input )
{

   var temp = input;
   for ( var x=trep.length-1; x>=0; x– )
   {
     temp = temp.replace( new RegExp(trep[x][1].replace(/\^/g,”\\^”).replace(/\’/g,”\\'”), “g”), trep[x][0] );
   }
   return temp;

}

The tcomp and tdecomp functions will transform your Tweet into a highly compressed, but mostly human readable format. It involves a lot of super secret mathematics that I’m not allowed to talk about, but suffice it to say that you can save a whole character or two in most Tweeting scenarios. The best part is that dynamic power carrot coding mechanisms ensure that you’ll look good in the process. Trust me.

Below are two bookmarklets. Don’t click on those here – instead, drag them to your bookmarks bar. In Twitter, type your slightly too-long message and then run the compress status bookmarklet to compress the input field. If you see other people posting compressed messages, either translate in your head, or click the decompress feed bookmarklet to decompress the entire contents of the stream you are viewing.

Bookmarklet: compress status
Bookmarklet: decompress feed



Related
blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,443 other followers