(ns clj-chess.ecn
  "Functions for reading chess games in ECN (extensible chess notation)
  format."
  (:require [clojure.edn :as edn]
            [clojure.java.io :as io])
  (:import (java.io PushbackReader)))

(defn reader
  "Convenience function for creating a java PushbackReader for the given
  file name. Why isn't this included in Clojure?"
  [filename]
  (PushbackReader. (io/reader filename)))

(defn edn-seq
  "A lazy sequence of EDN objects in from the provided reader."
  [rdr]
  (when-let [game (edn/read rdr)]
    (cons game (lazy-seq (edn-seq rdr)))))

(defn game-headers
  "Returns a lazy sequence of the game headers of an ECN file."
  [rdr]
  (map (comp rest second) (edn-seq rdr)))

(defn games-in-file [ecn-file]
  (edn-seq (reader ecn-file)))

(ns clj-chess.ecn
  "Functions for reading chess games in ECN (extensible chess notation)
  format."
  (:require [clojure.edn :as edn]
            [clojure.java.io :as io])
  (:import (java.io PushbackReader)))

(defn reader
  "Convenience function for creating a java PushbackReader for the given
  file name. Why isn't this included in Clojure?"
  [filename]
  (PushbackReader. (io/reader filename)))

(defn edn-seq
  "A lazy sequence of EDN objects in from the provided reader."
  [rdr]
  (when-let [game (edn/read {:eof nil} rdr)]
    (cons game (lazy-seq (edn-seq rdr)))))

(defn game-headers
  "Returns a lazy sequence of the game headers of an ECN file."
  [rdr]
  (map (comp rest second) (edn-seq rdr)))

(defn games-in-file [ecn-file]
  (edn-seq (reader ecn-file)))

Fix EOF bug when reading ECN files.

Fix EOF bug when reading ECN files.


(ns selmer.node
  " Node protocol for the objects that get accum'd in the post-parse vector.
  Same vector that will be processed by the runtime context-aware renderer.
  Currently only TextNodes and FunctionNodes. Anything that requires action
  upon context map data at runtime is handled by a generated anonymous function. "
  (:gen-class))

;; Generic INode protocol

(defprotocol INode
  (render-node [this context-map] "Renders the context"))

;; Implements fn handler for the context map. fn handlers can
;; access any data in the context map.

(deftype FunctionNode [handler]
  INode
  (render-node [this context-map]
    (handler context-map)))

;; Implements dumb text content injection at runtime.

(deftype TextNode [text]
  INode
  (render-node [this context-map]
    text))

(ns selmer.node
  " Node protocol for the objects that get accum'd in the post-parse vector.
  Same vector that will be processed by the runtime context-aware renderer.
  Currently only TextNodes and FunctionNodes. Anything that requires action
  upon context map data at runtime is handled by a generated anonymous function. "
  (:gen-class))

;; Generic INode protocol

(defprotocol INode
  (render-node [this context-map] "Renders the context"))

;; Implements fn handler for the context map. fn handlers can
;; access any data in the context map.

(deftype FunctionNode [handler]
  INode
  (render-node [this context-map]
    (handler context-map)))

;; Implements dumb text content injection at runtime.

(deftype TextNode [text]
  INode
  (render-node [this context-map]
    text)
  (toString [_]
    text))

Add toString implementation to TextNode

Add toString implementation to TextNode

For ease of debugging, REPL interaction etc, add toString
implementation for TextNode which simply returns the node text.


;;;
;;;   Copyright 2015 Ruediger Gad
;;;
;;;   This software is released under the terms of the Eclipse Public License
;;;   (EPL) 1.0. You can find a copy of the EPL at:
;;;   http://opensource.org/licenses/eclipse-1.0.php
;;;

(ns
  ^{:author "Ruediger Gad",
    :doc "Helper that are primarily used during experiments"}
  dsbdp.experiment-helper
  (:require
    [clojure.walk :refer :all]
    [dsbdp.byte-array-conversion :refer :all]))

(defmacro create-proc-fns
  [fn-1 fn-n n]
  (loop [fns (prewalk-replace {:idx 0} [fn-1])]
    (if (< (count fns) n)
      (recur (conj fns (prewalk-replace {:idx (count fns)} fn-n)))
      (do
        (println "proc-fns-full:" fns)
        fns))))

(defmacro create-no-op-proc-fns
  [n]
  `(create-proc-fns (fn [~'_ ~'_]) (fn [~'_ ~'_]) ~n))

(defmacro create-inc-proc-fns
  [n]
  `(create-proc-fns (fn [~'i ~'_] (inc ~'i)) (fn [~'_ ~'o] (inc ~'o)) ~n))

;;;
;;;   Copyright 2015 Ruediger Gad
;;;
;;;   This software is released under the terms of the Eclipse Public License
;;;   (EPL) 1.0. You can find a copy of the EPL at:
;;;   http://opensource.org/licenses/eclipse-1.0.php
;;;

(ns
  ^{:author "Ruediger Gad",
    :doc "Helper that are primarily used during experiments"}
  dsbdp.experiment-helper
  (:require
    [clojure.walk :refer :all]
    [dsbdp.byte-array-conversion :refer :all]))

(defmacro create-proc-fns
  [fn-1 fn-n n]
  (loop [fns (prewalk-replace {:idx 0} [fn-1])]
    (if (< (count fns) n)
      (recur (conj fns (prewalk-replace {:idx (count fns)} fn-n)))
      (do
        (println "proc-fns-full:" fns)
        (println "proc-fns-short:" (.replaceAll (str fns) "(?<=\\()([a-zA-Z\\.\\-]++/)" ""))
        fns))))

(defmacro create-no-op-proc-fns
  [n]
  `(create-proc-fns (fn [~'_ ~'_]) (fn [~'_ ~'_]) ~n))

(defmacro create-inc-proc-fns
  [n]
  `(create-proc-fns (fn [~'i ~'_] (inc ~'i)) (fn [~'_ ~'o] (inc ~'o)) ~n))

Use string replacement to display short version of proc-fns.


(ns clj-ravendb.client-deleting-indexes-test
  (:require [clojure.test :refer :all]
            [clj-ravendb.client :refer :all]
            [clj-ravendb.requests :as req]
            [clj-ravendb.responses :as res]
            [clj-ravendb.config :refer :all]))

(let [caching-client (client ravendb-url ravendb-database {:caching :aggressive :ssl-insecure? true :oauth-url oauth-url :api-key api-key})
      client (client ravendb-url ravendb-database {:ssl-insecure? true :oauth-url oauth-url :api-key api-key})]
  (doseq [i ["test-index" "test-index2"]]
    (put-index! client {:index i
                        :where [[:== :name "TestDocument"]]
                        :select [:name]}))
  (deftest test-delete-index-returns-correct-status-code
    (testing "deleting an index returns the correct status code"
      (let [actual (delete-index! client "test-index")
            expected 204]
        (is (= expected (actual :status))))))

  (deftest test-delete-index-returns-correct-status-code-when-using-caching-client
    (testing "deleting an index returns the correct status code"
      (let [actual (delete-index! caching-client "test-index2")
            expected 204]
        (is (= expected (actual :status)))))))

(ns clj-ravendb.client-deleting-indexes-test
  (:require [clojure.test :refer :all]
            [clj-ravendb.client :refer :all]
            [clj-ravendb.requests :as req]
            [clj-ravendb.responses :as res]
            [clj-ravendb.config :refer :all]))

(let [caching-client (client ravendb-url ravendb-database {:caching :aggressive :ssl-insecure? true :oauth-url oauth-url :api-key api-key})
      client (client ravendb-url ravendb-database {:ssl-insecure? true :oauth-url oauth-url :api-key api-key})
      indexes [(str "test-index" (System/currentTimeMillis)) (str "test-index" (System/currentTimeMillis))]]
  (doseq [i indexes]
    (put-index! client {:index i
                        :where [[:== :name "TestDocument"]]
                        :select [:name]}))
  (deftest test-delete-index-returns-correct-status-code
    (testing "deleting an index returns the correct status code"
      (let [actual (delete-index! client (first indexes))
            expected 204]
        (is (= expected (actual :status))))))

  (deftest test-delete-index-returns-correct-status-code-when-using-caching-client
    (testing "deleting an index returns the correct status code"
      (let [actual (delete-index! caching-client (second indexes))
            expected 204]
        (is (= expected (actual :status)))))))

Create indexes with more unique names because of concurrent testing in travis.


(ns tixi.mutators.delete
  (:require [tixi.data :as d]
            [tixi.mutators.shared :as msh]
            [tixi.mutators.locks :as ml]
            [tixi.mutators.undo :as mu]
            [tixi.items :as i]))

(defn delete-items! [ids]
  (when (not-empty ids)
    (mu/snapshot!)
    (doseq [id ids]
      (ml/delete-from-locks! id (d/completed-item id))
      (msh/update-state! update-in [:completed] dissoc id))))

(ns tixi.mutators.delete
  (:require [tixi.data :as d]
            [tixi.mutators.shared :as msh]
            [tixi.mutators.locks :as ml]
            [tixi.mutators.undo :as mu]
            [tixi.items :as i]))

(defn delete-items! [ids]
  (when (not-empty ids)
    (mu/snapshot!)
    (doseq [id ids]
      (swap! d/data update-in [:cache] dissoc id)
      (ml/delete-from-locks! id (d/completed-item id))
      (msh/update-state! update-in [:completed] dissoc id))))

Remove cache when deleting an item

Remove cache when deleting an item


(ns etcd-clojure.core-test
  (:require [clojure.test :refer :all]
            [etcd-clojure.core :as etcd]))

(defn setup-test []
  (etcd/connect! "http://127.0.0.1:4001"))
(defn teardown-test []
  (println "teardown"))

(defn once-fixtures [f]
  (setup-test)
  (try
    (f)
    (finally (teardown-test))))

(use-fixtures :once once-fixtures)

(deftest test-set
  (testing "should set a value"
    (is (= "bar" (get (etcd/set "foo" "bar") "value")))))

(deftest test-create
  (testing "should set a value"
    (is (= "bar" (get (etcd/create "foo" "bar") "value")))))

(deftest test-delete
  (testing "should delete a value"
    (etcd/set "foo" "bar")
    (is (= "DELETE" (get (etcd/delete "foo") "action")))))

(deftest test-get
  (testing "should get a value"
    (etcd/set "foo" "bar")
    (is (= "bar" (etcd/get "foo")))))

(ns etcd-clojure.core-test
  (:require [clojure.test :refer :all]
            [etcd-clojure.core :as etcd]))

(defn setup-test []
  (etcd/connect! "http://127.0.0.1:4001"))
(defn teardown-test []
  (println "teardown"))

(defn once-fixtures [f]
  (setup-test)
  (try
    (f)
    (finally (teardown-test))))

(use-fixtures :once once-fixtures)

(deftest test-set
  (testing "should set a value"
    (is (= "bar" (get (etcd/set "foo" "bar") "value")))))

(deftest test-create
  (testing "should set a value"
    (is (= "bar" (get (etcd/create "foo" "bar") "value")))))

(deftest test-delete
  (testing "should delete a value"
    (etcd/set "foo" "bar")
    (is (= "delete" (get (etcd/delete "foo") "action")))))

(deftest test-get
  (testing "should get a value"
    (etcd/set "foo" "bar")
    (is (= "bar" (etcd/get "foo")))))

Delete to lower case to allow tests to pass


(ns dna)

(defn- strand-convert [ch]
    (cond
        (= \T ch) \U
        :else ch
        )
)

(defn to-rna [dna]
    (apply str (map strand-convert dna))
)

(ns dna)

(defn- strand-convert [ch]
    (if (= \T ch) \U ch)
)

(defn to-rna [dna]
    (apply str (map strand-convert dna))
)

Use if instead of cond

Use if instead of cond


(ns matross.test.helper
  "Helper functions for writing and running tests"
  (:require [me.raynes.conch :refer [with-programs]]
            [matross.connections.ssh :refer [translate-ssh-config ssh-connection]]
            [matross.connections.core :refer [connect disconnect]]))

(defn get-available-vms []
  (with-programs [vagrant grep cut]
    (cut "-f1" "-d "
         (vagrant "status" {:seq true})
         {:seq true})))

(def vagrant-test-connection
  (memoize (fn [] (translate-ssh-config (slurp (System/getenv "TEST_SSH_CONF"))))))

(defmacro task-tests
  "Evaluate the body against the test vm connection, exposed as conn"
  [conn & body]

  `(let [~conn (ssh-connection (vagrant-test-connection))]
     (connect ~conn)
     ~@body
     (disconnect ~conn)))

(ns matross.test.helper
  "Helper functions for writing and running tests"
  (:require [me.raynes.conch :refer [with-programs]]
            [matross.connections.ssh :refer [translate-ssh-config ssh-connection]]
            [matross.connections.debug :refer [debug-connection]]
            [matross.connections.core :refer [connect disconnect]]))

(defn get-available-vms []
  (with-programs [vagrant grep cut]
    (cut "-f1" "-d "
         (vagrant "status" {:seq true})
         {:seq true})))

(def vagrant-test-connection
  (memoize (fn [] (translate-ssh-config (slurp (System/getenv "TEST_SSH_CONF"))))))

(defn test-connection []
  (let [conn (ssh-connection (vagrant-test-connection))]
    (if-let [debug (System/getenv "TEST_DEBUG")]
      (debug-connection conn)
      conn)))

(defmacro task-tests
  "Evaluate the body against the test vm connection, exposed as conn"
  [conn & body]

  `(let [~conn (test-connection)]
     (connect ~conn)
     ~@body
     (disconnect ~conn)))

Allow debug output during tests.

Allow debug output during tests.

if the env var TEST_DEBUG is set, debug output will be enabled during
the test runs.


(ns ^:figwheel-always re-view.core
  (:require [clojure.string :as string]))

(defn parse-name [n]
  (str (name (ns-name *ns*)) "/" n))

(defmacro defview
  ([view-name methods]
   `(def ~view-name
      (~'re-view.core/view ~(assoc methods
                              :display-name (str (last (string/split (name (ns-name *ns*)) #"\.")) "/" view-name)))))
  ([view-name a1 a2 & body]
   (let [[methods args body] (if (map? a1)
                               [a1 a2 body]
                               [{} a1 (cons a2 body)])]
     `(~'re-view.core/defview ~view-name
        ~(assoc methods :render `(~'fn ~args (~'re-view.hiccup/element (do ~@body))))))))

(ns ^:figwheel-always re-view.core
  (:require [clojure.string :as string]))

(defn parse-name [n]
  (str (name (ns-name *ns*)) "/" n))

(defmacro defview
  ([view-name methods]
   `(def ~view-name
      (~'re-view.core/view (assoc ~methods
                             :display-name ~(str (last (string/split (name (ns-name *ns*)) #"\.")) "/" view-name)))))
  ([view-name a1 a2 & body]
   (let [[methods args body] (if (vector? a1)
                               [{} a1 (cons a2 body)]
                               [a1 a2 body])]
     `(~'re-view.core/defview ~view-name
        (~'assoc ~methods :render (~'fn ~args (~'re-view.hiccup/element (do ~@body))))))))

Remove requirement that lifecycle functions must be passed as literal map


(ns dragon.data.sources.core
  (:require [clojure.java.shell :as shell]
            [dragon.config :as config]
            [taoensso.timbre :as log]))

(defn execute-db-command!
  [component]
  (let [start-cfg (config/db-start-config component)
        home (:home start-cfg)
        args (:args start-cfg)]
    (shell/with-sh-dir home
      (log/debugf "Running command in %s ..." home)
      (log/debug "Using shell/sh args:" args)
      (apply shell/sh args))))

(defn remove-connection
  [component]
  (assoc component :conn nil))

(ns dragon.data.sources.core
  (:require [clojure.java.shell :as shell]
            [dragon.config :as config]
            [dragon.util :as util]
            [taoensso.timbre :as log]))

(defn execute-db-command!
  [component]
  (let [start-cfg (config/db-start-config component)
        home (:home start-cfg)
        args (:args start-cfg)]
    (shell/with-sh-dir home
      (log/debugf "Running command in %s ..." home)
      (log/debug "Using shell/sh args:" args)
      (apply util/shell! args))))

(defn remove-connection
  [component]
  (assoc component :conn nil))

Use new logging shell command.

Use new logging shell command.


(ns bytebuf.buffer
  "Buffer abstractions."
  (:import java.nio.ByteBuffer
           io.netty.buffer.ByteBuf
           io.netty.buffer.ByteBufAllocator))

(defprotocol IBuffer
  (read-integer* [_] "Read an integer (32 bits) from buffer.")
  (read-long* [_] "Read an long (64 bits) from buffer.")
  (tell* [_] "Get the current position index of buffer.")
  (seek* [_ val] "Set the current position index on buffer."))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NIO ByteBuffer implementation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(extend-type ByteBuffer
  IBuffer
  (read-integer* [buff]
    (.getInt buff))
  (read-long* [buff]
    (.getLong buff))
  (tell* [buff]
    (.position buff))
  (seek* [buff val]
    (.position buff val)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Public Api
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def ^{:private true}
  allocator (ByteBufAllocator/DEFAULT))

(defn allocate
  ([size] (allocate size {}))
  ([size {:keys [type impl] :or {type :heap impl :nio}}]
   (case impl
     :nio (case type
            :heap (ByteBuffer/allocate size)
            :direct (ByteBuffer/allocateDirect size))
     :netty (case type
              :heap (.heapBuffer allocator size)
              :direct (.directBuffer allocator size)))))

(defn seek!
  "Set the position index on the buffer."
  [buff ^long pos]
  (seek! buff pos))

(ns bytebuf.buffer
  "Buffer abstractions."
  (:import java.nio.ByteBuffer
           io.netty.buffer.ByteBuf
           io.netty.buffer.ByteBufAllocator))

(defprotocol IBuffer
  (read-int [_ pos] "Read an integer (32 bits) from buffer.")
  (write-int [_ pos value] "Write an integer to the buffer.")
  (read-long [_ pos] "Read an long (64 bits) from buffer.")
  (write-long [_ pos value] "Write an long to the buffer."))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; NIO ByteBuffer implementation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(extend-type ByteBuffer
  IBuffer
  (read-integer* [buff]
    (.getInt buff))
  (read-long* [buff]
    (.getLong buff))
  (tell* [buff]
    (.position buff))
  (seek* [buff val]
    (.position buff val)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Public Api
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def ^{:private true}
  allocator (ByteBufAllocator/DEFAULT))

(defn allocate
  ([size] (allocate size {}))
  ([size {:keys [type impl] :or {type :heap impl :nio}}]
   (case impl
     :nio (case type
            :heap (ByteBuffer/allocate size)
            :direct (ByteBuffer/allocateDirect size))
     :netty (case type
              :heap (.heapBuffer allocator size)
              :direct (.directBuffer allocator size)))))

(defn seek!
  "Set the position index on the buffer."
  [buff ^long pos]
  (seek! buff pos))

Change signature of IBuffer related functions.


(ns incise.parsers.html-spec
  (:require [incise.parsers.html :refer :all]
            [incise.parsers.core :refer [map->Parse]]
            [clojure.java.io :refer [file resource]]
            [speclj.core :refer :all]))

(describe "File->Parse"
  (with short-md-file (file (resource "spec/short-sample.md")))
  (it "reads some stuff out of a file, yo"
    (should= (map->Parse {:title "My Short Page"
                          :layout :page
                          :date "2013-08-12"
                          :path "2013/8/12/my-short-page/index.html"
                          :tags [:cool]
                          :category :blarg
                          :content "\n\nHey there!\n"
                          :extension "/index.html"})
             (File->Parse identity @short-md-file))))

(run-specs)

(ns incise.parsers.html-spec
  (:require [incise.parsers.html :refer :all]
            [incise.parsers.core :refer [map->Parse]]
            [clj-time.coerce :refer [to-date]]
            [clojure.java.io :refer [file resource]]
            [speclj.core :refer :all]))

(describe "File->Parse"
  (with short-md-file (file (resource "spec/short-sample.md")))
  (it "reads some stuff out of a file, yo"
    (should= (map->Parse {:title "My Short Page"
                          :layout :page
                          :date (to-date "2013-08-12")
                          :path "2013/8/12/my-short-page/index.html"
                          :tags [:cool]
                          :category :blarg
                          :content "\n\nHey there!\n"
                          :extension "/index.html"})
             (File->Parse identity @short-md-file))))

(run-specs)

Fix html spec to work with coerced dates.


{
 :name "split-filter-fastqs",
 :path "",
 :func (fn [eid & data]
         (if (pg/eoi? eid)
           (pg/done)
           (let [exp (cmn/get-exp-info eid :exp)]
             (infof "Splitting and filtering fastqs by replicates for %s" eid)
             ;; This case dispatching is lame! Need to fix with mmethod
             (case exp
               :tnseq (htts/split-filter-fastqs eid)
               :rnaseq (htrs/split-filter-fastqs eid)
               :wgseq (htws/split-filter-fastqs eid))
             eid)))

 :description "Uses experiment id EID to obtain set of initial fastqs for experiment and then splits them by experiment sample barcodes and filters these for quality, then writes new fastqs for all replicates.",
}

{
 :name "split-filter-fastqs",
 :path "",
 :func (fn [eid & data]
         (if (pg/eoi? eid)
           (pg/done)
           (let [exp (cmn/get-exp-info eid :exp)]
             (infof "Splitting and filtering fastqs by replicates for %s" eid)
             ;; This case dispatching is lame! Need to fix with mmethod
             (case exp
               :tnseq (htts/split-filter-fastqs eid)
               :rnaseq (htrs/split-filter-fastqs eid)
               :termseq (httm/split-filter-fastqs eid)
               :wgseq (htws/split-filter-fastqs eid))
             eid)))

 :description "Uses experiment id EID to obtain set of initial fastqs for experiment and then splits them by experiment sample barcodes and filters these for quality, then writes new fastqs for all replicates.",
}

Support Term-Seq. Shows even more why should be refactored to multimethods!


(ns org.scode.sob
  (:gen-class)
  (:require [org.scode.sob.markdown :as markdown]
            [clojure.contrib.command-line :as cmdline]
            [clojure.contrib.logging :as logging]
            [ring.adapter.jetty])
  (:use [org.scode.sob.repos :as repos]))

(defn die [msg]
  (logging/fatal msg)
  (System/exit 1))

(defn make-blog-app
  [port base path]
  (let [repos (repos/new path)]
    (fn [req]
      {:status 200
       :headers {"Content-Type" "text/html"}
       :body (str req)})))

(defn serve-blog
  "Start serving a blog at http://*:port/base."
  [port base path]
  (logging/info (str "starting sob on *:" port base ", serving " path))
  (ring.adapter.jetty/run-jetty (make-blog-app port base path) {:port port}))

(defn -main [& args]
  (cmdline/with-command-line args
    "sob - scode's own blog"
    [[port     "Select listen port" 8081]
     [base     "Select base URI path" "/"]
     paths]
    (if (> 1 (count paths))
      (die "only one file system path currently supported"))
    (if (empty? paths)
      (die "must specify the path to a blog"))
    (serve-blog port base (first paths))))

(ns org.scode.sob
  (:gen-class)
  (:require [org.scode.sob.markdown :as markdown]
            [clojure.contrib.command-line :as cmdline]
            [clojure.contrib.logging :as logging]
            [ring.adapter.jetty])
  (:use [org.scode.sob.repos :as repos]))

(defn die [msg]
  (logging/fatal msg)
  (System/exit 1))

(defn make-blog-app
  [base path]
  (let [repos (repos/new path)]
    (fn [req]
      {:status 200
       :headers {"Content-Type" "text/html"}
       :body (str req)})))

(defn serve-blog
  [port app]
  (ring.adapter.jetty/run-jetty app {:port port}))

(defn -main [& args]
  (cmdline/with-command-line args
    "sob - scode's own blog"
    [[port     "Select listen port" 8081]
     [base     "Select base URI path" "/"]
     paths]
    (if (> 1 (count paths))
      (die "only one file system path currently supported"))
    (if (empty? paths)
      (die "must specify the path to a blog"))
    (logging/info (str "starting sob on *:" port base))
    (serve-blog port (make-blog-app base (first paths)))))

Move functionality out of serve-blog.

Move functionality out of serve-blog.


(ns audio-utils.recorder
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [audio-utils.util :refer [audio-context get-user-media]]
            [audio-utils.gate :as g]))

(defui Recorder
  Object
  (start [this]
    (let [audio-ctx (audio-context)
          gate      (g/gate {:audio-ctx audio-ctx})]
      (om/update-state! this assoc
                        :audio-ctx audio-ctx
                        :gate gate)
      (get-user-media {:audio true}
                      #(.connect-audio-nodes this %)
                      js/console.warn)))

  (connect-audio-nodes [this stream]
    (let [{:keys [audio-ctx gate]} (om/get-state this)
          source                   (.createMediaStreamSource audio-ctx
                                                             stream)]
      (.connect source (.-destination audio-ctx))))

  (stop [this]
    (let [audio-ctx (:audio-ctx (om/get-state this))]
      (.close audio-ctx)
      (om/update-state! this dissoc :audio-ctx)))

  (componentWillReceiveProps [this new-props]
    (when (not= (:record? (om/props this))
                (:record? new-props))
      (if (:record? new-props)
        (.start this)
        (.stop this))))

  (render [this]
    (dom/div nil)))

(def recorder (om/factory Recorder))

(ns audio-utils.recorder
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [audio-utils.util :refer [audio-context get-user-media]]
            [audio-utils.gate :as g]))

(defui Recorder
  Object
  (start [this]
    (let [audio-ctx (audio-context)
          gate      (g/gate {:audio-ctx audio-ctx})]
      (om/update-state! this assoc
                        :audio-ctx audio-ctx
                        :gate gate)
      (get-user-media {:audio true}
                      #(.connect-audio-nodes this %)
                      js/console.warn)))

  (connect-audio-nodes [this stream]
    (let [{:keys [audio-ctx gate]} (om/get-state this)
          source                   (.createMediaStreamSource audio-ctx
                                                             stream)]
      (.connect source gate)
      (.connect gate (.-destination audio-ctx))))

  (stop [this]
    (let [audio-ctx (:audio-ctx (om/get-state this))]
      (.close audio-ctx)
      (om/update-state! this dissoc :audio-ctx)))

  (componentWillReceiveProps [this new-props]
    (when (not= (:record? (om/props this))
                (:record? new-props))
      (if (:record? new-props)
        (.start this)
        (.stop this))))

  (render [this]
    (dom/div nil)))

(def recorder (om/factory Recorder))

Insert the gate into the mix

Insert the gate into the mix


(defproject thinktopic/cortex "0.1.0-SNAPSHOT"
  :description "A neural network toolkit for Clojure."
  :dependencies [[org.clojure/clojure "1.8.0-RC4"]
                 [com.taoensso/timbre "4.2.0"]
                 [net.mikera/vectorz-clj "0.40.0"]
                 [org.clojure/test.check "0.9.0"]]

  :jvm-opts  ["-Xmx8g"
              "-XX:+UseConcMarkSweepGC"
              "-XX:-OmitStackTraceInFastThrow"])

(defproject thinktopic/cortex "0.1.0-SNAPSHOT"
  :description "A neural network toolkit for Clojure."
  :dependencies [[org.clojure/clojure "1.8.0-RC5"]
                 [com.taoensso/timbre "4.2.0"]
                 [net.mikera/vectorz-clj "0.40.0"]
                 [org.clojure/test.check "0.9.0"]]

  :jvm-opts  ["-Xmx8g"
              "-XX:+UseConcMarkSweepGC"
              "-XX:-OmitStackTraceInFastThrow"])

Update to latest Clojure RC5

Update to latest Clojure RC5


(defproject com.stuartsierra/component "0.2.2"
  :description "Managed lifecycle of stateful objects"
  :url "https://github.com/stuartsierra/component"
  :license {:name "The MIT License"
            :url "http://opensource.org/licenses/MIT"}
  :min-lein-version "2.1.3"  ; added :global-vars
  :dependencies [[com.stuartsierra/dependency "0.1.1"]]
  :global-vars {*warn-on-reflection* true}
  :aliases {"test-all"
            ["with-profile" "clj1.4:clj1.5:clj1.6:clj1.7" "test"]}
  :profiles {:dev {:dependencies [[org.clojure/clojure "1.6.0"]
                                  [org.clojure/tools.namespace "0.2.4"]]
                   :source-paths ["dev"]}
             :clj1.7 {:dependencies [[org.clojure/clojure "1.7.0-master-SNAPSHOT"]]
                      :repositories {"sonatype-oss-public"
                                     "https://oss.sonatype.org/content/groups/public"}}
             :clj1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
             :clj1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
             :clj1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}})

(defproject com.stuartsierra/component "0.2.3-SNAPSHOT"
  :description "Managed lifecycle of stateful objects"
  :url "https://github.com/stuartsierra/component"
  :license {:name "The MIT License"
            :url "http://opensource.org/licenses/MIT"}
  :min-lein-version "2.1.3"  ; added :global-vars
  :dependencies [[com.stuartsierra/dependency "0.1.1"]]
  :global-vars {*warn-on-reflection* true}
  :aliases {"test-all"
            ["with-profile" "clj1.4:clj1.5:clj1.6:clj1.7" "test"]}
  :profiles {:dev {:dependencies [[org.clojure/clojure "1.6.0"]
                                  [org.clojure/tools.namespace "0.2.4"]]
                   :source-paths ["dev"]}
             :clj1.7 {:dependencies [[org.clojure/clojure "1.7.0-master-SNAPSHOT"]]
                      :repositories {"sonatype-oss-public"
                                     "https://oss.sonatype.org/content/groups/public"}}
             :clj1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
             :clj1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
             :clj1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}})

Prepare for develoment version 0.2.3-SNAPSHOT


(defproject me.manuelp/confunion "0.1.1-SNAPSHOT"
  :description "Library for managing configuration based on EDN files."
  :url "http://github.com/manuelp/confunion"
  :license {:name "Eclipse Public License"
            :url  "http://www.eclipse.org/legal/epl-v10.html"}
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.2.6"]]
  :plugins [[lein-marginalia "0.7.1"]]

  :source-paths ["src/clojure"]
  :test-paths ["test/clojure"]
  :java-source-paths ["src/java"]
  :javac-options ["-target" "1.7"
                  "-source" "1.7"])

(defproject me.manuelp/confunion "0.1.1"
  :description "Library for managing configuration based on EDN files."
  :url "http://github.com/manuelp/confunion"
  :license {:name "Eclipse Public License"
            :url  "http://www.eclipse.org/legal/epl-v10.html"}
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.2.6"]]
  :plugins [[lein-marginalia "0.7.1"]]

  :source-paths ["src/clojure"]
  :test-paths ["test/clojure"]
  :java-source-paths ["src/java"]
  :javac-options ["-target" "1.6"
                  "-source" "1.6"])

Set source and target javac to 1.6

Set source and target javac to 1.6


;(defproject cli4clj "1.2.5"
(defproject cli4clj "1.2.6-SNAPSHOT"
  :description "Create simple interactive CLIs for Clojure applications."
  :url "https://github.com/ruedigergad/cli4clj"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [clj-assorted-utils "1.15.0"]
                 [jline/jline "2.14.2"]]
  :global-vars {*warn-on-reflection* true}
  :html5-docs-docs-dir "ghpages/doc"
  :html5-docs-ns-includes #"^cli4clj.*"
  :html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master"
  :test2junit-output-dir "ghpages/test-results"
  :test2junit-run-ant true
  :main cli4clj.example
  :plugins [[lein-cloverage "1.0.2"] [test2junit "1.2.5"] [lein-html5-docs "3.0.3"]]
  :profiles  {:repl  {:dependencies  [[jonase/eastwood "0.2.3" :exclusions  [org.clojure/clojure]]]}}
)

(defproject cli4clj "1.2.6"
;(defproject cli4clj "1.2.6-SNAPSHOT"
  :description "Create simple interactive CLIs for Clojure applications."
  :url "https://github.com/ruedigergad/cli4clj"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [clj-assorted-utils "1.17.1"]
                 [jline/jline "2.14.2"]]
  :global-vars {*warn-on-reflection* true}
  :html5-docs-docs-dir "ghpages/doc"
  :html5-docs-ns-includes #"^cli4clj.*"
  :html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master"
  :test2junit-output-dir "ghpages/test-results"
  :test2junit-run-ant true
  :main cli4clj.example
  :plugins [[lein-cloverage "1.0.2"] [test2junit "1.2.5"] [lein-html5-docs "3.0.3"]]
  :profiles  {:repl  {:dependencies  [[jonase/eastwood "0.2.3" :exclusions  [org.clojure/clojure]]]}}
)

Update dependencies and version info and deploy to clojars.


(defproject kiries "0.1.0-SNAPSHOT"
  :description "A bundled deployment of Kibana, Riemann, and ElasticSearch"
  :license "Eclipse Public License v1.0"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.cli "0.2.1"]
                 [clj-logging-config "1.9.6"]

                 [riemann "0.2.2"]
                 [clj-time "0.6.0"]
                 [clojurewerkz/elastisch "1.2.0"]
                 [org.elasticsearch/elasticsearch "0.90.3"]

                 [compojure "1.1.5"]
                 [hiccup "1.0.4"]
                 [org.markdownj/markdownj "0.3.0-1.0.2b4"]
                 [ring/ring-core "1.2.0"]
                 [ring/ring-jetty-adapter "1.2.0"]

                 [clojure-csv/clojure-csv "1.3.2"]
                 ]
  :resource-paths ["." "resources"]
  :jar-exclusions [#"^htdocs"]
  :main kiries.core
  :aliases {"server" ["trampoline" "run" "-m" "kiries.core"]})

(defproject kiries "0.1.0-SNAPSHOT"
  :description "A bundled deployment of Kibana, Riemann, and ElasticSearch"
  :license "Eclipse Public License v1.0"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.cli "0.2.1"]
                 [clj-logging-config "1.9.6"]

                 [riemann "0.2.2"]
                 [clj-time "0.6.0"]
                 [clojurewerkz/elastisch "1.2.0"]
                 [org.elasticsearch/elasticsearch "0.90.3"]

                 [compojure "1.1.5"]
                 [hiccup "1.0.4"]
                 [org.markdownj/markdownj "0.3.0-1.0.2b4"]
                 [ring/ring-core "1.2.0"]
                 [ring/ring-devel "1.2.0"]
                 [ring/ring-jetty-adapter "1.2.0"]

                 [clojure-csv/clojure-csv "1.3.2"]
                 ]
  :resource-paths ["." "resources"]
  :jar-exclusions [#"^htdocs"]
  :main kiries.core
  :aliases {"server" ["trampoline" "run" "-m" "kiries.core"]})

Add ring-devel for reload win.

Add ring-devel for reload win.


(defproject cli4clj "1.5.2"
;(defproject cli4clj "1.5.3-SNAPSHOT"
  :description "Create simple interactive CLIs for Clojure applications."
  :url "https://github.com/ruedigergad/cli4clj"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [clj-assorted-utils "1.18.2"]
                 [org.clojure/core.async "0.4.474"]
                 [jline/jline "2.14.6"]]
  :global-vars {*warn-on-reflection* true}
  :html5-docs-docs-dir "ghpages/doc"
  :html5-docs-ns-includes #"^cli4clj.*"
  :html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master"
  :test2junit-output-dir "ghpages/test-results"
  :test2junit-run-ant true
  :main cli4clj.example
  :plugins [[lein-cloverage "1.0.2"] [test2junit "1.3.3"] [lein-html5-docs "3.0.3"]]
  :profiles  {:repl  {:dependencies  [[jonase/eastwood "0.2.6" :exclusions  [org.clojure/clojure]]]}}
)

;(defproject cli4clj "1.5.2"
(defproject cli4clj "1.5.3-SNAPSHOT"
  :description "Create simple interactive CLIs for Clojure applications."
  :url "https://github.com/ruedigergad/cli4clj"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [clj-assorted-utils "1.18.2"]
                 [org.clojure/core.async "0.4.474"]
                 [jline/jline "2.14.6"]]
  :global-vars {*warn-on-reflection* true}
  :html5-docs-docs-dir "ghpages/doc"
  :html5-docs-ns-includes #"^cli4clj.*"
  :html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master"
  :test2junit-output-dir "ghpages/test-results"
  :test2junit-run-ant true
  :main cli4clj.example
  :plugins [[lein-cloverage "1.0.2"] [test2junit "1.3.3"] [lein-html5-docs "3.0.3"]]
  :profiles  {:repl  {:dependencies  [[jonase/eastwood "0.2.6" :exclusions  [org.clojure/clojure]]]}}
)

Revert back to snapshot version.

Revert back to snapshot version.


(defproject onyx-app/lein-template "0.10.0.0-alpha6"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

(defproject onyx-app/lein-template "0.10.0.0-SNAPSHOT"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

Prepare for next release cycle.

Prepare for next release cycle.


(ns time-tracker.fixtures
  (:require [clojure.java.jdbc :as jdbc]
            [time-tracker.migration :refer [migrate-db]]
            [time-tracker.db :as db]
            [time-tracker.core :refer [app]]
            [time-tracker.auth.core :as auth]
            [time-tracker.auth.test-helpers :refer [fake-token->credentials]]
            [environ.core :as environ]
            [time-tracker.config :as config])
  (:use org.httpkit.server))

(defn init! [f]
  (time-tracker.core/init!)
  (f))

(defn destroy-db []
  (jdbc/execute! config/db-spec [(str "DROP OWNED BY " (environ/env :test-db-username))]))

(defn migrate-test-db [f]
  (migrate-db)
  (f)
  (destroy-db))

(defn serve-app [f]
  (with-redefs [auth/token->credentials
                fake-token->credentials]
    (let [stop-fn (run-server app {:port 8000})]
      (f)
      (stop-fn :timeout 100))))

(defn isolate-db [f]
  (jdbc/with-db-transaction [conn (db/connection)]
    (jdbc/db-set-rollback-only! conn)
    (with-redefs [db/connection (fn [] conn)]
      (f))))

(ns time-tracker.fixtures
  (:require [clojure.java.jdbc :as jdbc]
            [time-tracker.migration :refer [migrate-db]]
            [time-tracker.db :as db]
            [time-tracker.core :refer [app]]
            [time-tracker.auth.core :as auth]
            [time-tracker.auth.test-helpers :refer [fake-token->credentials]]
            [environ.core :as environ]
            [time-tracker.config :as config])
  (:use org.httpkit.server))

(defn init! [f]
  (time-tracker.core/init!)
  (f))

(defn destroy-db []
  (jdbc/with-db-transaction [conn (db/connection)]
    (jdbc/execute! conn "DROP SCHEMA IF EXISTS public CASCADE;")
    (jdbc/execute! conn "CREATE SCHEMA IF NOT EXISTS public;")))

(defn migrate-test-db [f]
  (migrate-db)
  (f)
  (destroy-db))

(defn serve-app [f]
  (with-redefs [auth/token->credentials
                fake-token->credentials]
    (let [stop-fn (run-server app {:port 8000})]
      (f)
      (stop-fn :timeout 100))))

(defn isolate-db [f]
  (jdbc/with-db-transaction [conn (db/connection)]
    (jdbc/db-set-rollback-only! conn)
    (with-redefs [db/connection (fn [] conn)]
      (f))))

Drop all tables only within the test database.

- Do NOT drop by owner, since that might affect tables outside of the
  test database.


(ns incise.layouts.core
  (:refer-clojure :exclude [get]))

(def layouts (atom {}))

(defn exists?
  "Check for the existance of a layout with the given name."
  [layout-with-name]
  (contains? @layouts layout-with-name))

(defn get [& args]
  (apply clojure.core/get @layouts args))

(defn register
  "Register a layout function to a shortname"
  [short-name layout-fn]
  (swap! layouts
         assoc (str short-name) layout-fn))

(ns incise.layouts.core
  (:refer-clojure :exclude [get]))

(def layouts (atom {}))

(defn exists?
  "Check for the existance of a layout with the given name."
  [layout-with-name]
  (contains? @layouts (name layout-with-name)))

(defn get [layout-name]
  (@layouts (name layout-name)))

(defn register
  "Register a layout function to a shortname"
  [short-name layout-fn]
  (swap! layouts
         assoc (name short-name) layout-fn))

Make layouts use strings by calling name.


(ns kiries.layout
  (:use hiccup.core)
  (:use hiccup.page))

(defn full-layout [title & content]
  (html5
   [:head
    (include-css "/kibana/common/css/bootstrap.dark.min.css")
    (include-css "/kibana/common/css/bootstrap-responsive.min.css")
    (include-css "/kibana/common/css/font-awesome.min.css")
    [:title title]]
   [:body
    [:div.container-fluid.main
     [:div.row-fluid
      content]]]))

(ns kiries.layout
  (:use hiccup.core)
  (:use hiccup.page))

(defn full-layout [title & content]
  (html5
   [:head
    (include-css "/kibana/common/css/bootstrap.light.min.css")
    (include-css "/kibana/common/css/bootstrap-responsive.min.css")
    (include-css "/kibana/common/css/font-awesome.min.css")
    [:title title]]
   [:body
    [:div.container-fluid.main
     [:div.row-fluid
      content]]]))

Use ligher theme from Kibana for docs.

Use ligher theme from Kibana for docs.


(defproject onyx-app/lein-template "0.12.0.0-rc2"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

(defproject onyx-app/lein-template "0.12.0.0-SNAPSHOT"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

Prepare for next release cycle.

Prepare for next release cycle.


(ns zetawar.util
  (:require
    [fipp.edn]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Accessors

(defn solo
  "Like first, but throws if more than one item."
  [coll]
  (assert (not (next coll)))
  (first coll))

(defn only
  "Like first, but throws unless exactly one item."
  [coll]
  (assert (not (next coll)))
  (if-let [result (first coll)]
    result
    (assert false)))

(defn ssolo
  "Same as (solo (solo coll))"
  [coll]
  (solo (solo coll)))

(defn oonly
  "Same as (only (only coll))"
  [coll]
  (only (only coll)))

;; TODO: check performance
(defn select-values [m ks]
  (reduce #(if-let [v (m %2)] (conj %1 v) %1) [] ks))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Debugging

;; TODO: refer to https://github.com/shaunlebron/How-To-Debug-CLJS/blob/master/src/example/macros.clj

(defn spy [x]
  (js/console.debug
    (with-out-str
      (fipp.edn/pprint x)))
  x)

(ns zetawar.util
  (:require
   [fipp.edn]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Accessors

(defn solo
  "Like first, but throws if more than one item."
  [coll]
  (assert (not (next coll)))
  (first coll))

(defn only
  "Like first, but throws unless exactly one item."
  [coll]
  (assert (not (next coll)))
  (if-let [result (first coll)]
    result
    (assert false)))

(defn ssolo
  "Same as (solo (solo coll))"
  [coll]
  (solo (solo coll)))

(defn oonly
  "Same as (only (only coll))"
  [coll]
  (only (only coll)))

(defn select-values
  "Returns a vector containing only those values who's key is in ks."
  [m ks]
  (reduce #(if-let [v (m %2)] (conj %1 v) %1) [] ks))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Debugging

;; TODO: refer to https://github.com/shaunlebron/How-To-Debug-CLJS/blob/master/src/example/macros.clj

(defn spy [x]
  (js/console.debug
   (with-out-str
     (fipp.edn/pprint x)))
  x)

Remove old TODO + add docstring for select-values


(ns haystack.search-test
  (:require [haystack.search :as sut :refer [search]]
            ;; [clojure.test :as t :refer :all]

            [haystack.helpers :refer :all]
            ))

(test-search
 matnrs-check
 {:search "2843977 2542450"}
 (max-docs 50)
 (in-top 2843977 2)
 (in-top 2542450 2)
 )

(test-search
 upcs-check
 {:search "078477045442 980100350109"}
 (max-docs 500)
 (in-top 199152 2)
 (in-top 2542450 2)
 )

(test-search
 copper-clip-check
 {:search "copper clip" :num-per-page 100}
 (max-docs 100)
 (in-top 20127 100)   ;; "copper" and "clip" not in the same field
 (in-top 3336524 100) ;; "clip" is in the part number
 )

Add copper clip search test.

Add copper clip search test.


(ns com.draines.postal.core
  (:use [com.draines.postal.sendmail :only [sendmail-send]]
        [com.draines.postal.smtp :only [smtp-send]]))

(defn send-message [msg]
  (when-not (and (:from msg)
                 (:to msg)
                 (:subject msg)
                 (:body msg))
    (throw (Exception. "message needs at least :from, :to, :subject, and :body")))
  (if (:host msg)
    (smtp-send msg)
    (sendmail-send msg)))

(ns com.draines.postal.core
  (:use [com.draines.postal.sendmail :only [sendmail-send]]
        [com.draines.postal.smtp :only [smtp-send]]))

(defn send-message [msg]
  (when-not (and (:from msg)
                 (:to msg)
                 (:subject msg)
                 (:body msg))
    (throw (Exception. "message needs at least :from, :to, :subject, and :body")))
  (if (:host ^msg)
    (smtp-send msg)
    (sendmail-send msg)))

Check msg meta to determine sendmail or SMTP.


(ns braid.search.ui.search-bar
  (:require
   [reagent.core :as r]
   [re-frame.core :refer [subscribe dispatch]]
   [braid.core.client.routes :as routes]
   [braid.lib.color :as color]))

(defn search-bar-view
  []
  (r/with-let [search-query (r/atom @(subscribe [:braid.search/query]))
               prev-page (r/atom (:type @(subscribe [:page])))]
    (let [current-page (:type @(subscribe [:page]))]
      (when (not= @prev-page current-page)
        (when (= @prev-page :search)
          (reset! search-query ""))
        (reset! prev-page current-page)))
    [:div.search-bar
     [:input {:type "text"
              :placeholder "Search..."
              :value @search-query
              :on-change
              (fn [e]
                (reset! search-query (.. e -target -value))
                (dispatch [:braid.search/update-query! (.. e -target -value)]))}]
     (if (and @search-query (not= "" @search-query))
       [:a.action.clear
        {:on-click (fn [] (reset! search-query ""))
         :href (routes/group-page-path {:group-id @(subscribe [:open-group-id])
                                        :page-id "inbox"})
         :style {:color (color/->color @(subscribe [:open-group-id]))}}]
       [:div.action.search])]))

(ns braid.search.ui.search-bar
  (:require
   [reagent.core :as r]
   [re-frame.core :refer [subscribe dispatch]]
   [braid.core.client.routes :as routes]
   [braid.lib.color :as color]))

(defn search-bar-view
  []
  (r/with-let [search-query (r/atom @(subscribe [:braid.search/query]))
               prev-page (r/atom (:type @(subscribe [:page])))]
    (let [current-page (:type @(subscribe [:page]))]
      (when (not= @prev-page current-page)
        (if (= @prev-page :search)
          (reset! search-query "")
          (reset! search-query @(subscribe [:braid.search/query])))
        (reset! prev-page current-page)))
    [:div.search-bar
     [:input {:type "text"
              :placeholder "Search..."
              :value @search-query
              :on-change
              (fn [e]
                (reset! search-query (.. e -target -value))
                (dispatch [:braid.search/update-query! (.. e -target -value)]))}]
     (if (and @search-query (not= "" @search-query))
       [:a.action.clear
        {:on-click (fn [] (reset! search-query ""))
         :href (routes/group-page-path {:group-id @(subscribe [:open-group-id])
                                        :page-id "inbox"})
         :style {:color (color/->color @(subscribe [:open-group-id]))}}]
       [:div.action.search])]))

[search] Fix coming to search page via link not setting bar text


(defproject onyx-app/lein-template "0.9.9.0"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

(defproject onyx-app/lein-template "0.9.9.1-SNAPSHOT"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

Prepare for next release cycle.

Prepare for next release cycle.


(defproject ktra-indexer "0.1.0-SNAPSHOT"
  :description "A simple application for indexing and searching KTRA track
  listings"
  :url "https://github.com/terop/ktra-indexer"
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [compojure "1.5.1"]
                 [ring/ring-defaults "0.2.1"]
                 [ring/ring-devel "1.5.0"]
                 [org.immutant/web "2.1.5"]
                 [selmer "1.0.7"]
                 [cheshire "5.6.3"]
                 [org.postgresql/postgresql "9.4.1207"]
                 [org.clojure/java.jdbc "0.6.1"]
                 [honeysql "0.7.0"]
                 [clj-time "0.12.0"]
                 [buddy/buddy-auth "1.1.0"]
                 [com.yubico/yubico-validation-client2 "3.0.1"]
                 [org.apache.commons/commons-lang3 "3.4"]]
  :main ktra-indexer.handler
  :aot [ktra-indexer.handler]
  :plugins [[lein-environ "1.0.3"]]
  :profiles
  {:dev {:dependencies [[ring/ring-mock "0.3.0"]]
         :resource-paths ["resources"]
         :env {:squiggly {:checkers [:eastwood :kibit :typed]}}}})

(defproject ktra-indexer "0.1.0-SNAPSHOT"
  :description "A simple application for indexing and searching KTRA track
  listings"
  :url "https://github.com/terop/ktra-indexer"
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [compojure "1.5.1"]
                 [ring/ring-defaults "0.2.1"]
                 [ring/ring-devel "1.5.0"]
                 [org.immutant/web "2.1.5"]
                 [selmer "1.0.7"]
                 [cheshire "5.6.3"]
                 [org.postgresql/postgresql "9.4.1209"]
                 [org.clojure/java.jdbc "0.6.1"]
                 [honeysql "0.7.0"]
                 [clj-time "0.12.0"]
                 [buddy/buddy-auth "1.1.0"]
                 [com.yubico/yubico-validation-client2 "3.0.1"]
                 [org.apache.commons/commons-lang3 "3.4"]]
  :main ktra-indexer.handler
  :aot [ktra-indexer.handler]
  :plugins [[lein-environ "1.0.3"]]
  :profiles
  {:dev {:dependencies [[ring/ring-mock "0.3.0"]]
         :resource-paths ["resources"]
         :env {:squiggly {:checkers [:eastwood :kibit :typed]}}}})

Update PostgreSQL JDBC library dependency

The version now used requires JDK 8 to work. Instructions for older
versions can be found at https://github.com/pgjdbc/pgjdbc.


(defproject stencil "0.3.0-SNAPSHOT"
  :description "Mustache in Clojure"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [scout "0.1.0"]
                 [slingshot "0.8.0"]
                 [org.clojure/core.cache "0.5.0"]]
  :profiles {:dev {:dependencies [[org.clojure/data.json "0.1.2"]]}
             :clj1.2 {:dependencies [[org.clojure/clojure "1.2.1"]]}
             :clj1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
             :clj1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}}
  :extra-files-to-clean ["test/spec"])

(defproject stencil "0.3.0-SNAPSHOT"
  :description "Mustache in Clojure"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [scout "0.1.0"]
                 [slingshot "0.8.0"]
                 [org.clojure/core.cache "0.6.1"]]
  :profiles {:dev {:dependencies [[org.clojure/data.json "0.1.2"]]}
             :clj1.2 {:dependencies [[org.clojure/clojure "1.2.1"]]}
             :clj1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
             :clj1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}}
  :extra-files-to-clean ["test/spec"])

Change core.cache version to 0.6.1.

Change core.cache version to 0.6.1.


(defproject io.aviso/rook "0.1.4"
  :description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps"
  :url "https://github.com/AvisoNovate/rook"
  :license {:name "Apache Sofware Licencse 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  ;; Normally we don't AOT compile; only when tracking down reflection warnings.
  :profiles {:reflection-warnings {:aot         :all
                                   :global-vars {*warn-on-reflection* true}}
             :dev {:dependencies [[ring-mock "0.1.5"]]}}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.2.6"]
                 [compojure "1.1.6"]]
  :plugins [[test2junit "1.0.1"]])

(defproject io.aviso/rook "0.1.5-SNAPSHOT"
  :description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps"
  :url "https://github.com/AvisoNovate/rook"
  :license {:name "Apache Sofware Licencse 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  ;; Normally we don't AOT compile; only when tracking down reflection warnings.
  :profiles {:reflection-warnings {:aot         :all
                                   :global-vars {*warn-on-reflection* true}}
             :dev {:dependencies [[ring-mock "0.1.5"]]}}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.2.6"]
                 [compojure "1.1.6"]]
  :plugins [[test2junit "1.0.1"]])

Set development version to 0.1.5-SNAPSHOT


(defproject cljam "0.1.2"
  :description "A DNA Sequence Alignment/Map (SAM) library for Clojure"
  :url "https://chrovis.github.io/cljam"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.2.6"]
                 [org.clojure/tools.cli "0.3.1"]
                 [me.raynes/fs "1.4.5"]
                 [pandect "0.3.2"]
                 [clj-sub-command "0.2.0"]
                 [bgzf4j "0.1.0"]]
  :plugins [[lein-midje "3.1.3"]
            [lein-bin "0.3.4"]
            [lein-marginalia "0.7.1"]]
  :profiles {:dev {:dependencies [[midje "1.6.3"]
                                  [criterium "0.4.3"]
                                  [cavia "0.1.2"]
                                  [primitive-math "0.1.3"]]
                   :global-vars {*warn-on-reflection* true}}}
  :main cljam.main
  :aot [cljam.main]
  :bin {:name "cljam"}
  :repl-options {:init-ns user})

(defproject cljam "0.1.3-SNAPSHOT"
  :description "A DNA Sequence Alignment/Map (SAM) library for Clojure"
  :url "https://chrovis.github.io/cljam"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.2.6"]
                 [org.clojure/tools.cli "0.3.1"]
                 [me.raynes/fs "1.4.5"]
                 [pandect "0.3.2"]
                 [clj-sub-command "0.2.0"]
                 [bgzf4j "0.1.0"]]
  :plugins [[lein-midje "3.1.3"]
            [lein-bin "0.3.4"]
            [lein-marginalia "0.7.1"]]
  :profiles {:dev {:dependencies [[midje "1.6.3"]
                                  [criterium "0.4.3"]
                                  [cavia "0.1.2"]
                                  [primitive-math "0.1.3"]]
                   :global-vars {*warn-on-reflection* true}}}
  :main cljam.main
  :aot [cljam.main]
  :bin {:name "cljam"}
  :repl-options {:init-ns user})

Prepare for next development iteration (0.1.3-SNAPSHOT)


(ns circle.backend.test-build
  (:use midje.sweet)
  (:use [circle.backend.build.test-utils :only (minimal-build)])
  (:use circle.model.build))

(fact "checkout-dir handles spaces"
  (let [b (minimal-build :build_num 42)]
    (checkout-dir b) => "Dummy-Project-42"))

(fact "ensure-project-id works"
  (let [b (minimal-build)]
    @b => (contains {:_project_id truthy})))

(ns circle.backend.test-build
  (:use midje.sweet)
  (:use [circle.backend.build.test-utils :only (minimal-build)])
  (:use circle.model.build))

(fact "checkout-dir handles spaces"
  (let [b (minimal-build)]
    (checkout-dir b) => #"Dummy-Project-\d+"))

(fact "ensure-project-id works"
  (let [b (minimal-build)]
    @b => (contains {:_project_id truthy})))

Fix "checkout-dir handles spaces" test by checking what is being tested better.


(println "Map Function Tests")

(is (= (map inc [1 2 3]) [2 3 4]))

(println "Map Function Tests")

(is (= (map inc [1 2 3]) '(2 3 4)))

Fix result in is test

Fix result in is test


(ns blocks.store.replica-test
  (:require
    (blocks.store
      [memory :refer [memory-store]]
      [replica :refer [replica-store]]
      [tests :refer [test-block-store]])
    [clojure.test :refer :all]))

; TODO: test that writes actually populate all backing stores.
; TODO: test that removing blocks from one store still returns all blocks.
; TODO: test that listing provides merged block list.

(deftest ^:integration test-replica-store
  (let [store (replica-store [(memory-store) (memory-store)])]
    (test-block-store
      "replica-store" store
      :max-size 1024
      :blocks 25)))

(ns blocks.store.replica-test
  (:require
    [blocks.core :as block]
    (blocks.store
      [memory :refer [memory-store]]
      [replica :refer [replica-store]]
      [tests :refer [test-block-store]])
    [clojure.test :refer :all]))

(deftest replica-behavior
  (let [replica-1 (memory-store)
        replica-2 (memory-store)
        store (replica-store [replica-1 replica-2])
        a (block/read! "foo bar baz")
        b (block/read! "abracadabra")
        c (block/read! "123 xyz")]
    (block/put! store a)
    (block/put! store b)
    (block/put! store c)
    (is (= 3 (count (block/list replica-1))))
    (is (every? (partial block/get replica-1)
                (map :id [a b c]))
        "all blocks are stored in replica-1")
    (is (= 3 (count (block/list replica-2))))
    (is (every? (partial block/get replica-2)
                (map :id [a b c]))
        "all blocks are stored in replica-2")
    (is (= 3 (count (block/list store))))
    (block/delete! replica-1 (:id a))
    (block/delete! replica-2 (:id c))
    (is (= 3 (count (block/list store)))
        "replica lists all available blocks")))

(deftest ^:integration test-replica-store
  (let [store (replica-store [(memory-store) (memory-store)])]
    (test-block-store
      "replica-store" store
      :max-size 1024
      :blocks 25)))

Add tests for replication behavior.

Add tests for replication behavior.


(ns example.one-bar-sequencer
  (:use overtone.live))

(def metro (metronome 128))

; Our bar is a map of beat to instruments to play

(def bar {0   [kick]
          0.5 [c-hat]
          1   [kick snare]
          1.5 [c-hat]
          2   [kick]
          2.5 [c-hat]
          3   [kick snare]
          3.5 [c-hat]})

; For every tick of the metronome, we loop through all our beats
; and find the apropriate one my taking the metronome tick mod 4.
; Then we play all the instruments for that beat.

(defn player
  [tick]
  (dorun
    (for [k (keys bar)]
      (let [beat (Math/floor k)
            offset (- k beat)]
           (if (= 0 (mod (- tick beat) 4))
               (let [instruments (bar k)]
                    (dorun
                      (for [instrument instruments]
                         (at (metro (+ offset tick)) (instrument))))))))))

(ns example.one-bar-sequencer
  (:use [overtone.live]
        [overtone.inst drum]))

(def metro (metronome 128))

; Our bar is a map of beat to instruments to play

(def bar {0   [kick]
          0.5 [c-hat]
          1   [kick snare]
          1.5 [c-hat]
          2   [kick]
          2.5 [c-hat]
          3   [kick snare]
          3.5 [c-hat]})

; For every tick of the metronome, we loop through all our beats
; and find the apropriate one my taking the metronome tick mod 4.
; Then we play all the instruments for that beat.

(defn player
  [tick]
  (dorun
    (for [k (keys bar)]
      (let [beat (Math/floor k)
            offset (- k beat)]
           (if (= 0 (mod (- tick beat) 4))
               (let [instruments (bar k)]
                    (dorun
                      (for [instrument instruments]
                        (at (metro (+ offset tick)) (instrument))))))))))

;; define a run fn which will call our player fn for each beat and will schedule
;; itself to be called just before the next beat

(defn run
  [m]
  (let [beat (m)]
    (player beat)
    (apply-at (m (inc beat))  #'run [m])))

;; make beats!
(run metro)

;; stop
(stop)

Fix up one bar sequencer

Fix up one bar sequencer


; Copyright 2009 Howard M. Lewis Ship
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;   http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
; implied. See the License for the specific language governing permissions
; and limitations under the License.

(ns cascade.utils)

(defmacro lcond
	"A reimplementation of Clojure's cond, with the addition of a special :let
	keyword that injects an implicit let into the logic."
	[& clauses]
	(when clauses
		(if (= 1 (count clauses))
			(throw (IllegalArgumentException. "lcond requires an even number of forms")))
			(let
				[tst (first clauses)
				 expr (second clauses)
				 rst (next (next clauses))]
				 (if (= tst :let)
				 	`(let [~@expr] (lcond ~@rst))
				 	`(if ~tst ~expr (lcond ~@rst))))))

; Copyright 2009 Howard M. Lewis Ship
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;   http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
; implied. See the License for the specific language governing permissions
; and limitations under the License.

(ns cascade.utils
	(:use
		(clojure.contrib pprint macro-utils)))

(defmacro lcond
	"A reimplementation of Clojure's cond, with the addition of a special :let
	keyword that injects an implicit let into the logic."
	[& clauses]
	(when clauses
		(if (= 1 (count clauses))
			(throw (IllegalArgumentException. "lcond requires an even number of forms")))
			(let
				[tst (first clauses)
				 expr (second clauses)
				 rst (next (next clauses))]
				 (if (= tst :let)
				 	`(let [~@expr] (lcond ~@rst))
				 	`(if ~tst ~expr (lcond ~@rst))))))

(defmacro debug-form
	"Expands all macros in a form, recursively, and prints the result. Returns nil."
	[form]
	`(pprint (mexpand-all '~form)))

Add debug-form macro, which expands and pretty-prints an unevaluated form.


;; This is usefull to display the functions, ask the user for the
;; input parameters, and then execute them, presenting the result to
;; the user.
;; Intended to expose the functions in a Browser, but it could be
;; anything else: command line, rich client, ...
;;
(ns fnx.meta.expose
  "Get the public functions of a namespace"
  (:use [midje.sweet]))

;;
;; * First we load the ns with `require`
;; * Then we get the public functions (read from bottom to top):
;; * We want only functions, not the other vars: We can spot them because they have an `:arglists` in their meta.
;; * Don't really know why, but we need to `ns-resolve` the symbols(?)
;; * Get the public vars with `ns-publics`
;;
(defn ns-public-fn
  "Given a ns symbol, returns all the public fns of this ns."
  [ns] (do (require ns)
           (filter #(:arglists (meta %))
                   (map #(ns-resolve ns %)
                        (keys (ns-publics (find-ns ns)))))))

(fact "ns-public-fn"
      (second (ns-public-fn 'fnx.meta.example)) => (resolve 'fnx.meta.example/hello-noir))

(fact "ns-public-fn: listing functions and calling them (it's more an example of usage than a true test)"
      (map (fn [f] (apply f
                         (range 0 (count (first (:arglists (meta f)))))))
           (ns-public-fn 'fnx.meta.example)) => ["arg=0", "Hello noir" "args=0,1"])

;; This is usefull to display the functions, ask the user for the
;; input parameters, and then execute them, presenting the result to
;; the user.
;; Intended to expose the functions in a Browser, but it could be
;; anything else: command line, rich client, ...
;;
(ns fnx.meta.expose
  "Get the public functions of a namespace"
  (:use [midje.sweet]))

;;
;; * First we load the ns with `require`
;; * Then we get the public functions (read from bottom to top):
;; * We want only functions, not the other vars: We can spot them because they have an `:arglists` in their meta.
;; * Get the public vars with `ns-publics`
;;
(defn ns-public-fn
  "Given a ns symbol, returns all the public fns of this ns."
  [ns] (do (require ns)
           (filter #(:arglists (meta %))
                   (vals (ns-publics (find-ns ns))))))

(fact "ns-public-fn"
      (second (ns-public-fn 'fnx.meta.example)) => (resolve 'fnx.meta.example/hello-noir))

(fact "ns-public-fn: listing functions and calling them (it's more an example of usage than a true test)"
      (map (fn [f] (apply f
                         (range 0 (count (first (:arglists (meta f)))))))
           (ns-public-fn 'fnx.meta.example)) => ["arg=0", "Hello noir" "args=0,1"])

Simplify so that we do not need to map the ns-resolve methods.


(ns vinculum.main
  (:require [vinculum.core :as core]))

(core/main)

(ns vinculum.main
  (:require [vinculum.core :as core]))

(js/console.log "Starting production mode CLJS!")
(core/main)

Make sure it warns when running production-mode code.


(ns pfrt.main
  (:require [pfrt.pf :refer [packet-filter]]
            [pfrt.web :refer [web-server]]
            [pfrt.core.app :as app]
            [pfrt.settings :as settings])
  (:gen-class))

;; Global var, only used for store
;; a global app instance when this is
;; used from REPL.
(def main-app nil)

;; System private constructor with
;; clear and explicit dependency injection
;; on each app components.
(defn- make-app []
  (let [config    (settings/cfg)
        pf        (packet-filter config)
        webserver (web-server config pf)]
    (-> (app/->App [pf webserver])
        (assoc :config config)
        (app/init))))

;; Start function that should
;; only be used from REPL.
(defn start []
  (alter-var-root #'main-app
    (constantly (make-app)))
  (start main-app))

;; Stop function that should
;; only be used from REPL.
(defn stop []
  (app/stop main-app))

;; Main entry point
(defn -main
  [& args]
  (let [app-instance (make-app)]
    (app/start app-instance)
    (println "Application started.")))

(ns pfrt.main
  (:require [pfrt.pf :refer [packet-filter]]
            [pfrt.web :refer [web-server]]
            [pfrt.core.app :as app]
            [pfrt.settings :as settings])
  (:gen-class))

;; Global var, only used for store
;; a global app instance when this is
;; used from REPL.
(def main-app nil)

;; System private constructor with
;; clear and explicit dependency injection
;; on each app components.
(defn- make-app []
  (let [config    (settings/cfg)
        pf        (packet-filter config)
        webserver (web-server config pf)]
    (-> (app/->App [pf webserver])
        (assoc :config config)
        (app/init))))

;; Start function that should
;; only be used from REPL.
(defn start []
  (alter-var-root #'main-app
    (constantly (make-app)))
  (start main-app))

;; Stop function that should
;; only be used from REPL.
(defn stop []
  (app/stop main-app))

;; Helper function that executes
;; stop and start.
(defn restart []
  (start)
  (stop))

;; Main entry point
(defn -main
  [& args]
  (let [app-instance (make-app)]
    (app/start app-instance)
    (println "Application started.")))

Add repl restart function helper.

Add repl restart function helper.


(ns cglossa.core
  (:require [reagent.core :as reagent :refer [atom]]
            [plumbing.core :as plumbing :refer [map-vals]]
            [cglossa.centre :as centre]))

(def state {:showing-results false})

(def data {:categories ["ku" "hest"]
           :users      ["per" "kari"]})

(defonce app-state (into {} (map-vals atom state)))
(defonce app-data (into {} (map-vals atom data)))

(defn navbar []
  [:div.navbar.navbar-fixed-top [:div.navbar-inner [:div.container [:span.brand "Glossa"]]]])

(defn bottom [_ {:keys [categories]}]
  [:div (for [cat @categories]
     [:div cat])])

(defn app [s d]
  [:div
   [navbar]
   [:div.container-fluid
    [centre/top s d]]
   [bottom s d]])

(defn ^:export main []
  (reagent/render-component
    (fn []
      [app app-state app-data])
    (. js/document (getElementById "app"))))

(ns cglossa.core
  (:require [reagent.core :as reagent :refer [atom]]
            [plumbing.core :as plumbing :refer [map-vals]]
            [cglossa.centre :as centre]))

(def state {:showing-results false})

(def data {:categories ["ku" "hest"]
           :users      ["per" "kari"]})

(defonce app-state (into {} (map-vals atom state)))
(defonce app-data (into {} (map-vals atom data)))

(defn header []
  [:div.navbar.navbar-fixed-top [:div.navbar-inner [:div.container [:span.brand "Glossa"]]]])

(defn footer [_ {:keys [categories]}]
  [:div (for [cat @categories]
     [:div cat])])

(defn app [s d]
  [:div
   [header]
   [:div.container-fluid
    [centre/top s d]
    [centre/bottom s d]]
   [footer s d]])

(defn ^:export main []
  (reagent/render-component
    (fn []
      [app app-state app-data])
    (. js/document (getElementById "app"))))

Rename to header and footer

Rename to header and footer


(ns ^{:doc "When this library is loaded, create a logger named
'events' and send all application-specific events to it.

To view log messages in the browser console, add a call
to `(log/console-output)` to this namespace or evaluate this from the
REPL.

For more information see library.logging."}
  one.repmax.logging
  (:require [one.dispatch :as dispatch]
            [one.logging :as log]))

(def ^{:doc "The logger that receives all application-specific events."}
  logger (log/get-logger "events"))

(dispatch/react-to (constantly true)
                   (fn [t d] (log/info logger (str (pr-str t) " - " (pr-str d)))))

;; log to the console
(log/start-display (log/console-output))

(ns ^{:doc "When this library is loaded, create a logger named 'events'.

           See comments at end of file for example usage.

           For more information see one.logging."}
  one.repmax.logging
  (:require [one.dispatch :as dispatch]
            [one.logging :as log]))

(def ^{:doc "The logger that receives all application-specific events."}
  logger (log/get-logger "events"))

(defn log!
  "Create a new reaction that will react to ALL events and log them to the
  given logger.

  WARNING: For events that have a large amount of data (which is the case for
  most :model-change events in One Rep Max), sending these events to the logger
  has a significant negative performance impact on the application. You are
  recommended to log events ONLY For debugging purposes."
  [logger]
  (dispatch/react-to (constantly true)
                     (fn [t d] (log/info logger (str (pr-str t) " - " (pr-str d))))))

(comment

  ;; register a reaction that will react to ALL events and log them to the 'events' logger
  (def logging-reaction (log! logger))

  ;; send the the log output to the console
  (log/start-display (log/console-output))

  ;; stop logging events
  (dispatch/delete-reaction logging-reaction)

  ;; change the logging level
  (log/set-level logger :fine)

  )

Allow enabling/disabling of logger in running app

Loading the one.repmax.logging namespace no longer automatically creates
a reaction for logging events. Logging :model-change events has a hugely
negative impact on performance (e.g., filtering the exercise list is
about 2 orders of magnitude slower when :model-change events are being
sent to the logger). To avoid this performance hit, logging is disabled
by default; it can be enabled on demand when needed.


(defproject ring/ring-jetty-adapter "1.9.1"
  :description "Ring Jetty adapter."
  :url "https://github.com/ring-clojure/ring"
  :scm {:dir ".."}
  :license {:name "The MIT License"
            :url "http://opensource.org/licenses/MIT"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [ring/ring-core "1.9.1"]
                 [ring/ring-servlet "1.9.1"]
                 [org.eclipse.jetty/jetty-server "9.4.36.v20210114"]]
  :aliases {"test-all" ["with-profile" "default:+1.8:+1.9:+1.10" "test"]}
  :profiles
  {:dev  {:dependencies [[clj-http "3.10.0"]
                         [less-awful-ssl "1.0.6"]]
          :jvm-opts ["-Dorg.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT=500"]}
   :1.8  {:dependencies [[org.clojure/clojure "1.8.0"]]}
   :1.9  {:dependencies [[org.clojure/clojure "1.9.0"]]}
   :1.10 {:dependencies [[org.clojure/clojure "1.10.2"]]}})

(defproject ring/ring-jetty-adapter "1.9.1"
  :description "Ring Jetty adapter."
  :url "https://github.com/ring-clojure/ring"
  :scm {:dir ".."}
  :license {:name "The MIT License"
            :url "http://opensource.org/licenses/MIT"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [ring/ring-core "1.9.1"]
                 [ring/ring-servlet "1.9.1"]
                 [org.eclipse.jetty/jetty-server "9.4.38.v20210224"]]
  :aliases {"test-all" ["with-profile" "default:+1.8:+1.9:+1.10" "test"]}
  :profiles
  {:dev  {:dependencies [[clj-http "3.10.0"]
                         [less-awful-ssl "1.0.6"]]
          :jvm-opts ["-Dorg.eclipse.jetty.server.HttpChannelState.DEFAULT_TIMEOUT=500"]}
   :1.8  {:dependencies [[org.clojure/clojure "1.8.0"]]}
   :1.9  {:dependencies [[org.clojure/clojure "1.9.0"]]}
   :1.10 {:dependencies [[org.clojure/clojure "1.10.2"]]}})

Update Jetty dependency to 9.4.38

Update Jetty dependency to 9.4.38

Fixes #433.

See: https://snyk.io/vuln/SNYK-JAVA-ORGECLIPSEJETTY-1080611


(ns structural-typing.validators
  "Validators. These differ from Bouncer validators in that (1) they default to optional, and
   (2) the messages include the failing value."
  (:require [bouncer.validators :as v]))

(defmacro defoptional [name doc message-format & body]
  `(do
     (v/defvalidator ~name {:optional true
                            :default-message-format ~message-format} ~@body)
     (alter-meta! (var ~name) assoc :doc ~doc)))

(v/defvalidator ^{:doc "Fails if key is missing or its value is `nil`."} required
  {:default-message-format "%s must be present and non-nil"}
  [v]
  (not (nil? v)))

(defoptional number
  "Validates against optional `number?`"
  "%s is `%s`, which is not a number"
  [maybe-a-number]
  (number? maybe-a-number))

(ns structural-typing.validators
  "Validators. These differ from Bouncer validators in that (1) they default to optional, and
   (2) the messages include the failing value."
  (:require [bouncer.validators :as v]))

(defmacro defoptional
  "Define a validator for an optional argument.

       (defoptional number
         \"Validates against optional `number?`\" ; doc string
         \"%s is `%s`, which is not a number\"
         [maybe-a-number]
         (number? maybe-a-number))
"
  [name doc message-format arglist & body]
  `(do
     (v/defvalidator ~name {:optional true
                            :default-message-format ~message-format} ~arglist ~@body)
     (alter-meta! (var ~name) assoc :doc ~doc
                                    :arglists (list '~arglist))))

(v/defvalidator ^{:doc "Fails if key is missing or its value is `nil`."} required
  {:default-message-format "%s must be present and non-nil"}
  [v]
  (not (nil? v)))

(defoptional number
  "Validates against optional `number?`"
  "%s is `%s`, which is not a number"
  [maybe-a-number]
  (number? maybe-a-number))

Make validator arglists available to codox


(ns arachnida.core)

(require '[clojure.java.jdbc :as jdbc])

(require '[clojure.pprint     :as pprint])

(require '[hozumi.rm-rf       :as rm-rf])

(require '[ring.adapter.jetty      :as jetty])
(require '[ring.middleware.params  :as http-params])
(require '[ring.util.response      :as http-response])
(require '[ring.middleware.cookies :as cookies])

(require '[hiccup.page :as page])
(require '[hiccup.form :as form])

(require '[arachnida.db-spec       :as db-spec])
(require '[arachnida.db-interface  :as db-interface])
(require '[arachnida.git-data-fetcher  :as git-data-fetcher])

(defn -main
    [& args]
    (git-data-fetcher/process))

(ns arachnida.core)

(require '[clojure.tools.cli      :as cli])

(require '[clojure.java.jdbc :as jdbc])

(require '[clojure.pprint     :as pprint])

(require '[hozumi.rm-rf       :as rm-rf])

(require '[ring.adapter.jetty      :as jetty])
(require '[ring.middleware.params  :as http-params])
(require '[ring.util.response      :as http-response])
(require '[ring.middleware.cookies :as cookies])

(require '[hiccup.page :as page])
(require '[hiccup.form :as form])

(require '[arachnida.db-spec       :as db-spec])
(require '[arachnida.db-interface  :as db-interface])
(require '[arachnida.git-data-fetcher  :as git-data-fetcher])

(def cli-options
  [["-h" "--help"    "help"                   :id :help]
   ["-g" "--git"     "fetch GIT statistic"    :id :git]
   ["-s" "--server"  "run as HTTP server"     :id :server]])

(defn show-help
    []
    (println "Usage:")
    (println "-h" "--help      help")
    (println "-g" "--git       fetch GIT statistic")
    (println "-s" "--server    run as HTTP server"))

(defn show-error
    []
    (println "Unknown command line option!")
    (show-help))

(defn start-server
    []
    )

(defn -main
    [& args]
    (let [all-options           (cli/parse-opts args cli-options)
          options               (all-options :options)
          show-help?            (options :help)
          git?                  (options :git)
          server?               (options :server)]
        (cond show-help? (show-help)
              git?       (git-data-fetcher/process)
              server?    (start-server)
              :else      (show-error))))

Support for handling basic CLI options: -h, -g, -s etc.


(ns {{namespace}}
  (:require [play-clj.core :refer :all])
  (:import [com.badlogic.gdx.graphics Color]
           [com.badlogic.gdx.graphics.g2d BitmapFont]
           [com.badlogic.gdx.scenes.scene2d.ui Label Label$LabelStyle]))

(defscreen main-screen
  :on-show
  (fn [screen entities]
    (update! screen :renderer (stage))
    (conj entities (label "Hello world!" (color :white))))
  :on-render
  (fn [screen entities]
    (clear!)
    (draw! screen entities)
    entities))

(defgame {{app-name}}
  :on-create
  (fn [this]
    (set-screen! this main-screen)))

(ns {{namespace}}
  (:require [play-clj.core :refer :all]))

(defscreen main-screen
  :on-show
  (fn [screen entities]
    (update! screen :renderer (stage))
    (conj entities (label "Hello world!" (color :white))))
  :on-render
  (fn [screen entities]
    (clear!)
    (draw! screen entities)))

(defgame {{app-name}}
  :on-create
  (fn [this]
    (set-screen! this main-screen)))

Remove unnecessary imports from clojure game template


(ns exploud.numel
  (:require [cemerick.url :refer [url]]
            [cheshire.core :as json]
            [environ.core :refer [env]]
            [exploud.http :as http]))

(def timeout
  "The number of milliseconds we'll wait for a response."
  10000)

(def poke-numel-url
  "The base URL for Numel in poke"
  (url (env :service-numel-poke-url)))

(def prod-numel-url
  "The base URL for Numel in prod"
  (url (env :service-numel-prod-url)))

(defn application-registrations-url
  [environment application]
  (if (= "prod" (name environment))
    (str (url prod-numel-url "1.x" "registration" application))
    (str (url poke-numel-url "1.x" "registration" application))))

(defn application-registrations
  [environment application]
  (let [url (application-registrations-url environment application)
        {:keys [body status] :as response} (http/simple-get url {:socket-timeout timeout})]
    (if (= 200 status)
      (json/parse-string body true)
      (throw (ex-info "Unexpected response" {:type ::unexpected-response :response response})))))

(ns exploud.numel
  (:require [cemerick.url :refer [url]]
            [cheshire.core :as json]
            [environ.core :refer [env]]
            [exploud.http :as http]))

(def timeout
  "The number of milliseconds we'll wait for a response."
  10000)

(def poke-numel-url
  "The base URL for Numel in poke"
  (url (env :service-numel-poke-url)))

(def prod-numel-url
  "The base URL for Numel in prod"
  (url (env :service-numel-prod-url)))

(defn application-registrations-url
  [environment application]
  (if (= "prod" (name environment))
    (str (url prod-numel-url "1.x" "registration" application))
    (str (url poke-numel-url "1.x" "registration" application))))

(defn application-registrations
  [environment application]
  (let [url (application-registrations-url environment application)
        {:keys [body status] :as response} (http/simple-get url {:socket-timeout timeout})]
    (cond (= 200 status) (json/parse-string body true)
          (= 404 status) nil
          :else (throw (ex-info "Unexpected response" {:type ::unexpected-response :response response})))))

Handle 404 when getting Numel registrations


(ns theatralia.t-core
  (:require [midje.sweet :refer :all]
            [clojure.test.check :as tc]
            [clojure.test.check.generators :as gen]
            [clojure.test.check.properties :as prop]
            [theatralia.core :refer [first-element]]))

;; Credits: http://zotskolf.nl/2014/11/10/testcheckbasics.html
(def prop-first-element-returns-first-element
  (prop/for-all [fst gen/simple-type
                 v (gen/vector gen/simple-type)]
    (= fst (first-element (cons fst v) :default))))

(facts "about `first-element`"
  (fact "it normally returns the first element"
    (first-element [1 2 3] :default) => 1
    (first-element '(1 2 3) :default) => 1
    (tc/quick-check 100 prop-first-element-returns-first-element)
        => (just {:result true :num-tests 100 :seed anything}))

  ;; I'm a little unsure how Clojure types map onto the Lisp I'm used to.
  (fact "default value is returned for empty sequences"
    (first-element [] :default) => :default
    (first-element '() :default) => :default
    (first-element nil :default) => :default
    (first-element (filter even? [1 3 5]) :default) => :default))

(ns theatralia.t-core
  (:require [midje.sweet :refer :all]
            [clojure.test.check :as tc]
            [clojure.test.check.generators :as gen]
            [clojure.test.check.properties :as prop]
            [theatralia.core :refer [first-element]]))

;;; Credits: http://zotskolf.nl/2014/11/10/testcheckbasics.html

(defn quick-check [times]
  (fn [prop]
    ((just {:result true :num-tests times :seed anything})
     (tc/quick-check times prop))))

(facts "about `first-element`"
  (fact "it normally returns the first element"
    (first-element [1 2 3] :default) => 1
    (first-element '(1 2 3) :default) => 1)

  (fact "it returns the first element for lots of vectors"
    (prop/for-all [fst gen/simple-type
                   v (gen/vector gen/simple-type)]
      (= fst (first-element (cons fst v) :default)))
      => (quick-check 100))

  ;; I'm a little unsure how Clojure types map onto the Lisp I'm used to.
  (fact "default value is returned for empty sequences"
    (first-element [] :default) => :default
    (first-element '() :default) => :default
    (first-element nil :default) => :default
    (first-element (filter even? [1 3 5]) :default) => :default))

Add Midje checker for cooperation with test.check

I'm not yet sure where to put it, though. Does test support code belong
in src or test?


(defproject fleetdb "0.2.0-RC1"
  :description "A schema-free database optimized for agile development."
  :url "http://github.com/mmcgrana/fleetdb"
  :source-path "src/clj"
  :java-source-path "src/jvm/"
  :javac-fork "true"
  :dependencies [[org.clojure/clojure "1.1.0"]
                 [org.clojure/clojure-contrib "1.1.0"]
                 [clj-stacktrace "0.1.0"]
                 [net.sf.jopt-simple/jopt-simple "3.2"]
                 [clj-json "0.2.0"]]
  :dev-dependencies [[org.clojars.mmcgrana/lein-clojars "0.5.0"]
                     [org.clojars.mmcgrana/lein-javac "0.1.0"]
                     [clj-unit "0.1.0"]]
  :namespaces [fleetdb.server])

(defproject fleetdb "0.2.0-RC1"
  :description "A schema-free database optimized for agile development."
  :url "http://github.com/mmcgrana/fleetdb"
  :source-path "src/clj"
  :java-source-path "src/jvm/"
  :javac-fork "true"
  :dependencies [[org.clojure/clojure "1.1.0"]
                 [org.clojure/clojure-contrib "1.1.0"]
                 [clj-stacktrace "0.1.2"]
                 [net.sf.jopt-simple/jopt-simple "3.2"]
                 [clj-json "0.2.0"]]
  :dev-dependencies [[org.clojars.mmcgrana/lein-clojars "0.5.0"]
                     [org.clojars.mmcgrana/lein-javac "0.1.0"]
                     [clj-unit "0.1.0"]]
  :namespaces [fleetdb.server])

Use most recent clj-stacktrace version.

Use most recent clj-stacktrace version.


(defproject onyx-app/lein-template "0.9.7.0-alpha8"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

(defproject onyx-app/lein-template "0.9.7.0-SNAPSHOT"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "MIT License"
            :url "http://choosealicense.com/licenses/mit/#"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

Prepare for next release cycle.

Prepare for next release cycle.


(defproject io.aviso/rook "0.1.10-SNAPSHOT"
  :description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps"
  :url "https://github.com/AvisoNovate/rook"
  :license {:name "Apache Sofware License 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :profiles {:dev
              {:dependencies [[ring-mock "0.1.5"]
                              [io.aviso/pretty "0.1.11"]
                              [clj-http "0.9.1"]
                              [speclj "3.0.2"]
                              [log4j "1.2.17"]]}}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/core.async "0.1.278.0-76b25b-alpha"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ring "1.3.0"]
                 [medley "0.4.0"]
                 [ring-middleware-format "0.3.2"]
                 [prismatic/schema "0.2.3"]]
  :plugins [[speclj "3.0.2"]]
  :test-paths ["spec"]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/rook/blob/master/"
          :src-linenum-anchor-prefix "L"
          :defaults                  {:doc/format :markdown}})

(defproject io.aviso/rook "0.1.10-SNAPSHOT"
  :description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps"
  :url "https://github.com/AvisoNovate/rook"
  :license {:name "Apache Sofware License 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :profiles {:dev
              {:dependencies [[ring-mock "0.1.5"]
                              [io.aviso/pretty "0.1.11"]
                              [clj-http "0.9.1"]
                              [speclj "3.0.2"]
                              [log4j "1.2.17"]]}}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/core.async "0.1.303.0-886421-alpha"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ring "1.3.0"]
                 [medley "0.4.0"]
                 [ring-middleware-format "0.3.2"]
                 [prismatic/schema "0.2.3"]]
  :plugins [[speclj "3.0.2"]]
  :test-paths ["spec"]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/rook/blob/master/"
          :src-linenum-anchor-prefix "L"
          :defaults                  {:doc/format :markdown}})

Update to latest version of core.async

Update to latest version of core.async


(defproject statuses "1.0.0-SNAPSHOT"
  :description "Statuses app for innoQ"
  :url "https://github.com/innoq/statuses"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0"
            :distribution :repo
            :comments "A business-friendly OSS license"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [ring "1.3.2"]
                 [compojure "1.3.3"]
                 [clj-time "0.9.0"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/tools.cli "0.3.3"]]
  :pedantic? :abort
  :plugins [[jonase/eastwood "0.2.0"]]
  :profiles {:dev {:dependencies [[ring-mock "0.1.5"]]}
             :uberjar {:aot [statuses.server]}}
  :main statuses.server
  :aliases {"lint" "eastwood"}
  :eastwood {:exclude-linters [:constant-test]})

(defproject statuses "1.0.0-SNAPSHOT"
  :description "Statuses app for innoQ"
  :url "https://github.com/innoq/statuses"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0"
            :distribution :repo
            :comments "A business-friendly OSS license"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [ring "1.4.0"]
                 [compojure "1.3.3"]
                 [clj-time "0.9.0"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/tools.cli "0.3.3"]]
  :pedantic? :abort
  :plugins [[jonase/eastwood "0.2.0"]]
  :profiles {:dev {:dependencies [[ring-mock "0.1.5"]]}
             :uberjar {:aot [statuses.server]}}
  :main statuses.server
  :aliases {"lint" "eastwood"}
  :eastwood {:exclude-linters [:constant-test]})

Update ring from 1.3.2 to 1.4.0

Update ring from 1.3.2 to 1.4.0


{:user {:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]
                  [refactor-nrepl "1.2.0-SNAPSHOT"]]
        :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}

{:user {:plugins [[cider/cider-nrepl "0.11.0-SNAPSHOT"]
                  [refactor-nrepl "1.2.0-SNAPSHOT"]]
        :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}}

Update cider-nrepl version to v0.11.0-SNAPSHOT


(ns re-frame.core
  (:require
    [re-frame.handlers   :as handlers]
    [re-frame.subs       :as subs]
    [re-frame.middleware :as middleware]))

;; --  API  -------

(def register-handler handlers/register)
(def dispatch         handlers/dispatch)
(def dispatch-sync    handlers/dispatch-sync)

(def register-sub  subs/register)
(def subscribe     subs/subscribe)

(def pure        middleware/pure)
(def debug       middleware/debug)
(def undoable    middleware/undoable)
(def path        middleware/path)
(def validate    middleware/validate)
(def trim-v      middleware/trim-v)
; (def log-events  middleware/log-events)

;; --  Convienience  -------

;; virtually ever handler will be pure, make it easy
(defn register-pure-handler
  ([id handler]
    (register-handler id pure handler))
  ([id middleware handler]
    (register-handler id [pure middleware] handler)))

(ns re-frame.core
  (:require
    [re-frame.handlers   :as handlers]
    [re-frame.subs       :as subs]
    [re-frame.middleware :as middleware]))

;; --  API  -------

(def register-handler handlers/register)
(def dispatch         handlers/dispatch)
(def dispatch-sync    handlers/dispatch-sync)

(def register-sub  subs/register)
(def subscribe     subs/subscribe)

(def noop        middleware/noop)
(def pure        middleware/pure)
(def debug       middleware/debug)
(def undoable    middleware/undoable)
(def path        middleware/path)
(def validate    middleware/validate)
(def trim-v      middleware/trim-v)
; (def log-events  middleware/log-events)

;; --  Convienience  -------

;; virtually ever handler will be pure, make it easy
(defn register-pure-handler
  ([id handler]
    (register-handler id pure handler))
  ([id middleware handler]
    (register-handler id [pure middleware] handler)))

(defn comp-middleware
  "Given a vector of middleware, filter out any nils, and use comp to compose.
  v can  be vectors of vectors and will be flattended before use.
  For convienience, if v turns out to already be a function, just return it."
  [v]
  (if (ifn? v)     ;; noop if v is a fucntion
    v
    (do
      (assert  (or (vector? v) (list v))
               (str "re-frame:  compose expects a vector, got: " v))
      (let [v (remove nil? (flatten v))]
        (cond
          (empty? v)       noop
          (= 1 (count v))  (first v)
          :else            (apply comp v))))))

Add new API - a noop middleware - a comp-middleware