(defproject net.polyc0l0r/hasch "0.2.0-SNAPSHOT"
  :description "Cryptographic hashing of EDN datastructures."
  :url "http://github.com/ghubber/hasch"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/clojurescript "0.0-2156"]]
  :source-paths ["src/clj" "src/cljs"]
  :plugins [[lein-cljsbuild "1.0.2"]
            [com.keminglabs/cljx "0.3.2"]
            [com.cemerick/austin "0.1.4"]]

  :hooks [cljx.hooks]

  :cljx {:builds [{:source-paths ["src/cljx"]
                   :output-path "target/classes"
                   :rules :clj}

                  {:source-paths ["src/cljx"]
                   :output-path "target/classes"
                   :rules :cljs}]}

  :cljsbuild
  {:builds
   [{:source-paths ["src/cljs"
                    "target/classes"]
     :compiler
     {:output-to "resources/public/js/hasch.js"
      :optimizations :simple
      :pretty-print true}}]})

(defproject net.polyc0l0r/hasch "0.2.0-SNAPSHOT"
  :description "Cryptographic hashing of EDN datastructures."
  :url "http://github.com/ghubber/hasch"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/clojurescript "0.0-2202"]]
  :source-paths ["src/clj" "src/cljs"]
  :plugins [[lein-cljsbuild "1.0.3"]
            [com.keminglabs/cljx "0.3.2"]
            [com.cemerick/austin "0.1.4"]]

  :hooks [cljx.hooks]

  :cljx {:builds [{:source-paths ["src/cljx"]
                   :output-path "target/classes"
                   :rules :clj}

                  {:source-paths ["src/cljx"]
                   :output-path "target/classes"
                   :rules :cljs}]}

  :cljsbuild
  {:builds
   [{:source-paths ["src/cljs"
                    "target/classes"]
     :compiler
     {:output-to "resources/public/js/hasch.js"
      :optimizations :simple
      :pretty-print true}}]})

Bump clojure and cljs versions.

Bump clojure and cljs versions.


(defproject bk1 "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [graphql-clj "0.1.20" :exclusions [org.clojure/clojure]]
                 [ring "1.5.1"]
                 [ring/ring-json "0.4.0"]
                 [ring/ring-defaults "0.2.3"]
                 [ring-cors "0.1.9"]
                 [compojure "1.5.2"]
                 [org.clojure/core.match "0.3.0-alpha4"]
                 [clojure-future-spec "1.9.0-alpha14"]
                 [postgresql "9.3-1102.jdbc41"]
                 [tentacles "0.5.1"]
                 [org.clojure/java.jdbc "0.2.3"]
                 ; https://github.com/barend/java-iban.git
                 [nl.garvelink.oss/iban "1.5.0"]]
  :main ^:skip-aot bk1.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}}
  :plugins [[lein-ring "0.9.7"]]
  :ring {:handler bk1.handler/app :auto-reload? true :port 3002})

(defproject bk1 "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [graphql-clj "0.1.20" :exclusions [org.clojure/clojure]]
                 [ring "1.5.1"]
                 [ring/ring-json "0.4.0"]
                 [ring/ring-defaults "0.2.3"]
                 [ring-cors "0.1.9"]
                 [compojure "1.5.2"]
                 [org.clojure/core.match "0.3.0-alpha4"]
                 [clojure-future-spec "1.9.0-alpha14"]
                 [postgresql "9.3-1102.jdbc41"]
                 [tentacles "0.5.1"]
                 [org.clojure/java.jdbc "0.2.3"]
                 ; https://github.com/barend/java-iban.git
                 [nl.garvelink.oss/iban "1.5.0"]]
  :main ^:skip-aot bk1.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}}
  :plugins [[lein-ring "0.9.7"]
            [cider/cider-nrepl "0.13.0-SNAPSHOT"]]
  :ring {:handler bk1.handler/app
         :auto-reload? true
         :port 3002
         :nrepl {:start? true}})

Add ring nRepl library to enable `M-x cider-connect` from Emacs


(ns reddio-frontend.screens.app
  (:require [re-frame.core :as rf]
            [reddio-frontend.bridge :as bridge]
            [reddio-frontend.screens.shared.header :as header]
            [reddio-frontend.screens.home.top-subreddits :as top-subreddits]))

(defn app []
  [:> bridge/root-provider
   [:div.app
    [header/main]
    [top-subreddits/main {:url-path "/r/listentothis"}]]])

(ns reddio-frontend.screens.app
  (:require [re-frame.core :as rf]
            [reddio-frontend.bridge :as bridge]
            [reddio-frontend.screens.shared.header :as header]
            [reddio-frontend.screens.home.top-subreddits :as top-subreddits]))

(defn app []
  (let [route @(rf/subscribe [:route])]
    [:> bridge/root-provider
     [:div.app
      [header/main]
      (when (= route "/")
        [top-subreddits/main {:url-path "/r/listentothis"}])]]))

Hide top subreddits when route is not home


(defproject org.omcljs/ambly "0.2.0"
  :description "ClojureScript REPL into embedded JavaScriptCore."
  :url "https://github.com/omcljs/ambly"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0-beta3"]
                 [org.clojure/clojurescript "0.0-3269"]
                 [com.github.rickyclarkson/jmdns "3.4.2-r353-1"]])

(defproject org.omcljs/ambly "0.2.0"
  :description "ClojureScript REPL into embedded JavaScriptCore."
  :url "https://github.com/omcljs/ambly"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/clojurescript "0.0-3030"]
                 [com.github.rickyclarkson/jmdns "3.4.2-r353-1"]])

Set to depend on 1.6.0 / 0.0-3030

Set to depend on 1.6.0 / 0.0-3030

There is nothing in Ambly that requires 1.7.0.
Since it is "infrastructure / library" code, specify
oldest supported version. This has an advantage
that it makes it easier for consumers to use
newer versions of Clojure and ClojureScript as
they see fit.


(defproject ring/ring-core "1.6.0-beta4"
  :description "Ring core libraries."
  :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.5.1"]
                 [ring/ring-codec "1.0.1"]
                 [commons-io "2.5"]
                 [commons-fileupload "1.3.1"]
                 [clj-time "0.11.0"]
                 [crypto-random "1.2.0"]
                 [crypto-equality "1.0.0"]]
  :profiles
  {:provided {:dependencies [[javax.servlet/servlet-api "2.5"]]}
   :dev {:dependencies [[javax.servlet/servlet-api "2.5"]]}
   :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
   :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
   :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}})

(defproject ring/ring-core "1.6.0-beta4"
  :description "Ring core libraries."
  :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.5.1"]
                 [ring/ring-codec "1.0.1"]
                 [commons-io "2.5"]
                 [commons-fileupload "1.3.2"]
                 [clj-time "0.11.0"]
                 [crypto-random "1.2.0"]
                 [crypto-equality "1.0.0"]]
  :profiles
  {:provided {:dependencies [[javax.servlet/servlet-api "2.5"]]}
   :dev {:dependencies [[javax.servlet/servlet-api "2.5"]]}
   :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
   :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
   :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}})

Update Commons FileUpload dependency to 1.3.2

This addresses vulnerability: http://www.cvedetails.com/cve/CVE-2016-3092/
Fixes #255.


(defproject cli4clj "1.7.1"
;(defproject cli4clj "1.7.2-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.10.0"]
                 [clj-assorted-utils "1.18.3"]
                 [org.clojure/core.async "0.4.490"]
                 [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
  :aot :all
  :plugins [[lein-cloverage "1.0.2"] [test2junit "1.3.3"] [lein-html5-docs "3.0.3"]]
  :profiles  {:repl  {:dependencies  [[jonase/eastwood "0.3.4" :exclusions  [org.clojure/clojure]]]}}
)

;(defproject cli4clj "1.7.1"
(defproject cli4clj "1.7.2-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.10.0"]
                 [clj-assorted-utils "1.18.3"]
                 [org.clojure/core.async "0.4.490"]
                 [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
  :aot :all
  :plugins [[lein-cloverage "1.0.2"] [test2junit "1.3.3"] [lein-html5-docs "3.0.3"]]
  :profiles  {:repl  {:dependencies  [[jonase/eastwood "0.3.4" :exclusions  [org.clojure/clojure]]]}}
)

Revert back to snapshot version.

Revert back to snapshot version.


;; net utilities
;;
(ns dakait.net)

(defn get-json
  "Sends a get request to the server and gets back with data already EDNed"
  ([path response-cb error-cb]
   (get-json path {} response-cb error-cb))
  ([path params response-cb error-cb]
   (let [r (.get js/jQuery path (clj->js params))]
     (doto r
       (.done (fn [data]
                (response-cb (js->clj data :keywordize-keys true))))
       (.fail (fn [e]
                (error-cb (js->clj (.-responseJSON e) :keywordize-keys true))))))))

(defn http-post
  "Post an HTTP request"
  [path params scb ecb]
  (let [r (.post js/jQuery path (clj->js params))]
    (doto r
      (.success scb)
      (.fail ecb))))

(defn http-delete
  "Post an HTTP delete request"
  [url scb ecb]
  (let [r (.ajax js/jQuery
                 (js-obj "url" url
                         "type" "DELETE"))]
    (doto r
      (.success scb)
      (.fail ecb))))

;; net utilities
;;
(ns dakait.net)

(defn get-json
  "Sends a get request to the server and gets back with data already EDNed"
  ([path response-cb error-cb]
   (get-json path {} response-cb error-cb))
  ([path params response-cb error-cb]
   (let [r (.get js/jQuery path (clj->js params))]
     (doto r
       (.done (fn [data]
                (response-cb (js->clj data :keywordize-keys true))))
       (.fail (fn [e]
                (error-cb (js->clj (.-responseJSON e) :keywordize-keys true))))))))

(defn http-post
  "Post an HTTP request"
  [path params scb ecb]
  (let [r (.ajax js/jQuery
                 (clj->js {:url path
                           :type "POST"
                           :data params}))]
    (doto r
      (.success scb)
      (.fail ecb))))

(defn http-delete
  "Post an HTTP delete request"
  [url scb ecb]
  (let [r (.ajax js/jQuery
                 (clj->js {:url url
                          :type "DELETE"}))]
    (doto r
      (.success scb)
      (.fail ecb))))

Use ajax instead of post (for which externs were failing)


(ns gol.client.bl)

(defn neighbours
  [[x y]]
  (for [dx [-1 0 1] dy [-1 0 1]
        :when (not= 0 dx dy)]
    [(+ dx x) (+ dy y)]))

(defn stepper
  [neighbours birth? survive?]
  (fn [cells]
    (set (for [[loc n] (frequencies (mapcat neighbours cells))
               :when (if (cells loc) (survive? n) (birth? n))]
           loc))))

(def step (stepper neighbours #{3} #{2 3}))

(defn filter-on-viewport
  [bw bh coll]
  (filter (fn [[x y]] (and (< -1 x bw) (< -1 y bh))) coll))

(defn filtered-on-viewport-stepper
  [w h]
  (comp set (partial filter-on-viewport w h) step))

(defn rand-2d
  [width height]
  (cons [(rand-int width) (rand-int height)] (lazy-seq (rand-2d width height))))

(defn rand-population
  [width height]
  (distinct (rand-2d width height)))

(ns gol.client.bl)

(defn neighbours
  [[x y]]
  (for [dx [-1 0 1] dy [-1 0 1]
        :when (not= 0 dx dy)]
    [(+ dx x) (+ dy y)]))

(defn stepper
  [neighbours birth? survive?]
  (fn [cells]
    (set (for [[loc n] (frequencies (mapcat neighbours cells))
               :when (if (cells loc) (survive? n) (birth? n))]
           loc))))

(def step (stepper neighbours #{3} #{2 3}))

(defn filter-on-viewport
  [bw bh coll]
  (filter (fn [[x y]] (and (< -1 x bw) (< -1 y bh))) coll))

(defn filtered-on-viewport-stepper
  [w h]
  (comp set (partial filter-on-viewport w h) step))

(defn rand-2d-seq
  [width height]
  (cons [(rand-int width) (rand-int height)] (lazy-seq (rand-2d-seq width height))))

(defn rand-population
  [width height]
  (distinct (rand-2d-seq width height)))

Rename random 2d sequence generator

Rename random 2d sequence generator


(defproject {{name}} "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "https://example.com/FIXME"
  :dependencies [[com.stuartsierra/component "0.2.2"]
                 [environ "1.0.0"]
                 [org.clojure/clojure "1.7.0"]
                 [prismatic/schema "0.4.3"]]
  :min-lein-version "2.5.0"
  :uberjar-name "{{hyphenated-name}}-standalone.jar"
  :profiles
  {:dev {:dependencies [[org.clojure/tools.namespace "0.2.5"]
                        [reloaded.repl "0.1.0"]]
         :source-paths ["dev"]}
   :uberjar {:aot :all
             :main {{ns}}.main
             :omit-source true}})

(defproject {{name}} "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "https://example.com/FIXME"
  :dependencies [[com.stuartsierra/component "0.2.2"]
                 [environ "1.0.0"]
                 [org.clojure/clojure "1.7.0"]
                 [prismatic/schema "0.4.3"]]
  :main {{ns}}.main
  :min-lein-version "2.5.0"
  :uberjar-name "{{hyphenated-name}}-standalone.jar"
  :profiles
  {:dev {:dependencies [[org.clojure/tools.namespace "0.2.5"]
                        [reloaded.repl "0.1.0"]]
         :source-paths ["dev"]}
   :uberjar {:aot :all
             :omit-source true}})

Define :main for all profiles

Define :main for all profiles


(ns fault.promise
  (:import (fault ResilientPromise Status)
           (clojure.lang IDeref IBlockingDeref IPending ILookup)))

(set! *warn-on-reflection* true)

(defn- status [status-enum]
  (cond
    (= Status/PENDING status-enum) :pending
    (= Status/SUCCESS status-enum) :success
    (= Status/ERROR status-enum) :error
    (= Status/TIMED_OUT status-enum) :time-out))

(deftype CLJResilientPromise [^ResilientPromise promise]
  IDeref
  (deref [_] (.awaitResult promise))
  IBlockingDeref
  (deref
    [_ timeout-ms timeout-val]
    (if (.await promise timeout-ms)
      (.result promise)
      timeout-val))
  IPending
  (isRealized [_]
    (.isDone promise))
  ILookup
  (valAt [this key] (.valAt this key nil))
  (valAt [_ key default]
    (case key
      :status (status (.status promise))
      :result (.result promise)
      :error (.error promise)
      default)))

(ns fault.promise
  (:import (fault ResilientPromise Status)
           (clojure.lang IDeref IBlockingDeref IPending ILookup)))

(set! *warn-on-reflection* true)

(defn- status [status-enum]
  (cond
    (= Status/PENDING status-enum) :pending
    (= Status/SUCCESS status-enum) :success
    (= Status/ERROR status-enum) :error
    (= Status/TIMED_OUT status-enum) :timed-out))

(deftype CLJResilientPromise [^ResilientPromise promise]
  IDeref
  (deref [_] (or (.awaitResult promise) (.error promise) :timed-out))
  IBlockingDeref
  (deref
    [_ timeout-ms timeout-val]
    (if (.await promise timeout-ms)
      (or (.result promise) (.error promise) :timed-out)
      timeout-val))
  IPending
  (isRealized [_]
    (.isDone promise))
  ILookup
  (valAt [this key] (.valAt this key nil))
  (valAt [_ key default]
    (case key
      :status (status (.status promise))
      :result (.result promise)
      :error (.error promise)
      default)))

Return results in Clojurish manner

Return results in Clojurish manner


(ns kosha.app.search
  (:require [kosha.db.search :as db-search]
            [kosha.app.util :as util]))

(def no-of-results (util/get-config :api :search-results))

(defn get-results
  "Retrieves 2n best matches for given ragam or kriti name."
  [query n]
  (let [ragams (future (db-search/ragams query n))
        kritis (future (db-search/kritis query n))]
    (util/json-response (into [] (concat @ragams @kritis)))))

(defn handler [{:keys [params]}]
  (let [query (:query params)]
    (get-results query no-of-results)))

(ns kosha.app.search
  (:require [kosha.db.search :as db-search]
            [kosha.app.util :as util]))

(def no-of-results (util/get-config :api :search-results))

(defn get-results
  "Retrieves 2n best matches for given ragam or kriti name."
  [query n]
  (let [ragams  (future (db-search/ragams query n))
        kritis  (future (db-search/kritis query n))
        results (sort-by :similarity > (concat @ragams @kritis))]
    (util/json-response (into [] results))))

(defn handler [{:keys [params]}]
  (let [query (:query params)]
    (get-results query no-of-results)))

Order results by descending similarity score.


(ns braid.server.bots
  (:require
    [org.httpkit.client :as http]
    [taoensso.timbre :as timbre]
    [braid.server.crypto :as crypto]
    [braid.server.util :refer [->transit]])
  (:import
    java.io.ByteArrayInputStream))

(defn send-message-notification
  [bot message]
  (let [body (->transit message)
        hmac (crypto/hmac-bytes (bot :token) body)]
    (timbre/debugf "sending bot notification")
    (println
      ; TODO: should this be a POST too?
      @(http/put (bot :webhook-url)
                 {:headers {"Content-Type" "application/transit+msgpack"
                            "X-Braid-Signature" hmac}
                  :body (ByteArrayInputStream. body)}))))

(defn send-event-notification
  [bot info]
  (when-let [url (:event-webhook-url bot)]
    (let [body (->transit info)
          hmac (crypto/hmac-bytes (bot :token) body)]
      (timbre/debugf "sending bot event notification")
      (println
        @(http/post url
                    {:headers {"Content-Type" "application/transit+msgpack"
                               "X-Braid-Signature" hmac}
                     :body (ByteArrayInputStream. body)})))))

(ns braid.server.bots
  (:require
    [org.httpkit.client :as http]
    [taoensso.timbre :as timbre]
    [braid.server.crypto :as crypto]
    [braid.server.util :refer [->transit]])
  (:import
    java.io.ByteArrayInputStream))

(defn send-message-notification
  [bot message]
  (let [body (->transit message)
        hmac (crypto/hmac-bytes (bot :token) body)]
    (timbre/debugf "sending bot notification")
    (println
      ; TODO: should this be a POST too?
      @(http/put (bot :webhook-url)
                 {:headers {"Content-Type" "application/transit+msgpack"
                            "X-Braid-Signature" hmac}
                  :body (ByteArrayInputStream. body)}))))

(defn send-event-notification
  [bot info]
  (when-let [url (:event-webhook-url bot)]
    (timbre/debugf "Sending event notification %s to %s" info bot)
    (let [body (->transit info)
          hmac (crypto/hmac-bytes (bot :token) body)]
      (timbre/debugf "sending bot event notification")
      (println
        @(http/post url
                    {:headers {"Content-Type" "application/transit+msgpack"
                               "X-Braid-Signature" hmac}
                     :body (ByteArrayInputStream. body)})))))

Add debug logging to bot event sending

Add debug logging to bot event sending


(defproject onyx-app/lein-template "0.9.7.0-alpha4"
  :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 org.onyxplatform/onyx-datomic "0.8.1.0-alpha1"
  :description "Onyx plugin for Datomic"
  :url "https://github.com/MichaelDrogalis/onyx-datomic"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :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}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.0"]]
  :profiles {:dev {:dependencies [[midje "1.7.0"]
                                  [com.datomic/datomic-free "0.9.5153"]]
                   :plugins [[lein-midje "3.1.3"]
                             [lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

(defproject org.onyxplatform/onyx-datomic "0.8.1.0-SNAPSHOT"
  :description "Onyx plugin for Datomic"
  :url "https://github.com/MichaelDrogalis/onyx-datomic"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :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}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.0"]]
  :profiles {:dev {:dependencies [[midje "1.7.0"]
                                  [com.datomic/datomic-free "0.9.5153"]]
                   :plugins [[lein-midje "3.1.3"]
                             [lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

Prepare for next release cycle.

Prepare for next release cycle.


(defproject thinktopic/think.release "0.1.0-SNAPSHOT"
  :description "Library to perform releases clojure releases on a project or a directory of
  projects."
  :url "http://github.com/thinktopic/think.release"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [thinktopic/think.config "0.2.4"]
                 [org.clojure/tools.cli "0.3.5"]]

  :main         think.release.main

  :profiles { :uberjar {:aot :all
                        :uberjar-name "think.release.jar"}}

  :plugins [[lein-environ "1.0.0"]
            [s3-wagon-private "1.3.0"]]

  :repositories  {"snapshots"  {:url "s3p://thinktopic.jars/snapshots/"
                                :no-auth true
                                :releases false
                                :sign-releases false}
                  "releases"  {:url "s3p://thinktopic.jars/releases/"
                               :no-auth true
                               :snapshots false
                               :sign-releases false}}
  :aliases {"release"      ["run" "-m" "think.release.main"]})

(defproject thinktopic/think.release "0.1.0-SNAPSHOT"
  :description "Library to perform releases clojure releases on a project or a directory of
  projects."
  :url "http://github.com/thinktopic/think.release"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [thinktopic/think.config "0.3.0"]
                 [org.clojure/tools.cli "0.3.5"]]

  :main         think.release.main

  :profiles { :uberjar {:aot :all
                        :uberjar-name "think.release.jar"}}

  :plugins [[lein-environ "1.0.0"]
            [s3-wagon-private "1.3.0"]]

  :repositories  {"snapshots"  {:url "s3p://thinktopic.jars/snapshots/"
                                :no-auth true
                                :releases false
                                :sign-releases false}
                  "releases"  {:url "s3p://thinktopic.jars/releases/"
                               :no-auth true
                               :snapshots false
                               :sign-releases false}}
  :aliases {"release"      ["run" "-m" "think.release.main"]})

Bump config version due to major bugfix.


(defproject rill/rill "0.1.7-SNAPSHOT"
  :description "An Event Sourcing Toolkit"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :url "https://github.com/rill-event-sourcing/rill"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
                 [org.clojure/tools.logging "0.2.6"]
                 [prismatic/schema "0.2.2"]
                 [slingshot "0.10.3"]
                 [environ "0.5.0"]
                 [identifiers "1.1.0"]
                 [org.clojure/java.jdbc "0.3.4"]
                 [postgresql "9.1-901.jdbc4"]
                 [com.taoensso/nippy "2.6.3"]
                 [com.mchange/c3p0 "0.9.2.1"]])

(defproject rill/rill "0.1.7-SNAPSHOT"
  :description "An Event Sourcing Toolkit"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :url "https://github.com/rill-event-sourcing/rill"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
                 [org.clojure/tools.logging "0.2.6"]
                 [prismatic/schema "0.2.2"]
                 [slingshot "0.10.3"]
                 [environ "0.5.0"]
                 [identifiers "1.1.0"]])

Remove unused dependencies from core

Remove unused dependencies from core


{:dev
 {:aliases {"test-all" ["with-profile" "dev,1.8:dev,1.6:dev,1.5:dev:dev" "test"]}
  :codeina {:sources ["src"]
            :reader :clojure
            :target "doc/dist/latest/api"
            :src-uri "http://github.com/funcool/buddy-core/blob/master/"
            :src-uri-prefix "#L"}
  :plugins [[funcool/codeina "0.3.0"]
            [lein-ancient "0.6.7"]]}
 :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
 :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
 :1.8 {:dependencies [[org.clojure/clojure "1.8.0-beta2"]]}}

{:dev
 {:aliases {"test-all" ["with-profile" "dev,1.8:dev,1.6:dev,1.5:dev:dev" "test"]}
  :codeina {:sources ["src"]
            :reader :clojure
            :target "doc/dist/latest/api"
            :src-uri "http://github.com/funcool/buddy-core/blob/master/"
            :src-uri-prefix "#L"}
  :plugins [[funcool/codeina "0.3.0"]
            [lein-ancient "0.6.7"]]}
 :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
 :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
 :1.8 {:dependencies [[org.clojure/clojure "1.8.0-RC1"]]}}

Update :1.8 profile with clojure 1.8-RC1


(ns neko.data
  "Contains utilities to manipulate data that is passed between
  Android entities via Bundles and Intents."
  (:import android.os.Bundle android.content.Intent))

(defprotocol GenericKey
  "If given a string returns itself, otherwise transforms a argument
  into a string."
  (generic-key [key]))

(extend-protocol GenericKey
  String
  (generic-key [s] s)

  clojure.lang.Keyword
  (generic-key [k] (.getName k)))

(defprotocol MapLike
  "Returns a wrapper of the provided object that allows to extract
  values from it like from an ordinar map."
  (like-map [this]))

(extend-protocol MapLike
  Bundle
  (like-map [b]
    (proxy [clojure.lang.APersistentMap] []
      (containsKey [k] (.containsKey b (generic-key k)))
      (valAt
        ([k] (.get b (generic-key k)))
        ([k default] (let [key (generic-key k)]
                       (if (.containsKey b key)
                         (.get b (generic-key key))
                         default))))
      (seq [] (map (fn [k] [k (.get b k)])
                   (.keySet b)))))

  Intent
  (like-map [i]
    (like-map (.getExtras i))))

(ns neko.data
  "Contains utilities to manipulate data that is passed between
  Android entities via Bundles and Intents."
  (:import android.os.Bundle android.content.Intent))

(defprotocol GenericExtrasKey
  "If given a string returns itself, otherwise transforms a argument
  into a string."
  (generic-key [key]))

(extend-protocol GenericExtrasKey
  String
  (generic-key [s] s)

  clojure.lang.Keyword
  (generic-key [k] (.getName k)))

;; This type acts as a wrapper around Bundle instance to be able to
;; access it like an ordinar map.
;;
(deftype MapLikeBundle [^Bundle bundle]
  clojure.lang.Associative
  (containsKey [this k] (.containsKey bundle (generic-key k)))
  (entryAt [this k] (clojure.lang.MapEntry. k (.get bundle (generic-key k))))
  (valAt [this k] (.get bundle (generic-key k)))
  (valAt [this k default] (let [key (generic-key k)]
                      (if (.containsKey bundle key)
                        (.get bundle (generic-key key))
                        default)))
  (seq [this] (map (fn [k] [k (.get bundle k)])
                   (.keySet bundle))))

(defprotocol MapLike
  "A protocol that helps to wrap objects of different types into
  MapLikeBundle."
  (like-map [this]))

(extend-protocol MapLike
  Bundle
  (like-map [b]
    (MapLikeBundle. b))

  Intent
  (like-map [i]
    (if-let [bundle (.getExtras i)]
      (MapLikeBundle. bundle)
      {})))

Replace proxy wrapper around Bundle with a deftype


(ns minijava.test-compile
  (:use clojure.test
        clojure.contrib.def
        (minijava compile)))

(deftest tests-files-convert-without-exception
  (let [filter (proxy [java.io.FilenameFilter] []
                 (accept [_ name] (not (nil? (re-find #"java$" name)))))
        files (-> "resources/sample" java.io.File. (.listFiles filter))]
    (doseq [f files]
      (compile-program f))))

(ns minijava.test-compile
  (:use clojure.test
        clojure.contrib.def
        clojure.contrib.pprint
        (minijava compile)))

(deftest tests-files-convert-without-exception
  (let [filter (proxy [java.io.FilenameFilter] []
                 (accept [_ name] (not (nil? (re-find #"java$" name)))))
        files (-> "resources/sample" java.io.File. (.listFiles filter))]
    (doseq [f files]
      (pprint (compile-program f)))))

Use pretty printer in compile test

Use pretty printer in compile test


(ns circleci.backend.project.circleci
  (:require [circleci.backend.nodes :as nodes])
  (:require [circleci.backend.nodes.circleci :as circle])
  (:use [circleci.backend.build :only (build)])
  (:use [circleci.backend.action.vcs :only (checkout)])
  (:use [circleci.backend.action.bash :only (bash)])
  (:use [circleci.backend.action.junit :only (junit)]))

(def circle-build (build :project-name "CircleCI"
                         :build-num 1
                         :actions [(checkout "git@github.com:arohner/CircleCI.git")
                                   (bash [(lein deps)])
                                   (bash [(lein midje)])]
                         :group circle/circleci-group))

(def circle-deploy (build :project-name "CircleCI"
                          :type :deploy ;;?
                          :group circle/circleci-group
                          :actions [(checkout "git@github.com:arohner/CircleCI.git")
                                    (bash [(lein deps)
                                           (lein run)])
                                    ;;; Load Balancer
                                    ]))

(ns circleci.backend.project.circleci
  (:require [circleci.backend.nodes :as nodes])
  (:require [circleci.backend.nodes.circleci :as circle])
  (:use [circleci.backend.build :only (build)])
  (:use [circleci.backend.action.vcs :only (checkout)])
  (:use [circleci.backend.action.bash :only (bash)])
  ;; (:use [circleci.backend.action.junit :only (junit)])
  )

(def circle-build (build :project-name "CircleCI"
                         :build-num 1
                         :actions [(checkout "git@github.com:arohner/CircleCI.git")
                                   (bash [(lein deps)])
                                   (bash [(lein midje)])]
                         :group circle/circleci-group))

(def circle-deploy (build :project-name "CircleCI"
                          :type :deploy ;;?
                          :group circle/circleci-group
                          :actions [(checkout "git@github.com:arohner/CircleCI.git")
                                    (bash [(lein deps)
                                           (lein run)])
                                    ;;; Load Balancer
                                    ]))

Comment out incomplete junit code

Comment out incomplete junit code


(ns gtfve.state
  (:require [om.core :as om]))

(defn initial-state []
  {:error-message nil
   :environment :development
   :ui {:editor {:mode :view
                 :modes {:stops? false}
                 :update-render? false
                 :map-options {:center {:lat 0
                                        :lng 0}}}
        :panel {:tab :stops
                :stops {:query ""
                        :last-query ""
                        :loading? false}}}
   :data {:stops-search-results []
          :stop-times []
          :routes []}})

(defn create-cursors [state]
  (let [root (om/root-cursor state)]
    {:data   #(om/ref-cursor (:data root))
     :ui     #(om/ref-cursor (:ui root))
     :panel  #(om/ref-cursor (get-in root [:ui :panel]))
     :editor #(om/ref-cursor (get-in root [:ui :editor]))
     :stops-panel #(om/ref-cursor (get-in root [:ui :panel :stops]))}))

(ns gtfve.state
  (:require [om.core :as om]))

(defn initial-state []
  {:error-message nil
   :environment :development
   :ui {:editor {:mode :view
                 :modes {:stops? false}
                 :update-render? false
                 :map-options {:center {:lat 0
                                        :lng 0}}}
        :panel {:tab :stops
                :stops {:query ""
                        :last-query ""
                        :loading? false}}}
   :data {:stops-search-results []
          :stops []
          :stop-times []
          :routes []}})

(defn create-cursors [state]
  (let [root (om/root-cursor state)]
    {:data   #(om/ref-cursor (:data root))
     :ui     #(om/ref-cursor (:ui root))
     :panel  #(om/ref-cursor (get-in root [:ui :panel]))
     :editor #(om/ref-cursor (get-in root [:ui :editor]))
     :stops-panel #(om/ref-cursor (get-in root [:ui :panel :stops]))}))

Add stops vector to data

Add stops vector to data


;; Copyright (c) Daniel Borchmann. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file LICENSE at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.

(use 'clojure.contrib.command-line)

;;

(defn- run-repl []
  (clojure.main/repl :init #(use 'conexp.main)))

(with-command-line *command-line-args*
  "conexp-clj -- a general purpose tool for Formal Concept Analysis\n"
  [[gui? "Start the graphical user interface"]
   [load "Load script and run"]]
  (when gui?
    (clojure.main/repl :init #(do
                                (use 'conexp.main)
                                (use 'conexp.contrib.gui)
                                (@(ns-resolve 'conexp.contrib.gui 'gui)
                                 :default-close-operation javax.swing.JFrame/EXIT_ON_CLOSE))))
  (when load
    (load-file load))
  (when-not (or load gui?)
    (clojure.main/repl :init #(use 'conexp.main))))

;;

nil

;; Copyright (c) Daniel Borchmann. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file LICENSE at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.

(use 'clojure.contrib.command-line)

;;

(defn- run-repl []
  (clojure.main/repl :init #(use 'conexp.main)))

(with-command-line *command-line-args*
  "conexp-clj -- a general purpose tool for Formal Concept Analysis\n"
  [[gui? "Start the graphical user interface"]
   [load "Load script and run"]]
  (when gui?
    (clojure.main/repl :init #(do
                                (use 'conexp.main)
                                (use 'conexp.contrib.gui)
                                (@(ns-resolve 'conexp.contrib.gui 'gui)
                                 :default-close-operation javax.swing.JFrame/EXIT_ON_CLOSE))))
  (when load
    (use 'conexp.main)
    (load-file load))
  (when-not (or load gui?)
    (clojure.main/repl :init #(use 'conexp.main))))

;;

nil

Use conexp.main when --load-ing files

Use conexp.main when --load-ing files

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>


;; Copyright © 2014 JUXT LTD.

(defproject juxt.modular/ring "0.5.1"
  :description "A modular extension that represents the Ring interface"
  :url "https://github.com/juxt/modular/tree/master/modules/ring"
  :license {:name "The MIT License"
            :url "http://opensource.org/licenses/MIT"}
  :dependencies [[prismatic/schema "0.2.1"]])

;; Copyright © 2014 JUXT LTD.

(defproject juxt.modular/ring "0.5.2-SNAPSHOT"
  :description "A modular extension that represents the Ring interface"
  :url "https://github.com/juxt/modular/tree/master/modules/ring"
  :license {:name "The MIT License"
            :url "http://opensource.org/licenses/MIT"}
  :dependencies [[prismatic/schema "0.2.1"]
                 [org.clojure/tools.logging "0.2.6"]])

Add logging dependency to modular.ring

Add logging dependency to modular.ring


(ns spam-and-eggs.http.app
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [spam-and-eggs.http.api :as api]
            [spam-and-eggs.http.html :as html]))

(def handler (routes html/handler
                     api/handler
                     (route/not-found "Page not found")))

(ns spam-and-eggs.http.app
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [spam-and-eggs.http.api :as api]
            [spam-and-eggs.http.html :as html]))

(def handler (routes #'html/handler
                     #'api/handler
                     (route/not-found "Page not found")))

Use handler vars for routing

Use handler vars for routing


;; -*- indent-tabs-mode: nil -*-

(ns behaviors.t-isolated-metaconstants
  (:use [clojure.pprint])
  (:use [midje sweet]))

(defn verify-service [service]
 true)

(declare f g)
 (background (f) => 1
             (g) => 33)

(fact
 1 => 1
 (provided
   ..service.. =contains=> {:status 200}))))

;; -*- indent-tabs-mode: nil -*-

(ns behaviors.t-isolated-metaconstants
  (:use [clojure.pprint])
  (:use [midje sweet]))

(defn verify-service [service]
 true)

(declare f)
 ;; In version with bug, the following is required to make this work.
 ;; (background (f) => 1)

(future-fact
 1 => 1
 (provided
   ..service.. =contains=> {:status 200}))

Tag test for my current bug as future-fact


(ns debugging.core
  (:require [catacumba.core :as ct]
            [catacumba.http :as http]
            [catacumba.helpers :as hp]
            [catacumba.plugins.prone :as prone])
  (:gen-class))

(defn index
  [context]
  (http/ok "Go here"
           {:content-type "text/html; encoding=utg-8"}))

(defn middle-hander
  [context]
  (ct/delegate))

(defn some-page
  [context]
  (throw (ex-info "Error" {:some "data"})))

(def app
  (ct/routes [[:setup (prone/handler {:namespaces ["debugging"]})]
              [:get "somepage" middle-hander some-page]
              [:get index]]))

(defn -main
  [& args]
  (ct/run-server app))

(ns debugging.core
  (:require [catacumba.core :as ct]
            [catacumba.http :as http]
            [catacumba.plugins.prone :as prone])
  (:gen-class))

(defn index
  [context]
  (http/ok "Go here"
           {:content-type "text/html; encoding=utg-8"}))

(defn middle-hander
  [context]
  (ct/delegate))

(defn some-page
  [context]
  (throw (ex-info "Error" {:some "data"})))

(def app
  (ct/routes [[:setup (prone/handler {:namespaces ["debugging"]})]
              [:get "somepage" middle-hander some-page]
              [:get index]]))

(defn -main
  [& args]
  (ct/run-server app))

Remove unused import on debuging example.


(ns braid.users.core
  (:require
   [braid.core.api :as core]
   #?@(:cljs
       [[braid.users.client.views.users-page :as views]])))

(defn init! []
  #?(:cljs
     (do
       (core/register-group-page!
        {:key :users
         :view views/users-page-view}))))

(ns braid.users.core
  (:require
   [braid.core.api :as core]
   #?@(:cljs
       [[braid.users.client.views.users-page :as views]
        [braid.core.client.routes :as routes]])))

(defn init! []
  #?(:cljs
     (do
       (core/register-group-page!
        {:key :users
         :view views/users-page-view})
       (core/register-admin-header-item!
        {:class "users"
         :route-fn routes/group-page-path
         :route-args {:page-id "users"}
         :body "Users"}))))

Make menu item a hook

Make menu item a hook


(ns cljs38.polygon)

; Calculate the distance between 2 points
(defn distance [a b]
  (Math/sqrt (+
             (Math/pow (- (a 0) (b 0)) 2)
             (Math/pow (- (a 1) (b 1)) 2))))

; Generate a polygon where all edges are equally distant
(defn coordinates [number-of-edges radius]
  (letfn [
    (edge-coordinates [index]
      [(* radius (.cos js/Math (/(* index 2 (aget js/Math "PI")) number-of-edges)))
      (* radius (.sin js/Math (/(* index 2 (aget js/Math "PI")) number-of-edges)))])

    (next-edge [edges-left, edges]
      (if (> edges-left 0)
        (next-edge (- edges-left 1) (conj edges (edge-coordinates edges-left)) )
        edges))]

    (next-edge number-of-edges [])))

(ns cljs38.polygon)

; Calculate the distance between 2 points
(defn distance [a b]
  (Math/sqrt (+
             (Math/pow (- (a 0) (b 0)) 2)
             (Math/pow (- (a 1) (b 1)) 2))))

; Generate a polygon where all edges are equally distant
(defn coordinates [number-of-edges radius]
  (letfn [
    (edge-coordinates [index]
      [(* radius (Math/cos (/(* index 2 Math/PI) number-of-edges)))
       (* radius (Math/sin (/(* index 2 Math/PI) number-of-edges)))])

    (next-edge [edges-left, edges]
      (if (> edges-left 0)
        (next-edge (- edges-left 1) (conj edges (edge-coordinates edges-left)) )
        edges))]

    (next-edge number-of-edges [])))

Replace js math functions with Clojure Math/


{:dev
 {:plugins [[lein-ancient "0.6.10"]]
  :dependencies [[clj-http "2.1.0"]]
  :main ^:skip-aot uxbox.main}

 :prod
 {:jvm-opts ^:replace ["-Xms4g" "-Xmx4g" "-XX:+UseG1GC"
                       "-XX:+AggressiveOpts" "-server"]}}

{:dev
 {:plugins [[lein-ancient "0.6.10"]]
  :dependencies [[clj-http "2.1.0"]]
  :jvm-opts ^:replace ["-Xms500m" "-Xmx500m" "-XX:+UseG1GC"]
  :main ^:skip-aot uxbox.main}

 :prod
 {:jvm-opts ^:replace ["-Xms1g" "-Xmx1g" "-XX:+UseG1GC"
                       "-XX:+AggressiveOpts" "-server"]}}

Set lower defaults resource requiremens for dev profile.


(defproject wc "0.0.1-SNAPSHOT"
  :resource-paths ["_resources"]
  :target-path "_build"
  :min-lein-version "2.0.0"
  :jvm-opts ["-client"]
  :dependencies  [[org.apache.storm/storm-core "1.0.1"]
                  [org.apache.storm/flux-core "1.0.1"]]
  :jar-exclusions     [#"log4j\.properties" #"org\.apache\.storm\.(?!flux)" #"trident" #"META-INF" #"meta-inf" #"\.yaml"]
  :uberjar-exclusions [#"log4j\.properties" #"org\.apache\.storm\.(?!flux)" #"trident" #"META-INF" #"meta-inf" #"\.yaml"]
  )

(defproject wc "0.0.1-SNAPSHOT"
  :resource-paths ["_resources"]
  :target-path "_build"
  :min-lein-version "2.0.0"
  :jvm-opts ["-client"]
  :dependencies  [[org.apache.storm/storm-core "1.0.2"]
                  [org.apache.storm/flux-core "1.0.2"]]
  :jar-exclusions     [#"log4j\.properties" #"org\.apache\.storm\.(?!flux)" #"trident" #"META-INF" #"meta-inf" #"\.yaml"]
  :uberjar-exclusions [#"log4j\.properties" #"org\.apache\.storm\.(?!flux)" #"trident" #"META-INF" #"meta-inf" #"\.yaml"]
  )

Bump storm version to 1.0.2

Bump storm version to 1.0.2


(ns useful.java-test
  (:use clojure.test useful.java))

(deftest test-rescue
  (is (= nil (rescue (/ 9 0) nil)))
  (is (= 3   (rescue (/ 9 3) nil))))

(deftest test-construct
  (is (= "test" (construct String "test"))))

Add a test for construct.

Add a test for construct.


{:user {:plugins [[lein-localrepo "0.5.3"]
                  [lein-try "0.4.3"]]}}

{:user {:plugins [[lein-localrepo "0.5.3"]
                  [lein-try "0.4.3"]
                  ;; Convert pom.xml to project.clj
                  ;; Note: from https://github.com/thickey/lein-nevam
                  [lein-nevam "0.1.2"]]}}

Add lein-nevam for pom.xml to project.clj


(ns fred
  ;; Used a non-standard prefix for rook, to demonstrate that the eval occurs
  ;; in the fred namespace, not somewhere where there's a rook alias already.
  {:arg-resolvers [(io.aviso.rook/build-map-arg-resolver {:partner :barney})]}
  (:require
    [clojure.core.async :refer [go]]
    [io.aviso.rook :as r]
    [io.aviso.rook
     [client :as c]
     [utils :as utils]]))

(defn index
  [loopback-handler partner]
  (go
    (-> (c/new-request loopback-handler)
        (c/to :get partner)
        c/send
        (c/then (response
                  (utils/response {:message (format "%s says `%s'" partner (:message response))}))))))

(ns fred
  ;; TODO: pattern dispatcher doesn't eval at all, make it eval or
  ;; update the comment below
  ;;
  ;; Used a non-standard prefix for rook, to demonstrate that the eval occurs
  ;; in the fred namespace, not somewhere where there's a rook alias already.
  {:arg-resolvers [(io.aviso.rook/build-map-arg-resolver {:partner :barney})]}
  (:require
    [clojure.core.async :refer [go]]
    [io.aviso.rook :as r]
    [io.aviso.rook
     [client :as c]
     [utils :as utils]]))

(defn index
  [loopback-handler partner]
  (go
    (-> (c/new-request loopback-handler)
        (c/to :get partner)
        c/send
        (c/then (response
                  (utils/response {:message (format "%s says `%s'" partner (:message response))}))))))

Add TODO re: eval of ns arg resolvers

Add TODO re: eval of ns arg resolvers


;; ## Version utility
;;
;; This simple command-line tool prints a JSON hash with some info about
;; the version of PuppetDB.  It is useful for testing and other situations
;; where you'd like to know some of the version details without having
;; a running instance of PuppetDB.

(ns com.puppetlabs.puppetdb.cli.version
  (:require [cheshire.core :as json])
  (:use [com.puppetlabs.puppetdb.version :only [version]]
        [com.puppetlabs.puppetdb.scf.migrate :only [desired-schema-version]]))

(def cli-description "Print out a JSON hash containing version info about PuppetDB")

;; TODO: Would like to add database info and some other things here, but that
;; will require us to have access to the configuration info.  At present, the
;; configuration parsing code is scattered throughout services.clj and not
;; cleanly accessible from here.  Perhaps we can revisit this once we've
;; refactored and cleaned up the configuration stuff a bit.
(defn -main
  [& args]
  (doseq [[key val] {"version" (version)
                     "target_schema_version" desired-schema-version}]
    (println (format "%s=%s" key val))))

;; ## Version utility
;;
;; This simple command-line tool prints a list of info about
;; the version of PuppetDB.  It is useful for testing and other situations
;; where you'd like to know some of the version details without having
;; a running instance of PuppetDB.
;;
;; The output is currently formatted like the contents of a java properties file;
;; each line contains a single property name, followed by an equals sign, followed
;; by the property value.

(ns com.puppetlabs.puppetdb.cli.version
  (:require [cheshire.core :as json])
  (:use [com.puppetlabs.puppetdb.version :only [version]]
        [com.puppetlabs.puppetdb.scf.migrate :only [desired-schema-version]]))

(def cli-description "Print info about the current version of PuppetDB")

;; TODO: Would like to add database info and some other things here, but that
;; will require us to have access to the configuration info.  At present, the
;; configuration parsing code is scattered throughout services.clj and not
;; cleanly accessible from here.  Perhaps we can revisit this once we've
;; refactored and cleaned up the configuration stuff a bit.
(defn -main
  [& args]
  (doseq [[key val] {"version" (version)
                     "target_schema_version" desired-schema-version}]
    (println (format "%s=%s" key val))))

Update docs to reflect that the output is no longer JSON


(ns salava.core.ui.content-language
  (:require [reagent.session :as session]
            [salava.core.helper :refer [dump]]))

(defn init-content-language
  "chose language between user-lng and default lng"
  [contents]
  (let [user-lng (session/get-in [:user :language])]
    (if (some #(= user-lng (:language_code %)) contents)
      user-lng
      (:language-code (first (filter #(= (:language_code %) (:default_language_code %)) contents))))))

(defn content-language-selector [content-language-atom contents]
  (if (< 1 (count contents))
      (into [:div.badge-language-selector]
            (for [content contents]
              [:a {:href "#" :class (if (= @content-language-atom (:language_code content)) "chosen" "") :on-click #(reset! content-language-atom (:language_code content))} (str  (:language_code content))]))
      [:div.badge-language-selector]))

(defn content-setter
  "Show right language content or default content"
  [selected-language content]
  (let [filtered-content (first (filter #(= (:language_code %) selected-language) content))]
    (if filtered-content
      filtered-content
      (first (filter  #(= (:language_code %) (:default_language_code %)) content)))))

(ns salava.core.ui.content-language
  (:require [reagent.session :as session]
            [salava.core.i18n :refer [lang-lookup]]
            [clojure.string :refer [capitalize]]
            [salava.core.helper :refer [dump]]))

(defn init-content-language
  "chose language between user-lng and default lng"
  [contents]
  (let [user-lng (session/get-in [:user :language])]
    (if (some #(= user-lng (:language_code %)) contents)
      user-lng
      (:language-code (first (filter #(= (:language_code %) (:default_language_code %)) contents))))))

(defn content-language-selector [content-language-atom contents]

  (if (< 1 (count contents))
      (into [:div.badge-language-selector]
            (for [content contents]
              [:a {:href "#" :class (if (= @content-language-atom (:language_code content)) "chosen" "") :on-click #(reset! content-language-atom (:language_code content))} (str  (or (capitalize (get lang-lookup (:language_code content))) (:language_code content)))]))
      [:div.badge-language-selector]))

(defn content-setter
  "Show right language content or default content"
  [selected-language content]
  (let [filtered-content (first (filter #(= (:language_code %) selected-language) content))]
    (if filtered-content
      filtered-content
      (first (filter  #(= (:language_code %) (:default_language_code %)) content)))))

Fix content language selector have full language name


(ns caesium.crypto.generichash
  (:import (org.abstractj.kalium.crypto Hash)))

(def ^:private sixteen-nuls (repeat 16 (byte 0)))

(defn blake2b
  "Computes the BLAKE2b digest of the given message, with optional
  salt, key and personalization parameters."
  ([message]
     (.blake2 (new Hash) message))
  ([message & {salt :salt key :key personal :personal
               :or {salt sixteen-nuls
                    personal sixteen-nuls
                    key (byte-array 0)}}]

(ns caesium.crypto.generichash
  (:import (org.abstractj.kalium.crypto Hash)))

(def ^:private sixteen-nuls (byte-array 16))

(defn blake2b
  "Computes the BLAKE2b digest of the given message, with optional
  salt, key and personalization parameters."
  ([message]
     (.blake2 (new Hash) message))
  ([message & {salt :salt key :key personal :personal
               :or {salt sixteen-nuls
                    personal sixteen-nuls
                    key (byte-array 0)}}]

Make sixteen-nuls an actual byte array

Make sixteen-nuls an actual byte array


(ns circle.init
  ;; (:require circle.swank)
  (:require circle.db)
  (:require circle.web)
  (:require circle.repl)
  (:require circle.logging)
  ;; (:require circle.backend.nodes
  ;;           circle.backend.project.rails
  ;;           circle.backend.project.circle)
  )

(def init*
  (delay
   (try
     (circle.logging/init)
     ;; workaround for Heroku not liking us starting up swank
     (when (System/getenv "SWANK")
       (require 'circle.swank)
       (.invoke (ns-resolve 'circle.swank 'init)))
     (circle.db/init)
     (circle.web/init)
     (circle.repl/init)
     (println (java.util.Date.))
     true
     (catch Exception e
       (println "caught exception on startup:")
       (.printStackTrace e)
       (println "exiting")
       (System/exit 1)))))

(defn init
  "Start everything up. idempotent."
  []
  @init*)

(defn -main []
  (init))

(ns circle.init
  (:require circle.swank)
  (:require circle.db)
  (:require circle.web)
  (:require circle.repl)
  (:require circle.logging))

(def init*
  (delay
   (try
     (circle.logging/init)
     (circle.swank/init)
     (circle.db/init)
     (circle.web/init)
     (circle.repl/init)
     (println (java.util.Date.))
     true
     (catch Exception e
       (println "caught exception on startup:")
       (.printStackTrace e)
       (println "exiting")
       (System/exit 1)))))

(defn init
  "Start everything up. idempotent."
  []
  @init*)

(defn -main []
  (init))

Remove the heroku hack for swank, start swank unconditionally.


(defproject gov.nasa.earthdata/cmr-site-templates "0.1.0-SNAPSHOT"
  :description "Selmer templates for CMR documentation, directory pages, and various static web content"
  :url "https://github.com/nasa/Common-Metadata-Repository/site-templates"
  :license {
    :name "Apache License, Version 2.0"
    :url "http://www.apache.org/licenses/LICENSE-2.0"}
  :dependencies [
    [org.clojure/clojure "1.8.0"]]
  :profiles {
    :test {
      :plugins [
        [lein-shell "0.5.0"]
        [test2junit "1.4.0"]]}}
  :aliases {
    ;; The following aliases are needed for the CMR build process.
    "generate-static" ["with-profile" "+test" "shell" "echo" "NO OP"]
    "test-out" ["with-profile" "+test" "test2junit"]})

(defproject gov.nasa.earthdata/cmr-site-templates "0.1.0-SNAPSHOT"
  :description "Selmer templates for CMR documentation, directory pages, and various static web content"
  :url "https://github.com/nasa/Common-Metadata-Repository/site-templates"
  :license {
    :name "Apache License, Version 2.0"
    :url "http://www.apache.org/licenses/LICENSE-2.0"}
  :dependencies [
    [org.clojure/clojure "1.10.0"]]
  :profiles {
    :test {
      :plugins [
        [lein-shell "0.5.0"]
        [test2junit "1.4.0"]]}}
  :aliases {
    ;; The following aliases are needed for the CMR build process.
    "generate-static" ["with-profile" "+test" "shell" "echo" "NO OP"]
    "test-out" ["with-profile" "+test" "test2junit"]})

Update site templates to Clojure 1.10.

CMR-5389: Update site templates to Clojure 1.10.


(ns clstreams.testutil.mockito
  (:import org.mockito.Mockito))

(defn mock [cls] (Mockito/mock cls))

(defn mock-fn [] (mock clojure.lang.IFn))

(defmacro return-> [mock-obj-expr method-invocation-form return-value-expr]
  `(let [mock-obj# ~mock-obj-expr]
     (-> (Mockito/doReturn ~return-value-expr)
         (.when mock-obj#)
         ~method-invocation-form)
     mock-obj#))

(defmacro on-call [mock-fn-expr parameter-expr-list return-value-expr]
  `(return-> ~mock-fn-expr (.invoke ~@parameter-expr-list) ~return-value-expr))

(defmacro verify->
  ([mock-obj-expr method-invocation-form]
   `(verify-> ~mock-obj-expr ~method-invocation-form (Mockito/times 1)))
  ([mock-obj-expr method-invocation-form counting-predicate-expr]
   `(-> ~mock-obj-expr (Mockito/verify ~counting-predicate-expr) ~method-invocation-form)))

(defmacro verify-fn
  ([mock-fn-expr parameter-expr-list]
   `(verify-> ~mock-fn-expr (.invoke ~@parameter-expr-list)))
  ([mock-fn-expr parameter-expr-list counting-predicate-expr]
   `(verify-> ~mock-fn-expr (.invoke ~@parameter-expr-list) ~counting-predicate-expr)))

(defn times [n] (Mockito/times n))
(defn at-least-once [] (Mockito/atLeastOnce))
(defn at-least [n] (Mockito/atLeast n))
(defn at-most [n] (Mockito/atMost n))
(defn never [] (Mockito/never))

Add verify functions to Mockito wrapper

Add verify functions to Mockito wrapper


(ns flambo.accumulator-test
  (:use midje.sweet))

(facts
 "about accumulators"
 (future-fact "some tests"))

(ns flambo.accumulator-test
  (:use midje.sweet)
  (:require [flambo.accumulator :as a]
            [flambo.conf :as conf]
            [flambo.api :as f]))

(facts
 "about accumulators"
  (let [conf (-> (conf/spark-conf)
                 (conf/master "local")
                 (conf/app-name "accumulator-test"))]
    (f/with-context c conf
      (facts "about basic accumulation"
        (let [acc (a/accumulator c 0)
              named-acc (a/accumulator c 0 "my-acc")
              rdd (f/parallelize c (range 21))]
          (fact "acc should be 210"
            (f/foreach rdd (f/fn [x] (a/add acc x)))
            (a/value acc) => 210)
          (fact "named-acc should be 210 and have a name"
            (f/foreach rdd (f/fn [x] (a/add named-acc x)))
            (a/value named-acc) => 210
            (a/name named-acc) => "my-acc"))))))

Implement basic tests for accumulator api


(ns leiningen.ring.server
  (:use leiningen.core.eval))

(defn load-namespaces
  "Create require forms for each of the supplied symbols. This exists because
  Clojure cannot load and use a new namespace in the same eval form."
  [& syms]
  `(require
    ~@(for [s syms :when s]
        `'~(if-let [ns (namespace s)]
             (symbol ns)
             s))))

(defn server-task
  "Shared logic for server and server-headless tasks."
  [project options]
  (let [project (update-in project [:ring] merge options)]
    (eval-in-project
     (update-in project [:dependencies] conj ['ring-server "0.2.1"])
     `(ring.server.leiningen/serve '~project)
     (load-namespaces
      'ring.server.leiningen
      (-> project :ring :handler)
      (-> project :ring :init)
      (-> project :ring :destroy)))))

(defn server
  "Start a Ring server and open a browser."
  ([project]
     (server-task project {}))
  ([project port]
     (server-task project {:port port})))

(ns leiningen.ring.server)

(defn load-namespaces
  "Create require forms for each of the supplied symbols. This exists because
  Clojure cannot load and use a new namespace in the same eval form."
  [& syms]
  `(require
    ~@(for [s syms :when s]
        `'~(if-let [ns (namespace s)]
             (symbol ns)
             s))))

(defn eval-in-project
  "Support eval-in-project in both Leiningen 1.x and 2.x."
  [project form init]
  (let [[eip two?] (or (try (require 'leiningen.core.eval)
                            [(resolve 'leiningen.core.eval/eval-in-project)
                             true]
                            (catch java.io.FileNotFoundException _))
                       (try (require 'leiningen.compile)
                            [(resolve 'leiningen.compile/eval-in-project)]
                            (catch java.io.FileNotFoundException _)))]
    (if two?
      (eip project form init)
      (eip project form nil nil init))))

(defn server-task
  "Shared logic for server and server-headless tasks."
  [project options]
  (let [project (update-in project [:ring] merge options)]
    (eval-in-project
     (update-in project [:dependencies] conj ['ring-server "0.2.1"])
     `(ring.server.leiningen/serve '~project)
     (load-namespaces
      'ring.server.leiningen
      (-> project :ring :handler)
      (-> project :ring :init)
      (-> project :ring :destroy)))))

(defn server
  "Start a Ring server and open a browser."
  ([project]
     (server-task project {}))
  ([project port]
     (server-task project {:port port})))

Add backwards-compatibility with Leiningen 1.x.


(ns cljam.io.sequence-bench
  (:require [libra.bench :refer :all]
            [libra.criterium :as c]
            [cljam.test-common :as tcommon]
            [cljam.io.sequence :as cseq]))

(defbench read-all-sequences-test
  (are [f opts] (c/quick-bench (with-open [rdr (cseq/reader f)]
                                 (dorun (cseq/read-all-sequences rdr opts))))
    tcommon/medium-fa-file {}
    tcommon/medium-fa-file {:mask? true}
    tcommon/medium-twobit-file {}
    tcommon/medium-twobit-file {:mask? true}))

(defbench read-sequence-once-test
  (are [f opts]
      (let [region {:chr "chr7",
                    :start 10000,
                    :end 45000}]
        (c/quick-bench
         (with-open [rdr (cseq/reader f)]
           (cseq/read-sequence rdr region opts))))
    tcommon/medium-fa-file {}
    tcommon/medium-fa-file {:mask? true}
    tcommon/medium-twobit-file {}
    tcommon/medium-twobit-file {:mask? true}))

(defbench read-sequence-test
  (are [f opts]
      (let [region {:chr "chr7",
                    :start 10000,
                    :end 45000}]
        (with-open [rdr (cseq/reader f)]
          ;; warm up
          (cseq/read-sequence rdr region opts)
          (c/quick-bench
           (cseq/read-sequence rdr region opts))))
    tcommon/medium-fa-file {}
    tcommon/medium-fa-file {:mask? true}
    tcommon/medium-twobit-file {}
    tcommon/medium-twobit-file {:mask? true}))

Add benchmarking scripts for sequence readers


(ns {{project-ns}}.styles
  (:require [garden-reloader.def :refer [defstyles]]))

(defstyles style
  [:h1 {:text-decoration "underline"}])

(ns {{project-ns}}.styles
  (:require [garden-watcher.def :refer [defstyles]]))

(defstyles style
  [:h1 {:text-decoration "underline"}])

Use correct namespace name for garden-watcher


(ns test-nom-nom-nom
  (:use [nom.nom.nom]
        [clojure.test]))

(defn f [x]
  (.list x))

(deftest should-use-1.1.0-SNAPSHOT
  (is (= "1.1.0-master-SNAPSHOT" (clojure-version)))
  (f (java.io.File. "/tmp")))

(ns test-nom-nom-nom
  (:use [nom.nom.nom]
        [clojure.test]))

(defn f [x]
  (.list x))

(deftest should-use-1.1.0
  (is (= "1.1.0" (clojure-version)))
  (f (java.io.File. "/tmp")))

Remove clojure snapshot dep from test project.


(ns advent-2017.day-17)

(def input 345)

(defn spin [step [current-pos value buffer]]
  (let [new-pos (inc (mod (+ current-pos step) value))]
    [new-pos (inc value) (-> (subvec buffer 0 new-pos)
                           (into [value])
                           (into (subvec buffer new-pos)))]))

(defn part-1 []
  (let [[current-pos _ buffer] (nth (iterate (partial spin input) [0 1 [0]]) 2017)]
    (buffer (inc current-pos))))

(defn spin' [step [current-pos value after-zero]]
  (let [new-pos (inc (mod (+ current-pos step) value))]
    [new-pos (inc value) (if (== 1 new-pos)
                           value
                           after-zero)]))

(defn part-2 []
  (last (nth (iterate (partial spin' input) [0 1 nil]) 50000000)))

(ns advent-2017.day-17)

(def input 345)

(defn spin [step [current-pos value buffer]]
  (let [new-pos (inc (mod (+ current-pos step) value))]
    [new-pos (inc value) (-> (subvec buffer 0 new-pos)
                           (into [value])
                           (into (subvec buffer new-pos)))]))

(defn part-1 []
  (let [[current-pos _ buffer] (nth (iterate (partial spin input) [0 1 [0]]) 2017)]
    (buffer (inc current-pos))))

(defn part-2 []
  (loop [current-pos 0 value 1 after-zero nil]
    (if (== (dec value) 50000000)
      after-zero
      (let [new-pos (inc (mod (+ current-pos input) value))]
        (recur new-pos (inc value) (if (== 1 new-pos)
                                     value
                                     after-zero))))))

Switch to loop / recur for part 2

Switch to loop / recur for part 2

ClojureScript doesn’t have locals clearing
and memory usage can affect perf


(ns clopack-native.core)

(require '[net.n01se.clojure-jna :as jna])

(defn foo
  "I don't do a whole lot."
  [x]
  (println x "Hello, World!"))

(ns clopack-native.core)

(require '[net.n01se.clojure-jna :as jna])

; Refer to 'clopack_native' as 'cn'.
(jna/to-ns cn clopack_native)

(defn create-ctx [interface]
  "Creates a new packet context with the given interface.
   Returns a packet context on success, nil on errors."
  (let [handle  jna/invoke Integer cn/dev_open interface
        buf-len jna/invoke Integer cn/dev_buf_len]
    (when-not (= handle -1)
      {:handle  handle
       :buf-len buf-len})))

(defn read-frame [ctx]
  "Reads a data frame as from a packet context.
   Returns a byte-array on success, nil otherwise"
  (let [handle    (:handle ctx)
        buf-len   (:buf-len ctx)
        buf       (byte-array buf-len)
        num-read  (jna/invoke Integer cn/dev_read handle buf buf-len)]
    (when-not (= num-read -1)
      (take num-read buf))))

(defn write-frame [ctx buf]
  "Writes the given byte-array as a data frame through a packet context.
   Returns the number of bytes written on success, nil otherwise."
  (let [handle      (:handle ctx)
        buf-len     (count buf)
        num-written (jna/invoke Integer cn/dev_write handle buf buf-len)]
    (when-not (= num-written -1)
      num-written)))

(defn destroy-ctx [ctx]
  "Destroys a packet context."
  (jna/invoke Integer cn/dev_close (:handle ctx))
  nil)

Define wrapper routines to access native C code


(ns {{name}}.test-common
  (:require [cheshire.core :as json]
            [clojure.string :as str]
            [environ.core :refer [env]]))

(defn url+ [& suffix]
  (apply str (format (env :service-url) (env :service-port)) suffix))

(defn json-body
  "Reads the body of the request as json and parses it into a map with keywords.

   Fails pre-condition if content type is not application/json."
  [resp]
  {:pre [(re-matches #"application/(.+)?json.+" (get-in resp [:headers "content-type"]))]}
  (json/parse-string (:body resp) true))

(ns {{name}}.test-common
  (:require [cheshire.core :as json]
            [clojure.string :as str]
            [environ.core :refer [env]]))

(defn url+ [& suffix]
  (apply str (format (env :service-url) (env :service-port)) suffix))

(defn json-body
  "Reads the body of the request as json and parses it into a map with keywords.

   Fails pre-condition if content type is not application/json."
  [resp]
  {:pre [(re-matches #"application/(.+\+)?json.*" (get-in resp [:headers "content-type"]))]}
  (json/parse-string (:body resp) true))

Improve validation of content type in json-body

Custom MIME types should end with +json.
Characters following json MIME type should be optional.


(ns ^:figwheel-always instantetymonline.client
    (:require [reagent.core :as r]
              [instantetymonline.dict :refer [dict]]))

(enable-console-print!)

(defn etym-lookup []
  (let [local (r/atom {:word ""})]   ;; not included in render
    (fn []                           ;; render from here
      (let [word (get @local :word)]
        [:div.center
         [:form
          [:input.h2 {:id "etym"
                   :type "text"
                   :value word
                   :on-change (fn [e]
                                (reset! local {:word (-> e .-target .-value)}))}]]
         [:div [:p (get dict word)]]]))))

(defn main-component []
  [:div
   [:h1.center "Etymologically delicious"]
   [etym-lookup]])

(r/render-component [main-component]
  (. js/document (getElementById "app")))

(ns ^:figwheel-always instantetymonline.client
    (:require [reagent.core :as r]
              [instantetymonline.dict :refer [dict]]))

(enable-console-print!)

(defn etym-lookup []
  (let [local (r/atom {:word ""})]   ;; not included in render
    (fn []                           ;; render from here
      (let [word (get @local :word)]
        [:div
         [:form
          [:input.h2
           {:id "etym"
            :type "text"
            :value word
            :on-change (fn [e] (reset! local {:word (-> e .-target .-value)}))}]]
         [:br]
         [:p {:style {"max-width" "35em"}} (get dict word)]]))))

(defn main-component []
  [:div.p1
   [:h1 "Etym Deli"]
   [etym-lookup]])

(r/render-component [main-component]
  (. js/document (getElementById "app")))

Make design a bit more readable

Make design a bit more readable


(ns overtone-workspace.layers.lines-layer
  (:require [quil.core :as q])
  (:use [quil-layer.layer]))

(def num-of-lines 5)

(defn- setup [] {})
(defn- update-state [state] {})

(defn- draw-state [state]
  (let [r (/ (q/width) num-of-lines)
        rr (- r)]
    (q/smooth)

    (q/color-mode :rgb)
    (q/background 200)
    (q/fill 220)
    (q/stroke 220)

    (dorun
      (for [i (range 0 num-of-lines)]
        (let [x (+ (* i (/ (q/width) num-of-lines)) (q/random rr r))
            y 2
            x2 (+ (* i (/ (q/width) num-of-lines)) (q/random rr r))
            y2 (- (q/height) 2)]
          (q/stroke-weight r)
          (q/line x y x2 y2))
      )))
  )

(defrecord LinesLayer [state]
  Layer
  (setup-layer-state [this]
                     (setup))
  (update-layer-state [this state]
                      (update-state state))
  (draw-layer-state [this state]
                    (draw-state state)))

(ns overtone-workspace.layers.lines-layer
  (:require [quil.core :as q])
  (:use [quil-layer.layer]))

(def num-of-lines 5)

(defn- setup [] {})
(defn- update-state [state] {})

(defn- draw-state [state]
  (let [r (/ (q/width) num-of-lines)]
    (q/smooth)

    (q/no-stroke)
    (q/color-mode :hsb)
    (q/fill (.backgroundColor (q/current-graphics)) 100)
    (q/rect 0 0 (q/width) (q/height))

    (q/color-mode :rgb)
;    (q/background 200)

    (q/fill 220)
    (q/stroke 220)
    (q/stroke-weight r)

    (dorun
      (for [i (range 0 num-of-lines)]
        (let [top 2
              x (+ (* i (/ (q/width) num-of-lines)) (q/random (- r) r))
              y top
              x2 (+ (* i (/ (q/width) num-of-lines)) (q/random (- r) r))
              y2 (- (q/height) top)]
          (q/line x y x2 y2))
      )))
  )

(defrecord LinesLayer [state]
  Layer
  (setup-layer-state [this]
                     (setup))
  (update-layer-state [this state]
                      (update-state state))
  (draw-layer-state [this state]
                    (draw-state state)))

Change not to use q/background

Change not to use q/background


(ns icecap.schema-test
  (:require [icecap.schema :refer :all]
            [clojure.test :refer :all]
            [schema.core :as s]))

(def simple-http-action {:target "http://example.test"})
(def simple-https-action {:target "https://example.test"})
(def simple-ftp-action {:target "ftp://example.test"})

(deftest PlanTests
  (testing "Correct plans validate"
    (are [example] (s/validate Plan example)
         simple-http-action
         simple-https-action
         #{simple-http-action simple-https-action}))
  (testing "Empty plans don't validate"
    (are [example reason] (= (pr-str (s/check Plan example))
                             (pr-str reason))
         [] '(not ("collection of one or more plans" []))
         #{} '(not ("collection of one or more plans" #{}))))
  (testing "Plans with empty in them don't validate"
    (are [example reason] (= (pr-str (s/check Plan example))
                             (pr-str reason))
      [#{} simple-http-action] ['(not ("collection of one or more plans" #{})) nil]))
  (testing "plans with unknown/unsupported schemes don't validate"
    ;; Comparing string representations isn't great, but it's the best
    ;; easily available tool until maybe one day cddr/integrity's
    ;; humanize function is on Clojars + can humanize these errors :-)
    (are [example reason] (= (pr-str (s/check Plan example))
                             (pr-str reason))
         simple-ftp-action {:target '(not ("supported-scheme?" "ftp://example.test"))})))

(ns icecap.schema-test
  (:require [icecap.schema :refer :all]
            [clojure.test :refer :all]
            [schema.core :as s]))

(def simple-http-action {:target "http://example.test"})
(def simple-https-action {:target "https://example.test"})
(def simple-ftp-action {:target "ftp://example.test"})

(deftest PlanTests
  (testing "Correct plans validate"
    (are [example] (s/validate Plan example)
         simple-http-action
         simple-https-action
         #{simple-http-action simple-https-action}))
  (testing "Empty plans don't validate"
    (are [example reason] (= (pr-str (s/check Plan example))
                             (pr-str reason))
         [] '(not ("collection of one or more plans" []))
         #{} '(not ("collection of one or more plans" #{}))))
  (testing "Plans with empty in them don't validate"
    (are [example reason] (= (pr-str (s/check Plan example))
                             (pr-str reason))
      [#{} simple-http-action] ['(not ("collection of one or more plans" #{})) nil]))
  (testing "plans with unknown/unsupported schemes don't validate"))
(are [example reason] (= (pr-str (s/check Plan example))
                         (pr-str reason))
     simple-ftp-action {:target '(not ("supported-scheme?" "ftp://example.test"))})

Replace scary comment with issue

Replace scary comment with issue

Refs #2.


(ns onyx.log.full-test
  (:require [clojure.core.async :refer [chan >!! <!! close!]]
            [com.stuartsierra.component :as component]
            [onyx.system :refer [onyx-development-env]]
            [onyx.log.entry :refer [create-log-entry]]
            [onyx.extensions :as extensions]
            [onyx.api :as api]
            [midje.sweet :refer :all]
            [zookeeper :as zk]))

(def onyx-id (java.util.UUID/randomUUID))

(def config (read-string (slurp (clojure.java.io/resource "test-config.edn"))))

(def dev (onyx-development-env onyx-id (:env config)))

(def env (component/start dev))

(def peer-opts
  {:inbox-capacity 100
   :outbox-capacity 100})

(def v-peers (onyx.api/start-peers! onyx-id 10 (:peer config) peer-opts))

#_(doseq [v-peer v-peers]
  (try
    ((:shutdown-fn v-peer))
    (catch Exception e (prn e))))

;;(component/stop env)

(ns onyx.log.full-test
  (:require [clojure.core.async :refer [chan >!! <!! close!]]
            [com.stuartsierra.component :as component]
            [onyx.system :refer [onyx-development-env]]
            [onyx.log.entry :refer [create-log-entry]]
            [onyx.extensions :as extensions]
            [onyx.api :as api]
            [midje.sweet :refer :all]
            [zookeeper :as zk]))

(def onyx-id (java.util.UUID/randomUUID))

(def config (read-string (slurp (clojure.java.io/resource "test-config.edn"))))

(def dev (onyx-development-env onyx-id (:env config)))

(def env (component/start dev))

(def peer-opts
  {:inbox-capacity 100
   :outbox-capacity 100})

(def n-peers 50)

(def v-peers (onyx.api/start-peers! onyx-id n-peers (:peer config) peer-opts))

(def ch (chan n-peers))

(extensions/subscribe-to-log (:log env) 0 ch)

(def replica
  (loop [replica {}]
    (let [position (<!! ch)
          entry (extensions/read-log-entry (:log env) position)
          new-replica (extensions/apply-log-entry entry replica)]
      (if (< (count (:pairs new-replica)) n-peers)
        (recur new-replica)
        new-replica))))

(fact (:prepared replica) => {})
(fact (:accepted replica) => {})
(fact (count (:peers replica)) => n-peers)

(doseq [v-peer v-peers]
  (try
    ((:shutdown-fn v-peer))
    (catch Exception e (prn e))))

(component/stop env)

Test for converging 50 peers into the cluster.


(ns cortex.optimize.functions
  (:refer-clojure :exclude [+ - * /])
  (:require [clojure.core.matrix :as m]
            [clojure.core.matrix.operators :refer [+ - * /]]
            [cortex.optimize.protocols :as P]))

(extend-protocol P/Function
  clojure.lang.IPersistentMap
  (value [this params] ((:value this) params))
  (gradient [this params] ((:gradient this) params)))

(def cross-paraboloid
  "Depending on the number of args passed to it, generates
  functions of the form:

  f(x, y) = (x + y)² + (y + x)²
  f(x, y, z) = (x + y)² + (y + z)² + (z + x)²
  f(x, y, z, w) = (x + y)² + (y + z)² + (z + w)² + (w + x)²"
  {:value (fn [args]
            (->> args
              vec
              cycle
              (take (inc (m/ecount args)))
              (partition 2 1)
              (map (partial apply +))
              (map m/square)
              (apply +)))
   :gradient (fn [args]
               (->> args
                 vec
                 cycle
                 (drop (dec (m/ecount args)))
                 (take (+ 3 (dec (m/ecount args))))
                 (partition 3 1)
                 (map (partial map * [2 4 2]))
                 (map (partial apply +))
                 (m/array :vectorz)))})

(ns cortex.optimize.functions
  (:refer-clojure :exclude [+ - * /])
  (:require [clojure.core.matrix :as m]
            [clojure.core.matrix.operators :refer [+ - * /]]
            [cortex.optimize.protocols :as P]))

(extend-protocol P/Function
  clojure.lang.IPersistentMap
  (value [this params] ((:value this) params))
  (gradient [this params] ((:gradient this) params)))

(def cross-paraboloid
  "Depending on the length of the parameter vector, generates
  functions of the form:

  f(x, y) = (x + y)² + (y + x)²
  f(x, y, z) = (x + y)² + (y + z)² + (z + x)²
  f(x, y, z, w) = (x + y)² + (y + z)² + (z + w)² + (w + x)²"
  {:value (fn [params]
            (->> params
              vec
              cycle
              (take (inc (m/ecount params)))
              (partition 2 1)
              (map (partial apply +))
              (map m/square)
              (apply +)))
   :gradient (fn [params]
               (->> params
                 vec
                 cycle
                 (drop (dec (m/ecount params)))
                 (take (+ 3 (dec (m/ecount params))))
                 (partition 3 1)
                 (map (partial map * [2 4 2]))
                 (map (partial apply +))
                 (m/array :vectorz)))})

Update nomenclature in cross-paraboloid Function


(ns discuss.components.sidebar
  "Controlling the sidebar."
  (:require [om.core :as om]
            [om.dom :as dom]
            [discuss.utils.common :as lib]
            [discuss.utils.views :as vlib]))

(def id (lib/prefix-name "sidebar"))

(defn toggle
  "Toggle visibility of sidebar."
  ([]
   (let [sidebar-dom (.getElementById js/document id)
         main-wrapper (.getElementById js/document "main-wrapper")]
     (lib/toggle-class sidebar-dom "active")
     (lib/toggle-class main-wrapper "active")))
  ([bool]
   (let [sidebar-dom (.getElementById js/document id)
         main-wrapper (.getElementById js/document "main-wrapper")]
     (lib/toggle-class sidebar-dom "active" bool)
     (lib/toggle-class main-wrapper "active" bool))))

(defn show
  "Show sidebar."
  []
  (toggle true))

(defn hide
  "Hide sidebar."
  []
  (toggle false))

;;;; Sidebar
(defn view [data]
  (reify om/IRender
    (render [_]
      (dom/div nil
               (vlib/fa-icon "fa-bars" hide)
               (om/build discuss.views/main-view data)))))

(ns discuss.components.sidebar
  "Controlling the sidebar."
  (:require [om.core :as om]
            [om.dom :as dom]
            [goog.dom :as gdom]
            [discuss.utils.common :as lib]
            [discuss.utils.views :as vlib]))

(def id (lib/prefix-name "sidebar"))

(defn toggle
  "Toggle visibility of sidebar."
  ([]
   (let [sidebar-dom (gdom/getElement id)
         main-wrapper (gdom/getElement "main-wrapper")]
     (lib/toggle-class sidebar-dom "active")
     (lib/toggle-class main-wrapper "active")))
  ([bool]
   (let [sidebar-dom (gdom/getElement id)
         main-wrapper (gdom/getElement "main-wrapper")]
     (lib/toggle-class sidebar-dom "active" bool)
     (lib/toggle-class main-wrapper "active" bool))))

(defn show
  "Show sidebar."
  []
  (toggle true))

(defn hide
  "Hide sidebar."
  []
  (toggle false))

;;;; Sidebar
(defn view [data]
  (reify om/IRender
    (render [_]
      (dom/div nil
               (vlib/fa-icon "fa-bars" hide)
               (om/build discuss.views/main-view data)))))

Use Google Closure to find dom element

Use Google Closure to find dom element


(ns datascript-dom.core-test
  (:require [clojure.test :refer :all]
            [datascript-dom.core :refer :all]))

(deftest a-test
  (testing "FIXME, I fail."
    (is (= 0 1))))

(ns datascript-dom.core-test
  (:require [clojure.test :refer :all]
            [datascript-dom.core :refer :all]
            [pl.danieljanus.tagsoup :as html]))

(deftest test-dom->transaction
  (is (=
       [{:tag :html, :db/id -1}
        {:tag :body, :parent -1, :db/id -2}
        {:tag :p, :parent -2, :db/id -3}
        {:tag :text-node, :text "A", :parent -3, :db/id -4}
        {:tag :b, :parent -3, :prev-sibling -4, :db/id -5}
        {:tag :text-node, :text "B", :parent -5, :db/id -6}
        {:tag :text-node, :text "C", :parent -3, :prev-sibling -5, :db/id -7}
        {:tag :i, :parent -3, :prev-sibling -7, :db/id -8}
        {:tag :text-node, :text "D", :parent -8, :db/id -9}
        {:tag :text-node, :text "E", :parent -3, :prev-sibling -8, :db/id -10}
        {:tag :p, :parent -2, :prev-sibling -3, :db/id -11}
        {:tag :text-node, :text "hohoho", :parent -11, :db/id -12}]
       (dom->transaction
        (html/parse-string "
ABCDE

hohoho
")))))

Test dom to transaction code

Test dom to transaction code


(defproject onyx-plugin/lein-template "0.7.0"
  :description "A Leiningen 2.0 template for new Onyx plugins"
  :url "http://github.com/MichaelDrogalis/onyx-plugin"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies  []
  :plugins [[lein-set-version "0.4.1"]]
  :eval-in-leiningen true)

(defproject onyx-plugin/lein-template "0.7.0.0"
  :description "A Leiningen 2.0 template for new Onyx plugins"
  :url "http://github.com/MichaelDrogalis/onyx-plugin"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies  []
  :plugins [[lein-set-version "0.4.1"]]
  :eval-in-leiningen true)

Use 4 point versioning so that template version can match Onyx


(defproject puppetlabs/kitchensink "0.1.2"
  :description "Clojure utility functions"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 ;; Logging
                 [org.clojure/tools.logging "0.2.6"]
                 ;; Filesystem utilities
                 [fs "1.1.2"]
                 ;; Configuration file parsing
                 [org.ini4j/ini4j "0.5.2"]
                 [org.clojure/tools.cli "0.2.2"]
                 [digest "1.4.3"]
                 [clj-time "0.5.1"]
                 ;; SSL
                 [org.bouncycastle/bcpkix-jdk15on "1.50"]]

  :profiles {:dev {:resource-paths ["test-resources"]}}

  :deploy-repositories [["snapshots" "http://nexus.delivery.puppetlabs.net/content/repositories/snapshots/"]])

(defproject puppetlabs/kitchensink "0.1.3-SNAPSHOT"
  :description "Clojure utility functions"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 ;; Logging
                 [org.clojure/tools.logging "0.2.6"]
                 ;; Filesystem utilities
                 [fs "1.1.2"]
                 ;; Configuration file parsing
                 [org.ini4j/ini4j "0.5.2"]
                 [org.clojure/tools.cli "0.2.2"]
                 [digest "1.4.3"]
                 [clj-time "0.5.1"]
                 ;; SSL
                 [org.bouncycastle/bcpkix-jdk15on "1.50"]]

  :profiles {:dev {:resource-paths ["test-resources"]}}

  :deploy-repositories [["snapshots" "http://nexus.delivery.puppetlabs.net/content/repositories/snapshots/"]])

Update version to 0.1.3-SNAPSHOT for development


(defproject cake "0.7.0-beta1"
  :description "Save your fork, there's cake!"
  :dependencies [[clojure "1.2.0"]
                 [uncle "0.2.3"]
                 [depot "0.1.7"]
                 [classlojure "0.6.3"]
                 [useful "0.7.4-alpha4"]
                 [slingshot "0.7.2"]
                 [org.clojure/tools.namespace "0.1.1" :exclusions [org.clojure/java.classpath]]
                 [org.clojars.ninjudd/java.classpath "0.1.2-SNAPSHOT"]
                 [org.clojars.ninjudd/data.xml "0.0.1-SNAPSHOT"]
                 [com.jcraft/jsch "0.1.42"]
                 [flatland/difform "1.1.2"]
                 [org.clojars.rosejn/clansi "1.2.0-SNAPSHOT" :exclusions [org.clojure/clojure]]
                 [clj-stacktrace "0.2.3"]
                 [sherlock "0.1.0-alpha3"]]
  :copy-deps true)

(defproject cake "0.7.0-beta1"
  :description "Save your fork, there's cake!"
  :dependencies [[clojure "1.2.0"]
                 [uncle "0.2.3"]
                 [depot "0.1.7"]
                 [classlojure "0.6.3"]
                 [useful "0.7.4-alpha4"]
                 [slingshot "0.7.2"]
                 [org.clojure/tools.namespace "0.1.1" :exclusions [org.clojure/java.classpath]]
                 [org.clojars.ninjudd/java.classpath "0.1.2-SNAPSHOT"]
                 [org.clojars.ninjudd/data.xml "0.0.1-SNAPSHOT"]
                 [com.jcraft/jsch "0.1.42"]
                 [difform "1.1.2"]
                 [org.clojars.rosejn/clansi "1.2.0-SNAPSHOT" :exclusions [org.clojure/clojure]]
                 [clj-stacktrace "0.2.3"]
                 [sherlock "0.1.0-alpha3"]]
  :copy-deps true)

Use official version of difform, since it was just updated with the changes I made before.


(let [dev-deps '[[speclj "2.3.0"]]]

  (defproject reply "0.2.0-SNAPSHOT"
    :description "REPL-y: A fitter, happier, more productive REPL for Clojure."
    :dependencies [[org.clojure/clojure "1.4.0"]
                   [org.clojars.trptcolin/jline "2.10.1"]
                   [org.thnetos/cd-client "0.3.6"]
                   [clj-stacktrace "0.2.4"]
                   [org.clojure/tools.nrepl "0.2.2"]
                   [org.clojure/tools.cli "0.2.1"]
                   [com.cemerick/drawbridge "0.0.6"]
                   [trptcolin/versioneer "0.1.0"]
                   [clojure-complete "0.2.2"]
                   [org.clojars.trptcolin/sjacket "0.1.0.3"
                    :exclusions [org.clojure/clojure]]]
    :profiles {:dev {:dependencies ~dev-deps}}
    :dev-dependencies ~dev-deps
    :plugins ~dev-deps
    :source-path "src/clj"
    :java-source-path "src/java"
    :test-path "spec"
    :source-paths ["src/clj"]
    :java-source-paths ["src/java"]
    :test-paths ["spec"]
    :repl-options {:init-ns user}
    :aot [reply.reader.jline.JlineInputReader]
    :main ^{:skip-aot true} reply.ReplyMain))

(let [dev-deps '[[speclj "2.3.0"]]]

  (defproject reply "0.2.0-SNAPSHOT"
    :description "REPL-y: A fitter, happier, more productive REPL for Clojure."
    :dependencies [[org.clojure/clojure "1.4.0"]
                   [org.clojars.trptcolin/jline "2.10.2"]
                   [org.thnetos/cd-client "0.3.6"]
                   [clj-stacktrace "0.2.4"]
                   [org.clojure/tools.nrepl "0.2.2"]
                   [org.clojure/tools.cli "0.2.1"]
                   [com.cemerick/drawbridge "0.0.6"]
                   [trptcolin/versioneer "0.1.0"]
                   [clojure-complete "0.2.2"]
                   [org.clojars.trptcolin/sjacket "0.1.0.3"
                    :exclusions [org.clojure/clojure]]]
    :profiles {:dev {:dependencies ~dev-deps}}
    :dev-dependencies ~dev-deps
    :plugins ~dev-deps
    :source-path "src/clj"
    :java-source-path "src/java"
    :test-path "spec"
    :source-paths ["src/clj"]
    :java-source-paths ["src/java"]
    :test-paths ["spec"]
    :repl-options {:init-ns user}
    :aot [reply.reader.jline.JlineInputReader]
    :main ^{:skip-aot true} reply.ReplyMain))

Bump jline for non-BMP characters

Bump jline for non-BMP characters

closes #104


(defproject org.timmc/heim-logger "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [cheshire "5.6.3"]

                 ;; v1

                 [aleph "0.4.1"]

                 ;; v2

                 ;; I had trouble with http.async.client -- I got a
                 ;; 403 when connecting to euphoria.io.
                 [stylefruits/gniazdo "1.0.0"]
                 ]
  :main ^:no-aot org.timmc.heim-logger.v1
  :jvm-opts ["-Xmx100M"]
  )

(defproject org.timmc/heim-logger "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies
  [[org.clojure/clojure "1.8.0"]
   [cheshire "5.6.3"]

   ;; v1

   [aleph "0.4.1"]
   ;; JAXB APIs for aleph to link against in newer JDKs. According to
   ;; https://stackoverflow.com/questions/43574426 JAXB is present in
   ;; JDK 6/7/8, and while it is present in 9 and 10, it is in a module
   ;; that is not loaded by default. In 11, it is missing entirely.
   ;; This has only been tested with JDK 11, manually.
   [javax.xml.bind/jaxb-api "2.3.1"]
   [com.sun.xml.bind/jaxb-impl "2.3.2"]
   [org.glassfish.jaxb/jaxb-runtime "2.3.2"]
   [javax.activation/javax.activation-api "1.2.0"]

   ;; v2

   ;; I had trouble with http.async.client -- I got a
   ;; 403 when connecting to euphoria.io.
   [stylefruits/gniazdo "1.0.0"]
   ]
  :main ^:no-aot org.timmc.heim-logger.v1
  :jvm-opts ["-Xmx100M"]
  )

Add JAXB deps for JDK 11 compat

Add JAXB deps for JDK 11 compat


(defproject jungerer "0.1.1"
  :description "Clojure network/graph library wrapping JUNG"
  :url "https://github.com/totakke/jungerer"
  :license {:name "The BSD 3-Clause License"
            :url "https://opensource.org/licenses/BSD-3-Clause"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [net.sf.jung/jung-algorithms "2.1"]
                 [net.sf.jung/jung-api "2.1"]
                 [net.sf.jung/jung-graph-impl "2.1"]
                 [net.sf.jung/jung-visualization "2.1"]]
  :profiles {:dev {:global-vars {*warn-on-reflection* true}}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}
  :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})

(defproject jungerer "0.1.2-SNAPSHOT"
  :description "Clojure network/graph library wrapping JUNG"
  :url "https://github.com/totakke/jungerer"
  :license {:name "The BSD 3-Clause License"
            :url "https://opensource.org/licenses/BSD-3-Clause"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [net.sf.jung/jung-algorithms "2.1"]
                 [net.sf.jung/jung-api "2.1"]
                 [net.sf.jung/jung-graph-impl "2.1"]
                 [net.sf.jung/jung-visualization "2.1"]]
  :profiles {:dev {:global-vars {*warn-on-reflection* true}}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}
  :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})

Prepare for next development iteration (0.1.2-SNAPSHOT)


;   Copyright (c) Rich Hickey. All rights reserved.
;   The use and distribution terms for this software are covered by the
;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;   which can be found in the file epl-v10.html at the root of this distribution.
;   By using this software in any fashion, you are agreeing to be bound by
;   the terms of this license.
;   You must not remove this notice, or any other, from this software.

(ns ^{:doc "Tests for emit to print XML text."
      :author "Herwig Hochleitner"}
  clojure.data.xml.test-pprint
  (:require
   [clojure.test :refer :all]
   [clojure.data.xml :refer :all]))

(def xml
  "<foo><bar/></foo>")
(def indented-xml
  ;; FIXME indent first
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>
  <bar/>
</foo>
")

(deftest test-indent
  (is (= indented-xml (indent-str (parse-str xml)))))

;   Copyright (c) Rich Hickey. All rights reserved.
;   The use and distribution terms for this software are covered by the
;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;   which can be found in the file epl-v10.html at the root of this distribution.
;   By using this software in any fashion, you are agreeing to be bound by
;   the terms of this license.
;   You must not remove this notice, or any other, from this software.

(ns ^{:doc "Tests for emit to print XML text."
      :author "Herwig Hochleitner"}
  clojure.data.xml.test-pprint
  (:require
   [clojure.test :refer :all]
   [clojure.data.xml :refer :all]))

(def xml
  "<foo><bar/></foo>")

(defn jdk8? []
  (-> (System/getProperty "java.version")
      (.startsWith "1.8")))

(def indented-xml
  (str
   "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
   (when-not (jdk8?) "\n")
   "<foo>
  <bar/>
</foo>
"))

(deftest test-indent
  (is (= indented-xml (indent-str (parse-str xml)))))

Fix indentation on a test for JDK 6 and 7

JDK 8 includes a newline after the XML declaration, JDK 6 and 7 do not
which is causing the build to fail on 6 and 7.


(ns akvo.lumen.specs
  (:require [clojure.spec.alpha :as s]
            [clojure.spec.gen.alpha :as gen]
            [akvo.lumen.util :refer (squuid)]
            [clojure.tools.logging :as log]))

(defn keyname [key] (str (namespace key) "/" (name key)))

(defn sample-with-gen [s map-gen amount]
  (map first (s/exercise s amount map-gen)))

(defn sample
  ([s]
   (sample s 1))
  ([s amount]
   (let [res (map first (s/exercise s amount))]
     (if (== 1 amount)
       (first res)
       res))))

(defn str-uuid? [v]
  (when (some? v)
    (uuid? (read-string (format "#uuid \"%s\"" v)))))

(s/def ::str-uuid
  (s/with-gen
    str-uuid?
    #(s/gen (reduce (fn [c _] (conj c (str (squuid)))) #{} (range 100)))))

(s/def ::sort #{"ASC" "DESC"})

(defn sample-with-filter
  "generates a sample satisfying a filter condition."
  ([spec filter-fun]
   (sample-with-filter spec filter-fun 10))
  ([spec filter-fun attempts]
   (loop [attempt 0]
     (let [res (filter filter-fun (sample spec attempts))]
       (if (and (empty? res) (< attempt attempts))
         (recur (inc attempt))
         (first res))))))

Add sample-with-filter generator utility spec function