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
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://user-groups3") | |
(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 :user/name |
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
(ns user | |
(:require [clojure.java.io :as io] | |
[datomic.api :as d])) | |
(defn order-schema [] | |
(read-string (slurp (io/resource "schema.edn")))) | |
(defn start-datomic! [uri schema] | |
(d/create-database uri) | |
(let [conn (d/connect uri)] |
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
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://user-groups3") | |
(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 :user/name |
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
;; Datomic example code | |
;; make in memory database | |
(use '[datomic.api :only (q db) :as d]) | |
(def uri "datomic:mem://matches") | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
;; add the match attribute | |
(d/transact |
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
(ns redis-memo | |
(:require redis) | |
(:import (java.net URLEncoder))) | |
;; -------------------------------------------------------------------------------- | |
;; Default connection params | |
;; -------------------------------------------------------------------------------- | |
(def memo-server {:host "localhost" :port 6379 :db 14}) |
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
class Greeter | |
def initialize(*names) | |
names << "World" if names.empty? | |
@names = names | |
end | |
def say_hi | |
@names.each do |name| | |
puts "Hello #{name}!" | |
end |
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
hItuE25058127 | |
6uGdS64633551 | |
iZ8Yg129410073 | |
mn9Ni177063744 | |
tvUy62899300 | |
LlcJs181693848 | |
rRNp274174151 | |
UsiSz5027013 | |
DH4Yd88472413 | |
eEIN376415610 |
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
hItuE25058127 | |
6uGdS64633551 | |
iZ8Yg129410073 | |
mn9Ni177063744 | |
tvUy62899300 | |
LlcJs181693848 | |
rRNp274174151 | |
UsiSz5027013 | |
DH4Yd88472413 | |
eEIN376415610 |
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
(In views/layouts/application.haml) | |
%html | |
= yield :application_with_nested_layout | |
= yield |
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
;; | |
;; NS CHEATSHEET | |
;; | |
;; * :require makes functions available with a namespace prefix. | |
;; | |
;; * :use makes functions available without a namespace prefix | |
;; (i.e., refers functions to the current namespace). | |
;; | |
;; * :import refers Java classes to the current namespace. | |
;; |