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 '[noir.server :as server]) | |
(use 'noir.core 'aleph.http 'lamina.core) | |
(defn async-response [response-channel request] | |
(enqueue response-channel | |
{:status 200 | |
:headers {"content-type" "text/plain"} | |
:body "async response"})) | |
(defpage "/" [] "hey from Noir!") |
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 dsstuff | |
"things i used to do in duckstreams in clojure 1.2.0") | |
;;read-lines from files | |
(defn read-lines-from-file [filename] | |
(with-open [rdr (clojure.java.io/reader filename)] | |
(line-seq rdr))) | |
;;thank you Abhinav Sarkar (http://stackoverflow.com/questions/4118123/read-a-very-large-text-file-into-a-list-in-clojure) |
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 testoi) | |
;; http://api.mongodb.org/java/2.6.3/org/bson/types/ObjectId.html | |
testoi> (import 'org.bson.types.ObjectId) | |
org.bson.types.ObjectId | |
testoi> (ObjectId. "d1700430f92f194fad7ce85a") | |
#<ObjectId d1700430f92f194fad7ce85a> |
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
;; claj's solution to Anagram Finder | |
;; https://4clojure.com/problem/77 | |
(fn [a] | |
(set | |
(map set | |
(filter #(< 1 (count %)) | |
(vals | |
(group-by | |
(fn [b] (reduce conj #{} 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
;; claj's solution to Set Intersection | |
;; https://4clojure.com/problem/81 | |
(fn [a b] (set (filter 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
;; claj's solution to Reverse Interleave | |
;; https://4clojure.com/problem/43 | |
(fn [a b] (map #(take-nth b (drop % a)) (range 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
(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) |
OlderNewer