Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@brandonbloom
brandonbloom / gg.clj
Last active December 16, 2015 04:59
[:group
"("
[:nest 2
[:group
"let "
[:group
"["
[:align
[:group
"x"
@brandonbloom
brandonbloom / gist:3214278
Created July 31, 2012 06:34 — forked from halgari/gist:3213067
Async example in clojure-py
(ns async-test
(:require time)
(:require urllib))
;; See https://github.com/halgari/clojure-py/issues/135
(defmacro time [expr]
`(let [start# (time/clock)
ret# ~expr]
(prn (str "Elapsed time: " (py/round (* (- (time/clock) start#) 1000) 3) " msecs"))
ret#))
@brandonbloom
brandonbloom / cancan.rb
Created August 30, 2011 22:48 — forked from clyfe/cancan.rb
Monkey patch for cancan issue #327
# monkey-patch https://github.com/ryanb/cancan/issues/327
# put in Rails.root/config/initializers/cancan.rb
module CanCan
module ModelAdapters
class ActiveRecordAdapter
private
# fix nested imbrication
def merge_conditions(sql, conditions_hash, behavior)
if conditions_hash.blank?