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
# create dir to put all file version found | |
mkdir target && cd target | |
# checkout all "lost" commits and save a file version for each of them | |
for i in `git reflog | head -75 | awk '{print $1}'`; do cat path_to_file > `git log -1 | head -1 | awk '{print $2}'`; done | |
# use fdupes to find duplicates, etc |
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
;; see http://stackoverflow.com/questions/16242750/nesting-structures-with-datomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; sample attributes | |
(d/transact conn [{:db/id #db/id[:db.part/db] | |
:db/ident :some/ref-value | |
:db/valueType :db.type/ref |
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
;; see http://stackoverflow.com/questions/17190334/getting-the-id-of-an-inserted-entity-in-diatomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; create an atribute | |
(d/transact conn [{:db/id #db/id[:db.part/db] | |
:db/ident :some/attribute | |
:db/valueType :db.type/string |
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
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [;; Article | |
{:db/id #db/id [:db.part/db] | |
:db/ident :article/title | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one |
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
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [{:db/id #db/id [:db.part/db] | |
:db/ident :enum/ns | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db/doc "Enum's namespace. Help enforce fk constraints on :db.type/ref enum references" |
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
;; see http://stackoverflow.com/questions/14724991/modelling-multiple-many-to-many-relationships-in-datomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [ ;; User | |
{:db/id #db/id [:db.part/db] | |
:db/ident :user/username |
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
;; see http://stackoverflow.com/questions/16386793/datomic-query-function-that-filters-and-binds | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; sample attribute definiton | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] |
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
;; see http://stackoverflow.com/questions/16727590/what-is-a-good-way-of-finding-duplicates-in-datomic | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://duplicate-values") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; sample attribute definiton | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] |
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
import java.util.Map; | |
import java.util.UUID; | |
import datomic.Connection; | |
import datomic.Peer; | |
import datomic.Util; | |
public class JavaDbFunction { | |
/** |
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
; See http://stackoverflow.com/questions/15595540/datomic-insert-blocks | |
(require '[datomic.api :as d]) | |
(def uri "datomic:mem://test") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(d/transact conn [{:db.install/_attribute :db.part/db | |
:db/id #db/id[:db.part/db] | |
:db/ident :car/model |