Base64 encode/decode of UTF8 in browser with JS

Date: 11/11/2011 ~ Category: development/javascript ~ Tags: base64, utf8, unicode, javascript, snippet

While working on live demo of JS-YAML, our pure JavaScript port of exciting PyYAML. I found that there's absolutely no ready solutions for encoding and decoding Base64 in JavaScript for unicode. Tons of Base64 encoders/decoders that will blow out your unicode string like я обожаю ириьски into something absolutely useless. Tons of utf8 encoders/decoders that just do not work. So I wrote my own..…

Synchronized checkouts of git submodules upon main repo branch change

Date: 26/10/2011 ~ Category: development/how-to ~ Tags: git, checkout, submodule

This tip will be useless for most of all. But if you are involved in porting of something to something better (or at least something you get paid for), for example porting project from LESS to SASS. Well you don't need anything special for such purpose, but the problem comes out when you want to have exact copy of original repo (with different branches), but with ported sources…

Get UTF-8 string from array of bytes in Node.JS

Date: 26/10/2011 ~ Category: development/node-js ~ Tags: node.js, utf-8, decode, string

While I was working on js-yaml - JavaScript port of PyYAML (by the time of writing this post, js-yaml is still in WIP stage), I found that I need something to convert stream of bytes into a string. So this is a quick and simple example of how to get an UTF8 string from the stream of bytes…

Understanding Rack Builder

Date: 03/09/2011 ~ Category: development/ruby ~ Tags: ruby, rack, server, rails, sinatra

Most of the web-frameworks for Ruby today use Rack - awesome web-server interface introduced in 2007. Although Rack is not something new that just released, most of us still aware of it (Hi, varnak!), even denying the fact that there's simple tutorials giving idea of how to build your own simple application. Unfortunately, I didn't found good explanation about one of the most awesome part of the Rack - Builder. So this post is some kind of reading sources of Builder loud in order to understand it…

Creating images with QR code in Ruby

Date: 27/08/2011 ~ Category: development/ruby ~ Tags: ruby, qr code, rmagick

Don't know why but recently I have decided that I want to have a QR code with URL on each page of my blog that will be visible on printer-only variant of blog. Unfortunately after I have prepared a proof of concept version, I realized that in fact I don't need it, and most likely nobody will need it, at least on my blog. But just for historic reasons I want to share my experience. I hope it will be helpful for at least somebody…