Keybase proof

I hereby claim:

  • I am alassek on github.
  • I am alassek ( on keybase.
  • I have a public key ASCER3RZ4eL9jqSNbXVviFayarCOAT2JXki5SwZ6hhHopwo

To claim this, I am signing this object:


I've been doing some work lately with JSON documents in PostgreSQL using jsonb columns. You can query these documents using a GIN index in PG, but the syntax can be a little cumbersome

SELECT "events".* FROM "events" WHERE "events"."body" @> '{"shift":{"user_id":2}}'

You have to construct the right side of the query as a JSON string, which is a bit annoying. So I wondered if I could adapt Arel to do the tedious stuff for me.

View application_controller.rb
class ApplicationController < ActionController::Base
before_filter :require_authentication
def require_authentication
unless current_certificate.verify(public_key)
head :forbidden
View location.js
* `window.location` is a BAD api. Doesn't have a prototype, 'too much recursion' error
* if you try to inspect the constructor. Monkey-patching causes random disappearances
* of the monkey-patched function in Chrome, cloning causes 'too much recursion' in FF.
* This is what I'm reduced to. ಠ_ಠ
(function () {
function Location () {
View html_truncate.rb
# By Henrik Nyh <> 2008-01-30.
# Free to modify and redistribute with credit.
require "rubygems"
require "hpricot"
module TextHelper
# Like the Rails _truncate_ helper but doesn't break HTML tags or entities.
def truncate_html(text, max_length = 30, ellipsis = "...")
View extendEach.js
(function () {
function extendEach () {
var args =,
child = this;
_.each(args, function (proto) {
child = child.extend(proto);
View typeIntent.js
* Copyright (c) 2011 Lyconic, LLC.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
View store_ext.js = function ( key ) {
var value = key ); key, null );
return value;
View konami.js
(function ($) {
$.fn.konami = function (callback, code) {
code = code || "38,38,40,40,37,39,37,39,66,65,13";
return this.each(function () {
var kkeys = [];
$(this).keydown(function (e) {
if (kkeys.toString().indexOf(code) >= 0) {
$(this).unbind('keydown', arguments.callee);
View get_flash.rb
def get_flash
signed_message = request.cookies['_project_name_session']
if signed_message.present?
secret = ProjectName::Application.config.secret_token
verifier =
session = verifier.verify(signed_message)
@flash = session.delete('flash')