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 joy.baremud | |
(:require [clojure.set :as set])) | |
;;My apartment consists of | |
(def graph [#{:myroom :hallways} ;;my-room, connected to hallways | |
#{:hallways :bathroom} ;;the bathroom, connected to hallways | |
#{:otherroom :hallways :kitchen} ;;a loop with otherroom, kitchen, hallways all connected | |
#{:hallways :stairs} ;;a door out to the stairs | |
#{:stairs :elevator}]) ;;in the stairs there's an elevator |
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 [db q] :as d]) | |
;;LOOK IN THE BOTTOM FOR CORRECT USE OF DATOMIC :) | |
;;not supplied: | |
;;* connecting to a db named "conn" | |
;; (checkout awesome Jonas Edlunds gist | |
;; for inspiration: https://gist.github.com/3122363 ) | |
;;* a schema that fit's the following person-datoms |
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
How to get started with a swarm-setup on EC-2 | |
============================================= | |
Launch instance | |
--------------- | |
Switch to the close region (EU West for us). | |
Start an EC-2 instance, I selected Ubuntu 12 server, Small instance type. |
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
java.util.concurrent.ExecutionException: java.lang.Error: Assert failed: (every? identity [key vtypeid cardinality]) | |
at datomic.common$throw_executionexception_if_throwable.invoke (common.clj:381) | |
datomic.common$promise$reify__253.get (common.clj:423) | |
datomic.common$promise$reify__253.deref (common.clj:431) | |
clojure.core$deref.invoke (core.clj:2117) | |
datomic.peer.Connection.transact (peer.clj:106) | |
datomic.api$transact.invoke (api.clj:63) | |
datest.core$eval935.invoke (NO_SOURCE_FILE:1) | |
clojure.lang.Compiler.eval (Compiler.java:6603) | |
clojure.lang.Compiler.eval (Compiler.java:6566) |
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 path-with-enlive-example | |
(:require [net.cgrand.xml :as xml] | |
[clojure.zip :as z])) | |
;; This is meant to be answer to the question | |
;; "Enlive as a hammer" posted in the enlive mailing list: | |
;; https://groups.google.com/forum/#!topic/enlive-clj/Da0l_Vpu05U | |
;; div | |
;; | :content |
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 'hello) | |
(println "hello world!") |
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 async-math) | |
(require '[clojure.core.async :as async :refer :all]) | |
(defn query-maker | |
"generates a simple math-query and the answer to it" | |
[] | |
(let [a (rand-int 10) b (rand-int 10)] | |
{:query (str "what is " a " + " b "?") | |
:answer (+ a b)})) |
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 'seesaw.core) | |
;; the state, when was the last keypress? | |
(def last-tap (atom nil)) | |
(defn nanoseconds-diff-to-bpm [now then] | |
(let [nanosecs-in-a-minute (* 60 1000 1000 1000.0) | |
diff (- now then)] | |
(/ nanosecs-in-a-minute diff))) |
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
;;This is released under EPL (same as Clojure) and is most | |
;;welcomed to be included to Incanter or anything else | |
;;after some bettering (it would be nice to be able | |
;;to push DefaultXYZDatasets into the heat-map-thing | |
;;instead of function + xy-box | |
(ns heatmapfromarray | |
"show an vector-of-vectors without missing important parts of it" | |
(use [incanter core charts])) |
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
;;trivial identites | |
[(+ ?x 0) ?x] | |
[(- ?x 0) ?x] | |
[(* ?x 1) ?x] | |
[(/ ?x 1) ?x] | |
[(* ?x 0) 0] | |
;;Math/pow | |
[(* ?x ?x) (Math/pow ?x 2) ] | |
[(* ?x ?x ?x) (Math/pow ?x 3) ] |