Skip to content

Instantly share code, notes, and snippets.

View cch1's full-sized avatar

Chris Hapgood cch1

  • Sun Tribe Trading
  • Center of the Universe
View GitHub Profile
@cch1
cch1 / pick-and-rename.clj
Created July 30, 2012 17:07 — forked from edw/pick-and-rename.clj
Let-Over-Lambda
(let [undefined-value (atom :undefined-value)]
(defn pick-and-rename [col pick-map]
(apply assoc
{}
(flatten
(filter (fn [[k v]]
(not (= v undefined-value)))
(map (fn [[k v]]
[v (get col k undefined-value)])
pick-map))))))
@cch1
cch1 / mocking-ex.clj
Created February 6, 2012 21:43 — forked from mwmitchell/mocking-ex.clj
with metaconstants
(facts "/locations/:id/rates should limit the rate response count by the :limit param"
(let [params [:check_in (gen-check-in)
:check_out (gen-check-out)
:guests 1
:rooms 1
:limit ...limit...]]
(apply location-rate-request (:tid location-one) params) => truthy
(provided
(apij.models.hotel-search/search
(contains {:params (contains {:limit apij.views.rates.common/max-hotels})}))
@cch1
cch1 / Emacs.md
Created May 6, 2011 20:45
Setting up Emacs daemon on OS X

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Homebrew

First you'll need to install the [Homebrew package manager][brew] if yo haven't already. It is amazing.

class Tag
has_many :taggings
end
class Tagging
belongs_to :tag
belongs_to :posts
# uses a string 'flag' column but could be changed to a boolean important
# column later, hence the need to encapsulate!