Skip to content

Instantly share code, notes, and snippets.

View sthomp's full-sized avatar

Scott Thompson sthomp

View GitHub Profile
(defn unjoin
"Given a seq `rows` as retrieved from a database select involving a join,
return a vector of nested entities, where the top-level entities have keys
`parent-keys`, plus a key for each key of `child-map`, where the value for
that key is a vector of values specified by the value in `child-map`.
Where the value in `child-map` is a simple keyword, the resulting vector will
contain the corresponding values for that keyword in `rows`.
Eg (unjoin [{:id 1, :a :foo} {:id 1, :a :bar}] [:id] {:vals :a}) =>

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window