Fork me on GitHub
isolate.js via AST analysis
Recent changes in SDK
nodeconf 2012
Write logic, not mechanics
protocol based polymorphism
(clojurescripting :intro)
JS Guards
Packageless modules
Addons in multi process future
Yet another take on inheritance
Shareable private properties
Evolving VS Adjusting
oh my zsh
Git status in bash prompt
CommonJS based Github library

This post is about CommonJS Package, a library, allowing consumers to list, read, write, delete & comment private / public gists. Library employs v2 & v1 Github API’s in combination with some dirty hacks to make this possible.

Main target platform is a browser, but it can run on any other platform that will provide implementation of XMLHttpRequests. Since browsers have many limitations in comparison to other platforms this idea was a challenge form a beginning. The first thing and probably something you already have in mind is same origin policy. Luckily all modern browsers today implement W3C standard for cross-origin resource sharing. Unfortunately though, only a few websites employ this technique and reply client with Access-Control-Allow-Origin headers. Believe me or not, Github is not one of those!! Actually convincing them to start useing this standard was not as easy either…

I did not want to give up, so I have decide to implement this library anyway with accompany of two proof of concept experiments demoed in previous posts. I really hope this way I’ll get enough attention from Github folks and they will see a value of improved browser friendly Gist API’s :)

As you could’ve guessed I found a workaround, actually not, I’ll better call it an elegant solution :) Anyway solution to this problem was YQL. If you don’t know yet, it’s a very cool service from Yahoo and likely easiest way to make rest services + all in JavaScript, you should definitely check it out!! After some hacking I’ve managed to put together several “YQL Open Data Tables” with an access to data that can’t be retrieved with a current Github API’s. Most importantly allowing users to select and insert private gists. Since YQL puts Access-Control-Allow-Origin headers, same origin policy problem was solved, as a side effect it also allowed some optimizations by moving several operations from client to server.

Unfortunately it’s not the end of the story neither it was end of the issues I had to run into. After a while I discovered that firefox sends HTTP OPTONS request, before sending desired HTTP POST on which YQL replies without necessary Access-Control-Allow-Origin header. With HTTP GET everything is fine since HTTP OPTIONS are not send in that case. Other browsers don’t have issues nor with GET nor with POST since they don’t seem to send HTTP OPTIONS. I have reported about this issue to YQL folks and they were super fast with picking it up, they plan to have a fix in for a next release, which I hope will be anytime soon.

After all the efforts github library is ready to be forked!! So please give it a try and lets make some amazing stuff to show Github folks that, ###we need a better Gist API’s!!###

Gist plugin for Bespin
google pages is dead
bespin - JavaScript Server
bespin chromend
bespin multibackend mockup
Google App Engine + Helma = geekcloud
Bespin to Helma
Adjectives | Ubiquity + Bugzilla love
Some Mock-up around Ubiquity
Ubiquity command Say
ubiquity command dictionary
Picasa Photo Viewer (Linux port) - Updated
Ubiquity command for JIRA & Crucible
Picasa Photo Viewer (Linux port)
KeyZilla 0.1
XUL Development