Rake Tasks For Easier Facebook Development
16 June 2010

Lets face it. Facebook development is tedious. You do not want to waste more time in endless commit-push-pull-restart loop for smallest code changes. Common development setup is to tunnel traffic from development server to your laptop using ssh tunnel. Here are my Rake tasks for switching between production and development mode.
Facebook Application Stack
I use Sinatra, Thin, Sinbook and DataMapper for all my Facebook development. All static assets are served by Apache. Apache also proxies other requests to Sinatra using mod_rewrite. Proxying is easiest to setup using the following rule in .htaccess file:
RewriteEngine On
RewriteBase /
# Everything not found goes to Sinatra / Rack
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://127.0.0.1:4567%{REQUEST_URI} [L,P,QSA]
Chained Selects jQuery Plugin
22 May 2010

Photo by Dan Barbus
Recently I needed to do chained select navigation for a project. It was relatively simple. I did not want to go through hassle of setting up Ajaxified database queries. I liked API of Dependent Select. However I needed to make small modification to suit my needs. I quickly realized it is faster to write the plugin from scratch than trying to understand the original code. I also felt original version had too many lines of code for such a simple plugin. Bit later Chained was born
What is Chained?
Chained is simple jQuery plugin for chained selects. It does not make external AJA(X|H) queries for setting content of child selects. Instead it uses classnames of select options to decide content. As a bonus it is usable even with JavaScript disabled. However with JavaScript disabled there is one catch, all options will be shown to user.
Chained is great when you need something simple and quick. If you have long and complicated select trees you are better off with traditional “Make an AJAX database query to build next select” approach. Good option is Select Chain written by Remy Sharp.
Kuldmuna 2010 and Agency of the Year
26 March 2010

Kuldmuna 2010 awards were held last weekend. This year was especially good for us. Woohoo! We got awarded 15 times. Best of all we won the agency of the year award. It is my fifth year in Estonia and we finally got it.
As Kadri said, good things come to those who wait.
Related articles: State of Kuldmuna Digital and What To Do About It?, Estonian Internet Awards 2009, Golden Hammer 2008.
Using Shrt.st With HTTParty
12 March 2010
I recently evaluated bunch of Ruby libraries for consuming webservices. One I liked most is is HTTParty. Love the syntax and elegance. Here is how you would shorten an URL with my favourite URL shortener shrt.st:
require 'rubygems' require 'httparty' class Shrtst include HTTParty base_uri 'api.shrt.st' def self.shorten(url) get( '/1.0/p/' + url) end end puts Shrtst.shorten('http://www.appelsiini.net/')
Hey Usual. How can I access this via API?
Running on Nesta
11 March 2010

My Mephisto installation finally went fubar. I had to search for new blog engine. It needed to be simple, easy to customize, support Textile and preferably be built on Sinatra. I ended up choosing Nesta. It did not have Textile support so I wrote a patch. This proved Nesta is really easy to customize. Nesta also provided ready made scripts for importing from Mephisto. This made converting from one system to another a breeze.
Tuning Lazy Loader
24 December 2009

I just committed two patches to Lazy Load plugin sent by users. Jeremy Pollock contributed a patch improving scroll behaviour. Before when you scrolled quickly long way down all images above the browser top were loaded. New behavior is to load only those which are currently visible on the screen.
HTML5 Drag and Drop Multiple File Upload
12 October 2009

Previously I experimented with drag and drop file upload with Google Gears. Recently FireFox 3.6 (codenamed Namoroka) was the first to implement File API. It enables JavaScript to interact with local files.
Correction: Ionut G. Stan pointed out that File API was actually available already in FireFox 3.0. What Namoroka introduced is the drag and drop interface for the files. Sorry for the confusion.
Here is how you can implement drag and drop multiple file upload with native JavaScript. No plugins needed. Just plain old new HTML5. Again there is a working demo. You will need FireFox 3.6 to test it. Full source code can be at GitHub.
Drag and Drop File Upload With Google Gears
02 October 2009

Google Gears is an extension which adds new features to you browser. It lets your browser to interact with the desktop. You can store data locally to an SQLite based database. Browser will also have a worker pool for running JavaScript code on the background.
Update 20091007: I updated the tutorial and demo to support dragging and dropping multiple files for uploading simultaneously.
Below is how you can do basic drag and drop file upload. Gears, PHP and jQuery are needed. If you want to try there is a working demo. All source code for the demo can be found from GitHub.
