Skip to content

Instantly share code, notes, and snippets.

View joevandyk's full-sized avatar

Joe Van Dyk joevandyk

View GitHub Profile
require 'active_support'
require 'active_support/core_ext'
require 'ruby-prof'
require "minitest/autorun"
class Array
def rest
self[1..-1]
end
end
CREATE OR REPLACE FUNCTION escape_json (text) RETURNS text AS $$
SELECT replace($1, '"', '"'); $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION to_json(text) RETURNS text AS $$
SELECT escape_json($1) $$ LANGUAGE SQL IMMUTABLE;
CREATE OR REPLACE FUNCTION to_json(KEY text, value text) RETURNS text AS $$
SELECT '"' || to_json($1) || '" : "' || to_json($2) || '"'; $$ LANGUAGE SQL IMMUTABLE;
Tanga.initialize '#upsell', ->
select = $('#upsell select')
notice = $('#upsell p.notice')
checkbox = $('#upsell :checkbox')
callback = ->
notice.toggle(@checked)
select.attr("disabled", !@checked)
true