This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro extend-fn [name args & body] | |
`(let [old-fn# (var-get (var ~name)) | |
new-fn# (fn [& p#] | |
(let [~args p#] | |
(do ~@body))) | |
wrapper# (fn [& params#] | |
(if (= ~(count args) (count params#)) | |
(apply new-fn# params#) | |
(apply old-fn# params#)))] | |
(alter-var-root (var ~name) (constantly wrapper#)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn capjure-insert | |
([object-to-save hbase-table-name row-id] | |
(capjure-insert object-to-save hbase-table-name row-id nil)) | |
([object-to-save hbase-table-name row-id version-timestamp] | |
(let [#^HTable table (hbase-table hbase-table-name) | |
put (Put. (Bytes/toBytes row-id)) | |
flattened (flatten object-to-save)] | |
(if version-timestamp | |
(do | |
(println "going to insert at:" version-timestamp " which is:" (class version-timestamp)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; What function can I put as FOO here to yield true | |
; Tried: hash-set, conj, concat | |
(defn kv [bag [k v]] | |
(update-in bag [k] conj v)) | |
(defn mergeMatches [propertyMapList] | |
"Take a list of maps and merges them combining values into a set" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def the-users [{:login "deep" :first "Deepthi" :last "Rathore"} | |
{:login "adi" :first "Aditya" :last "Rathore"} | |
{:login "siva" :first "Siva" :last "Jag"} | |
{:login "punit" :first "Punit" :last "Rathore"} | |
{:login "nan" :first "Nanditha" :last "Sunder"}]) | |
(def the-expenses [{:amount 10.0 :merchant "amazon" :category "book" :user "deep"} | |
{:amount 20.0 :merchant "amazon" :category "toy" :user "adi"} | |
{:amount 30.0 :merchant "burger joint" :category "meal" :user "siva"} | |
{:amount 40.0 :merchant "ubuntu" :category "software" :user "punit"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ > couchdb | |
Apache CouchDB 1.0.1 (LogLevel=info) is starting. | |
=CRASH REPORT==== 20-Aug-2010::00:22:28 === | |
crasher: | |
initial call: couch_event_sup:init/1 | |
pid: <0.79.0> | |
registered_name: [] | |
exception exit: {{badmatch, | |
{'EXIT', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(demonictest test-demonictest | |
(is (nil? (:db/id (find-by-id some-id)))) | |
(demonic/insert some-map) | |
(is (not (nil? (:db/id (find-by-id some-id)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(demonic/in-demarcation | |
(some-datomic-operation) | |
(another-datomic-operation)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(deftest test-demonic-testing | |
(demonic-testing "check not present, insert, then check present" | |
(is (nil? (:db/id (find-by-id some-id)))) | |
(demonic/insert some-map) | |
(is (not (nil? (:db/id (find-by-id some-id))))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn load-and-transform-with [eid transform] | |
(-> eid | |
load-entity | |
transform)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn insert-and-transform-with [a-map transform] | |
(-> a-map | |
insert | |
transform)) |
OlderNewer