Skip to content

Instantly share code, notes, and snippets.

View cddr's full-sized avatar

Andy Chambers cddr

View GitHub Profile
@cddr
cddr / emp.clj
Created February 12, 2015 16:09
(defentity Employee
:schema {:id Int, :name Str}
:links [(link :department [Department :id])]
:uniqueness {:id :db.unique/identity})
@cddr
cddr / dept.clj
Last active August 29, 2015 14:15
(defentity Department
:schema {:id Int
:name Str}
:uniqueness {:id :db.unique/identity})
(defn encrypt [attr]
(reify
clojure.lang.Named
(getNamespace [this]
(.getNamespace attr))
(getName [this]
(.getName attr))
clojure.lang.IFn
(invoke [_ obj]
@cddr
cddr / selfied
Created April 7, 2014 17:08
Infinite selfie power
# Lets thank Arnold for the headphones!
#
# Next time you're doing coding hours, get your headphones on and
# run this script in a terminal.
#
# Usage:
#
# 1. Download imagesnap from here: https://github.com/rharder/imagesnap
# 2. Update the global variables below according to where you put imagesnap
# and where you'd like the images to show up

Keybase proof

I hereby claim:

  • I am cddr on github.
  • I am cddr (https://keybase.io/cddr) on keybase.
  • I have a public key whose fingerprint is 64E1 19C6 8F72 F2C4 E650 F321 4093 000D 8C99 8B18

To claim this, I am signing this object:

@cddr
cddr / fixup-whitespace
Created April 1, 2014 19:43
Fix whitespace before commit
git diff HEAD --no-color > /tmp/stage.diff
git apply -R /tmp/stage.diff
git apply --whitespace=fix /tmp/stage.diff
@cddr
cddr / pre-commit
Created April 1, 2014 02:14
Git precommit hook for keeping Changelog up-to-date
#!/bin/sh
# MVP precommit hook that keeps the Changelog up-to-date.
#
# Assumes that `pwd` is the project root
./scripts/gitlog-to-changelog >Changelog
git add Changelog
@cddr
cddr / pre-commit
Created April 1, 2014 02:14
Git precommit hook for keeping Changelog up-to-date
#!/bin/sh
# MVP precommit hook that keeps the Changelog up-to-date.
#
# Assumes that `pwd` is the project root
./scripts/gitlog-to-changelog >Changelog
git add Changelog
@cddr
cddr / gist:8237667
Created January 3, 2014 13:12
ad_details question

So if we have the following line item...

line_item
  ad_distribution{:price_per_unit = 20}
  buy_item{:id = 1}
  buy_item{:id = 2,
           :price_per_unit = 40}
@cddr
cddr / gist:8237666
Created January 3, 2014 13:12
ad_details question
So if we have the following line item...
line_item
ad_distribution{:price_per_unit = 20}
buy_item{:id = 1}
buy_item{:id = 2,
:price_per_unit = 40}
I think the first case is simple. Seems we should return....