A simple base64 encoder. Simply pass your string and a reference to the function to get back the encoded string.
var
map ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
sample = "140bytes rocks!",
encoded = base64Encode(sample, map);
Artur Honzawa @arturhonzawa hacked the main code and further compression was done by me (@aemkei). Thanks to Rob Griffiths @bytespider and Jed Schmidt @jedschmidt for some pretty good hints!
Feel free to fork and improve!