(defproject mvMusic "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [compojure "1.1.5"]]
  :plugins [[lein-ring "0.8.5"]]
  :ring {:handler mvMusic.handler/app}
  :profiles
  {:dev {:dependencies [[ring-mock "0.1.5"]]}})

(defproject mvMusic "0.1.0-SNAPSHOT"
  :description "A server application for converting and downloading music with a web front end"
  :url "https://github.com/DanPallas/mvMusic.git"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [compojure "1.1.5"]
                 [hiccup "1.0.4"]]
  :plugins [[lein-ring "0.8.7"]]
  :ring {:handler mvMusic.handler/app}
  :profiles
  {:dev {:dependencies [[ring-mock "0.1.5"]]}})

Add dependency hiccup and update ring to 0.8.7


(defproject finagle-clojure "0.1.0"
  :description "A light wrapper around Finagle for Clojure"
  :url "https://github.com/twitter/finagle-clojure"
  :license {:name "Apache License, Version 2.0"
            :url "https://www.apache.org/licenses/LICENSE-2.0"}
  :dependencies [[finagle-clojure/core "0.1.0"]
                 [finagle-clojure/thrift "0.1.0"]]
  :plugins [[lein-sub "0.3.0"]
            [codox "0.8.10"]
            [lein-midje "3.1.3"]]
  :sub ["core" "thrift"]
  :codox {:sources ["core/src" "thrift/src"]
          :defaults {:doc/format :markdown}
          :output-dir "doc/codox"
          :src-dir-uri "http://github.com/samn/finagle-clojure/blob/v0.1.0/"
          :src-linenum-anchor-prefix "L"})

(defproject finagle-clojure "0.1.0"
  :description "A light wrapper around Finagle for Clojure"
  :url "https://github.com/twitter/finagle-clojure"
  :license {:name "Apache License, Version 2.0"
            :url "https://www.apache.org/licenses/LICENSE-2.0"}
  :dependencies [[finagle-clojure/core "0.1.0"]
                 [finagle-clojure/thrift "0.1.0"]]
  :plugins [[lein-sub "0.3.0"]
            [codox "0.8.10"]
            [lein-midje "3.1.3"]]
  :sub ["core" "thrift"]
  :codox {:sources ["core/src" "thrift/src"]
          :defaults {:doc/format :markdown}
          :output-dir "doc/codox"
          :src-dir-uri "https://github.com/finagle/finagle-clojure/blob/v0.1.0/"
          :src-linenum-anchor-prefix "L"})

Set codox src-dir-uri to github.com/finagle

not samn


(defproject io.aviso/twixt "0.1.3"
  :description "An extensible asset pipeline for Clojure web applications"
  :url "https://github.com/AvisoNovate/twixt"
  :license {:name "Apache Sofware Licencse 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ring/ring-core "1.2.0"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.1.2"]
                 [de.neuland/jade4j "0.3.15"]
                 [hiccup "1.0.4"]]
  :repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]]
  :repl-options {
                 :init-ns io.aviso.launch
                 :port 4001}
  ;; The Sublime Text nREPL plugin is out of date, so...
  :repl-port 4001
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

(defproject io.aviso/twixt "0.1.3"
  :description "An extensible asset pipeline for Clojure web applications"
  :url "https://github.com/AvisoNovate/twixt"
  :license {:name "Apache Sofware Licencse 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ring/ring-core "1.2.0"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.1.2"]
                 [de.neuland/jade4j "0.3.15"]
                 [io.aviso/pretty "0.1.3"]
                 [hiccup "1.0.4"]]
  :repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]]
  :repl-options {
                 :init-ns io.aviso.launch
                 :port 4001}
  ;; The Sublime Text nREPL plugin is out of date, so...
  :repl-port 4001
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

Add io.aviso:pretty as a dependency

Add io.aviso:pretty as a dependency


(ns coffee-table.component.web-server
  (:require [bidi.vhosts :refer [vhosts-model]]
            [schema.core :as s]
            [coffee-table.component.visits :refer [visit-routes]]
            [com.stuartsierra.component :as component]
            [yada.yada :as yada]
            [taoensso.timbre :as timbre]))

(timbre/refer-timbre)

(s/defn routes
  "Create the URI route structure for our application."
  [visits]
  [""
   [
    ["/hello" (yada/handler "Hello World")]
    ["/api" [(visit-routes visits)]]
    [true (yada/handler nil)]]])

(s/defrecord WebServer [host port visits listener]
  component/Lifecycle
  (start [component]
    (if listener
      component ; idempotence
      (let [vhosts-model (vhosts-model [{:scheme :http :host host} (routes visits)])
            listener (yada/listener vhosts-model {:port port})]
        (info ::started "using port %s, host %s" (:port listener) host)
        (assoc component :listener listener))))

  (stop [component]
    (when-let [close (get-in component [:listener :close])]
      (close))
    (assoc component :listener nil)))

(defn new-web-server [m]
  (component/using
   (map->WebServer m)
   [:visits]))

(ns coffee-table.component.web-server
  (:require [bidi.vhosts :refer [vhosts-model]]
            [schema.core :as s]
            [coffee-table.component.visits :refer [visit-routes]]
            [com.stuartsierra.component :as component]
            [yada.yada :as yada]
            [yada.swagger :refer [swaggered]]
            [taoensso.timbre :as timbre]))

(timbre/refer-timbre)

(s/defn routes
  "Create the URI route structure for our application."
  [visits]
  [""
   [
    ["/api" (swaggered (visit-routes visits)
                       {:info {:title "Visits"
                               :version "1.0"
                               :description "A visits service"}
                        :basePath "/api"})]
    [true (yada/handler nil)]]])

(s/defrecord WebServer [host port visits listener]
  component/Lifecycle
  (start [component]
    (if listener
      component ; idempotence
      (let [vhosts-model (vhosts-model [{:scheme :http :host host} (routes visits)])
            listener (yada/listener vhosts-model {:port port})]
        (info ::started "using port %s, host %s" (:port listener) host)
        (assoc component :listener listener))))

  (stop [component]
    (when-let [close (get-in component [:listener :close])]
      (close))
    (assoc component :listener nil)))

(defn new-web-server [m]
  (component/using
   (map->WebServer m)
   [:visits]))

Add swagger to API endpoints

Add swagger to API endpoints


(ns replme.components.docker
  (:require [com.stuartsierra.component :as component]
            [docker.core :as docker]
            [clojure.tools.logging :as log]))

(defrecord Docker [url client]
  component/Lifecycle
  (start [component]
    (if (:client component)
      component
      (do (log/info (str "Connecting to docker server at " url))
          (assoc component :client (docker/make-client url)))))

  (stop [component]
    (if-not (:client component)
      component
      (do (log/info "Disconnected from Docker")
          (dissoc component :client)))))

(defn new-docker
  [url]
  (map->Docker {:url url}))

(ns replme.components.docker
  (:require [com.stuartsierra.component :as component]
            [docker.core :as docker]
            [docker.container :as container]
            [clojure.tools.logging :as log]))

(defrecord Docker [url client]
  component/Lifecycle
  (start [component]
    (if (:client component)
      component
      (do (log/info (str "Connecting to docker server at " url))
          (let [client (docker/make-client url)]
            (doseq [old-container (map :Id (container/show-all client))]
              (container/remove client old-container :force true))
            (assoc component :client client)))))

  (stop [component]
    (if-not (:client component)
      component
      (do (log/info "Disconnected from Docker")
          (dissoc component :client)))))

(defn new-docker
  [url]
  (map->Docker {:url url}))

Remove old containers on startup

Remove old containers on startup


(defproject brute "0.4.0-SNAPSHOT"
  :description "A simple and lightweight Entity Component System library for writing games with Clojure"
  :url "http://www.github.com/markmandel/brute"
  :license {:name "Eclipse Public License"
            :url  "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [org.clojure/math.numeric-tower "0.0.4"]]
  :plugins [[lein-codox "0.9.0"]
            [lein-cljsbuild "1.1.1"]]
  :cljsbuild {:builds
              [{:id           "src"
                :source-paths ["src"]
                :compiler     {:output-to     "target/js/src/brute.js"
                               :output-dir    "target/js/src"
                               :source-map    true
                               :optimizations :none
                               :pretty-print  true}}
               {:id           "test"
                :source-paths ["src" "test"]
                :compiler     {:output-to     "target/js/test/brute.js"
                               :output-dir    "target/js/test"
                               :source-map    true
                               :optimizations :none
                               :pretty-print  true}}]}
  :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]]
                   :source-paths ["dev"]
                   :repl-options {:init-ns user}
                   :codox        {:output-dir "doc/codox"}}})

(defproject brute "0.4.0-SNAPSHOT"
  :description "A simple and lightweight Entity Component System library for writing games with Clojure"
  :url "http://www.github.com/markmandel/brute"
  :license {:name "Eclipse Public License"
            :url  "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [org.clojure/math.numeric-tower "0.0.4"]]
  :plugins [[lein-codox "0.9.0"]
            [lein-cljsbuild "1.1.1"]]
  :cljsbuild {:builds {:src  {:source-paths ["src"]
                              :compiler     {:output-to     "target/js/src/brute.js"
                                             :output-dir    "target/js/src"
                                             :source-map    true
                                             :optimizations :none
                                             :pretty-print  true}}
                       :test {:source-paths ["src" "test"]
                              :compiler     {:output-to     "target/js/test/brute.js"
                                             :output-dir    "target/js/test"
                                             :source-map    true
                                             :optimizations :none
                                             :pretty-print  true}}}}
  :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]]
                   :source-paths ["dev"]
                   :repl-options {:init-ns user}
                   :codox        {:output-dir "doc/codox"}}})

Make it a map, easier to look at.

Make it a map, easier to look at.


(defproject pomo "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [sablono "0.3.6"]]
  :plugins [[lein-figwheel "0.5.0-1"]]
  :clean-targets [:target-path "out" "resources/public/cljs"]
  :cljsbuild {
              :builds [{:id "dev"
                        :source-paths ["src"]
                        :figwheel {:on-jsload "pomo.core/render!"}
                        :compiler {:main pomo.core
                                   :asset-path "cljs/out"
                                   :output-to "resources/public/cljs/main.js"
                                   :output-dir "resources/public/cljs/out"}
                        }]
              }
  :figwheel {
             :css-dirs ["resources/public/css"]
             }
  )

(defproject pomo "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [sablono "0.3.6"]]
  :plugins [[lein-figwheel "0.5.0-1"]
            [lein-cljsbuild "1.1.2"]]
  :clean-targets [:target-path "out" "resources/public/cljs"]
  :cljsbuild {
              :builds [{:id "dev"
                        :source-paths ["src"]
                        :figwheel {:on-jsload "pomo.core/render!"}
                        :compiler {:main pomo.core
                                   :asset-path "cljs/out"
                                   :output-to "resources/public/cljs/main.js"
                                   :output-dir "resources/public/cljs/out"}
                        }
                       {:id "prod"
                        :source-paths ["src"]
                        :compiler {:asset-path "cljs/out"
                                   :output-to "resources/public/cljs/main.js"
                                   :optimizations :advanced}
                        }
                       ]
              }
  :figwheel {
             :css-dirs ["resources/public/css"]
             }
  )

Add lein-cljsbuild and a "prod" config

Add lein-cljsbuild and a "prod" config


(defproject com.draines/postal "1.10.0"
  :repositories {"java.net" "http://download.java.net/maven/2"}
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [commons-codec "1.7"]
                 [javax.mail/mail "1.4.4"
                  :exclusions [javax.activation/activation]]])

(defproject com.draines/postal "1.10.0"
  :repositories {"java.net" "http://download.java.net/maven/2"}
  :dependencies [[commons-codec "1.7"]
                 [javax.mail/mail "1.4.4"
                  :exclusions [javax.activation/activation]]]
  :profiles {:dev {:dependencies [[org.clojure/clojure "1.5.1"]]}
             :1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
             :1.4 {:dependencies [[org.clojure/clojure "1.4.0"]]}})

Move clojure out of proper deps.

Move clojure out of proper deps.


(ns isla.test.interpreter
  (:use [isla.interpreter])
  (:use [isla.parser])
  (:use [clojure.test])
  (:use [clojure.pprint]))

(deftest integer-assignment
  (let [result (interpret (parse "isla is 1"))]
    (is (= (get (:ctx result) "isla")
           1))))

(deftest test-single-invoke-returns-return-value
  (let [result (interpret (parse "write 2"))]
    (is (= (:ret result) 2))))

(deftest test-next-expression-overwrites-ret-of-previous
  (let [result (interpret (parse "write 2\nwrite 3"))]
    (is (= (:ret result) 3))))

(deftest test-second-not-returning-expression-removes-ret-value-of-prev
  (let [result (interpret (parse "write 2"))]
    (is (= (:ret result) 2)) ;; check first would have ret val

    ;; run test
    (let [result (interpret (parse "write 2\nage is 1"))]
    (is (nil? (:ret result))))))

(deftest test-write-assigned-value
  (let [result (interpret (parse "name is 'mary'\nwrite name"))]
    (is (= (:ret result) "mary"))))

Add test for writing out assigned value.


{:repl {:plugins [[cider/cider-nrepl "0.18.0-SNAPSHOT"]
                  [refactor-nrepl "2.4.0-SNAPSHOT"]]
        :dependencies
        [[acyclic/squiggly-clojure "0.1.9-SNAPSHOT" :exclusions [org.clojure/tools.reader]]
         [compliment "0.3.5"]]}
 :env {:squiggly
       "{:checkers [:eastwood]
         :eastwood-exclude-linters [:unlimited-use :no-ns-form-found]}"}}

{:repl {:plugins [[refactor-nrepl "2.4.0-SNAPSHOT"]
                  [cider/cider-nrepl "0.20.0"]]
        :dependencies
        [[org.clojure/tools.nrepl "0.2.13"]
         [acyclic/squiggly-clojure "0.1.9-SNAPSHOT" :exclusions [org.clojure/tools.reader]]
         [compliment "0.3.5"]]}
 :env {:squiggly
       "{:checkers [:eastwood]
         :eastwood-exclude-linters [:unlimited-use :no-ns-form-found]}"}}

Update to latest cider version.

Update to latest cider version.


(ns user
  (:require [dashboard-clj.system :as s]
            [figwheel-sidecar.repl-api :as figwheel]
            [com.stuartsierra.component :as component]
            [clojure.tools.namespace.repl :as repl-tools]
            [environ.core :refer [env]]))

;; Let Clojure warn you when it needs to reflect on types, or when it does math
;; on unboxed numbers. In both cases you should add type annotations to prevent
;; degraded performance.
(set! *warn-on-reflection* true)
(set! *unchecked-math* :warn-on-boxed)

(def system)

(defn run [datasources]
  (alter-var-root #'system (fn [_]
                             (s/start (Integer/parseInt (env :http-port)) datasources)))
  (figwheel/start-figwheel!))

(defn stop []
  (alter-var-root #'system component/stop)
  (figwheel/stop-figwheel!))

(def browser-repl figwheel/cljs-repl)

(ns user
  (:require [dashboard-clj.core :as dashboard]
            [figwheel-sidecar.repl-api :as figwheel]
            [com.stuartsierra.component :as component]
            [clojure.tools.namespace.repl :as repl-tools]
            [environ.core :refer [env]]))

;; Let Clojure warn you when it needs to reflect on types, or when it does math
;; on unboxed numbers. In both cases you should add type annotations to prevent
;; degraded performance.
(set! *warn-on-reflection* true)
(set! *unchecked-math* :warn-on-boxed)

(def system)

(defn run [ds-maps]
  (alter-var-root #'system (fn [_]
                             (dashboard/start  ds-maps {:port (Integer/parseInt (env :http-port))})))
  (figwheel/start-figwheel!))

(defn stop []
  (alter-var-root #'system component/stop)
  (figwheel/stop-figwheel!))

(defn reload-namespaces []
  (stop)
  (repl-tools/refresh))

(def browser-repl figwheel/cljs-repl)

Add helper method to reload namespaces after stopping the system


{:user {:dependencies [[slamhound "1.3.1"]
                       [org.clojure/tools.namespace "0.2.4"]
                       [clj-stacktrace "0.2.7"]]

        :plugins [[lein-pprint "1.1.1"]
                  [lein-difftest "2.0.0"]
                  [lein-cloverage "1.0.2"]
                  [lein-marginalia "0.7.1"]
                  [lein-swank "1.4.4"]
                  [lein-kibit "0.0.8"]]

        :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                            'print-cause-trace)
                           new (ns-resolve (doto 'clj-stacktrace.repl require)
                                           'pst)]
                       (alter-var-root orig (constantly (deref new))))]}}

        :aliases {"slamhound" ["run" "-m" "slam.hound"]}
        :source-paths ["/Users/jcf/.lein/dev"]
        :search-page-size 30}}

{:user {:dependencies [[slamhound "1.3.1"]
                       [org.clojure/tools.namespace "0.2.4"]
                       [clj-stacktrace "0.2.7"]]

        :plugins [[lein-pprint "1.1.1"]
                  [lein-difftest "2.0.0"]
                  [lein-cloverage "1.0.2"]
                  [lein-marginalia "0.7.1"]
                  [lein-swank "1.4.4"]
                  [lein-kibit "0.0.8"]
                  [jonase/eastwood "0.0.2"]]

        :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                            'print-cause-trace)
                           new (ns-resolve (doto 'clj-stacktrace.repl require)
                                           'pst)]
                       (alter-var-root orig (constantly (deref new))))]}}

        :aliases {"slamhound" ["run" "-m" "slam.hound"]}
        :source-paths ["/Users/jcf/.lein/dev"]
        :search-page-size 30}}

Add Eastwood to Clojure plugins

Add Eastwood to Clojure plugins


;; Used for CSV-import of a very special file-format

(ns holston.dataimport
  (:require [clojure-csv.core :as csv]
            [holston.repository :as repo])
  (:use [clojure.java.io :only [reader]]))

(defn take-csv [file-name]
  (with-open [file (reader file-name)]
    (csv/parse-csv (slurp file))))

(defn parse-row [row]
  {:name (get row 4) :brewery (get row 5)})

(defn parse-tastings [file-name]
  (map parse-row (rest (take-csv file-name))))

(defn import-data [file-name]
  (doseq [tasting (parse-tastings file-name)]
    (println "Importing" tasting)
    (repo/add-tasting tasting)))

;; Used for CSV-import of a very special file-format
;; Example usage:
;; lein run -m holston.dataimport/import-data "/Users/auramo/Downloads/olusia.csv"

(ns holston.dataimport
  (:require [clojure-csv.core :as csv]
            [holston.repository :as repo])
  (:use [clojure.java.io :only [reader]]))

(defn take-csv [file-name]
  (with-open [file (reader file-name)]
    (csv/parse-csv (slurp file))))

(defn parse-row [row]
  {:name (get row 4) :brewery (get row 5)})

(defn parse-tastings [file-name]
  (map parse-row (rest (take-csv file-name))))

(defn import-data [file-name]
  (doseq [tasting (parse-tastings file-name)]
    (println "Importing" tasting)
    (repo/add-tasting tasting)))

Add example usage comment which was tried and tested


(ns icecap.handlers.http-test
  (:require [clojure.core.async :as a]
            [manifold.deferred :as d]
            [icecap.handlers.core :refer [execute]]
            [icecap.schema :refer [check-plan]]
            [icecap.handlers.http]
            [aleph.http :as h]
            [clojure.test :refer :all]))

(def step
  {:type :http :url "http://www.example.com"})

(deftest schema-tests
  (testing "valid steps"
         step)))
    (are [s] (nil? (check-plan s))

(def fake-response
  {})

(defn fake-request
  [_]
  (d/success-deferred fake-response))

(deftest execute-tests
  (with-redefs
    [h/request fake-request]
    (is (let [ch (execute step)
              [result] (a/<!! (a/into [] ch))]
          (= result fake-response)))))

(ns icecap.handlers.http-test
  (:require [clojure.core.async :as a]
            [manifold.deferred :as d]
            [icecap.handlers.core :refer [execute]]
            [icecap.schema :refer [check-plan]]
            [icecap.handlers.http]
            [aleph.http :as h]
            [clojure.test :refer :all]))

(def url
  "http://www.example.com")

(def step
  {:type :http :url url})

(deftest schema-tests
  (testing "valid steps"
    (are [s] (nil? (check-plan s))
         step))
  (testing "invalid steps"
    (are [s expected] (= (check-plan (merge {:type :http} s))
                         expected)
         {} '{:url missing-required-key}
         {:uri url} '{:uri disallowed-key
                      :url missing-required-key})))

(def fake-response
  {})

(defn fake-request
  [_]
  (d/success-deferred fake-response))

(deftest execute-tests
  (with-redefs
    [h/request fake-request]
    (is (let [ch (execute step)
              [result] (a/<!! (a/into [] ch))]
          (= result fake-response)))))

Add some failing schema tests

Add some failing schema tests

Refs #14.


(ns cruncher.utils.status
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [cljs.core.async :refer [<!]]
            [cruncher.communication.main :as com]
            [cruncher.config :as config]
            [cruncher.utils.extensions]
            [cruncher.utils.views :as vlib]
            [cruncher.utils.lib :as lib])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(defn success-handler []
  (om/transact! lib/reconciler `[(status/niantic {:status true})]))

(defn error-handler []
  (om/transact! lib/reconciler `[(status/niantic {:status false})]))

(defui APITest
  static om/IQuery
  (query [_]
    [:api :connected?])
  Object
  (render [this]
    (let [{:keys [connected?]} (om/props this)]
      (dom/div nil
               (vlib/button (fn [] (com/ajax-get (:api-status config/api) success-handler error-handler false))
                            true "Test API" "btn-default btn-xs")
               (when (nil? connected?)
                 (com/ajax-get (:api-status config/api) success-handler error-handler false))
               (if connected?
                 (dom/span #js {:className "label label-success"} "API connected")
                 (dom/span #js {:className "label label-warning"} "API not connected"))))))
(def api-test (om/factory APITest {}))

(ns cruncher.utils.status
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [cljs.core.async :refer [<!]]
            [cruncher.communication.main :as com]
            [cruncher.config :as config]
            [cruncher.utils.extensions]
            [cruncher.utils.views :as vlib]
            [cruncher.utils.lib :as lib])
  (:require-macros [cljs.core.async.macros :refer [go]]))

(defn success-handler []
  (om/transact! lib/reconciler `[(status/niantic {:status true})]))

(defn error-handler []
  (om/transact! lib/reconciler `[(status/niantic {:status false})]))

(defui APITest
  static om/IQuery
  (query [_]
    [:api :connected?])
  Object
  (render [this]
    (let [{:keys [connected?]} (om/props this)]
      (when (nil? connected?)
        (com/ajax-get (:api-status config/api) success-handler error-handler false))
      (dom/div nil
               (vlib/button (fn [] (com/ajax-get (:api-status config/api) success-handler error-handler false))
                            true "Test API" "btn-default btn-xs")
               (if connected?
                 (dom/span #js {:className "label label-success"} "API connected")
                 (dom/span #js {:className "label label-warning"} "API not connected"))))))
(def api-test (om/factory APITest {}))

Move ajax call to top

Move ajax call to top


(ns cljs.lean-map.test.core
  (:require
    [cljs.test :refer-macros [deftest]]
    [collection-check.core :as cc]
    [clojure.test.check.generators :as gen]
    [cljs.lean-map.core :as lean-map.core]))

(def gen-element
  (gen/tuple gen/int))

(deftest assert-lean-map-core-map-like
  (cc/assert-map-like 100 (.-EMPTY lean-map.core/PersistentHashMap) gen-element gen-element))

(ns cljs.lean-map.test.core
  (:require
    [cljs.test :refer-macros [deftest]]
    [collection-check.core :as cc]
    [clojure.test.check.generators :as gen]
    [cljs.lean-map.core :as lean-map.core]))

(defrecord BadHashNumber [num])

(extend-protocol IHash
  BadHashNumber
  (-hash [_]
    1))

(def gen-bad-hash
  (gen/fmap (partial apply ->BadHashNumber) (gen/tuple gen/int)))

(def gen-key
  (gen/tuple (gen/frequency [[9 gen/int] [1 gen-bad-hash]])))

(def gen-value
  (gen/tuple gen/int))

(deftest assert-lean-map-core-map-like
  (cc/assert-map-like 100 (.-EMPTY lean-map.core/PersistentHashMap) gen-key gen-value))

Create keys that have hash collision

Create keys that have hash collision

Previously lean-map used keys that had no hash collisions. No a datatype is used that hash only a single hashcode


(ns sleuth.handler
  (:use compojure.core
        ring.middleware.edn
        ring.middleware.json
        sleuth.util
        [ring.adapter.jetty :only [run-jetty]])
  (:require [compojure.handler :as handler]
            [compojure.route :as route]
            [sleuth.auth :as auth]
            [sleuth.users :as user]
            [sleuth.sites :as sites]
            [sleuth.events :as events]
            [monger.core :as m]))

(m/connect!)
(m/set-db! (m/get-db "sleuth-dev"))

(defn wrap-dir-index
  [handler]
  (fn [req]
    (handler (update-in req [:uri]
                        #(if (= "/" %) "/index.html" %)))))

(defroutes app-routes
  (context "/events" [] events/event-routes)
  (context "/sites" [] sites/site-routes)
  (context "/auth" [] auth/auth-routes)
  (route/resources "/")
  (route/not-found "Not Found"))

(def app (-> app-routes
             wrap-dir-index
             wrap-edn-params
             wrap-json-params
             wrap-json-response))

(defn -main
  [port]
  (run-jetty app {:port (Integer. port)}))

(ns sleuth.handler
  (:use compojure.core
        ring.middleware.edn
        ring.middleware.json
        sleuth.util
        [ring.adapter.jetty :only [run-jetty]])
  (:require [compojure.handler :as handler]
            [compojure.route :as route]
            [sleuth.auth :as auth]
            [sleuth.users :as user]
            [sleuth.sites :as sites]
            [sleuth.events :as events]
            [monger.core :as m]))
(if-let [mongo-uri (get (System/getenv) "MONGOHQ_URL")]
  (m/connect-via-uri! mongo-uri)
  (m/connect!))

(m/set-db! (m/get-db "sleuth-dev"))

(defn wrap-dir-index
  [handler]
  (fn [req]
    (handler (update-in req [:uri]
                        #(if (= "/" %) "/index.html" %)))))

(defroutes app-routes
  (context "/events" [] events/event-routes)
  (context "/sites" [] sites/site-routes)
  (context "/auth" [] auth/auth-routes)
  (route/resources "/")
  (route/not-found "Not Found"))

(def app (-> app-routes
             wrap-dir-index
             wrap-edn-params
             wrap-json-params
             wrap-json-response))

(defn -main
  [port]
  (run-jetty app {:port (Integer. port)}))

Add connection to mongohq database

Add connection to mongohq database


(ns attendance.server
  (:require [clojure.java.io :as io]
            [compojure.core :refer [GET defroutes]]
            [compojure.route :refer [resources]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.gzip :refer [wrap-gzip]]
            [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
            [environ.core :refer [env]]
            [ring.adapter.jetty :refer [run-jetty]]

            [attendance.google.sheets :refer [reflect-spreadsheets]])
  (:gen-class))

(defroutes routes
  (resources "/")
  (GET "/sheets" _ (reflect-spreadsheets)))

(def http-handler
  (-> routes
      wrap-json-body
      wrap-json-response
      (wrap-defaults api-defaults)
      wrap-gzip))

(defn -main [& [port]]
  (let [port (Integer. (or port (env :port) 10555))]
    (run-jetty http-handler {:port port :join? false})))

(ns attendance.server
  (:require [clojure.java.io :as io]
            [compojure.core :refer [GET defroutes]]
            [compojure.route :refer [resources]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.gzip :refer [wrap-gzip]]
            [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
            [environ.core :refer [env]]
            [ring.adapter.jetty :refer [run-jetty]]
            [attendance.google.sheets :refer [reflect-spreadsheets]])
  (:gen-class))

(defroutes routes
  (resources "/")
  (GET "/sheets" _
    {:body (reflect-spreadsheets)}))

(def http-handler
  (-> routes
      wrap-json-body
      wrap-json-response
      (wrap-defaults api-defaults)
      wrap-gzip))

(defn -main [& [port]]
  (let [port (Integer. (or port (env :port) 10555))]
    (run-jetty http-handler {:port port :join? false})))

Make sure the JSON gets the correct content type


(ns integration-spec
  (:use speclj.core)
  (:require
    [org.example.server :as server]
    [clj-http.client :as client]))

(describe "integration"
  (with-all server (server/start-server 8080))

  (it "can start the server"
      (should-not-be-nil @server))

  (after-all
    ;; start-server returns a function to stop the server, invoke it after all characteristics
    ;; have executed.
    (@server))

  (it "can get current counters"

      (let [response (client/get "http://localhost:8080/counters")]
        (->> response
            :body
            read-string
            (should= {"foo" 0 "bar" 0})))))

(run-specs)

(ns integration-spec
  (:use speclj.core)
  (:require
    [org.example.server :as server]
    [clj-http.client :as client]))

(describe "integration"
  (with-all server (server/start-server 8080))

  ;; Force the server to start up
  (before-all @server)

  ;; And shut it down at the very end
  (after-all
    ;; start-server returns a function to stop the server, invoke it after all characteristics
    ;; have executed.
    (@server))

  (it "can get current counters"

      (let [response (client/get "http://localhost:8080/counters"
                                 {:accept :edn})]
        (->> response
            :body
            read-string
            (should= {"foo" 0 "bar" 0})))))

(run-specs)

Fix the test case to request the response as application/edn


(ns cljs.core)

(def defmacro (fn [name & fdecl]
	`(do
        (def ~name (fn ~@fdecl))
        (set! (. ~name macro) true))))

(set! (. defmacro macro) true)

(defmacro defn [name & fdecl]
	`(def ~name (fn ~@fdecl))
)

(defn second [x] (first (next x)))

(defn ffirst [x] (first (first x)))

(defn nfirst [x] (next (first x)))

(defn fnext [x] (first (next x)))

(defn nnext [x] (next (next x)))

(defmacro println [& args]
    `(js/console.log (str ~@args))

(ns cljs.core)

(def defmacro (fn [name & fdecl]
	`(do
        (def ~name (fn ~@fdecl))
        (set! (. ~name macro) true))))

(set! (. defmacro macro) true)

(defmacro defn [name & fdecl]
	`(def ~name (fn ~@fdecl))
)

(defn second [x] (first (next x)))

(defn ffirst [x] (first (first x)))

(defn nfirst [x] (next (first x)))

(defn fnext [x] (first (next x)))

(defn nnext [x] (next (next x)))

(defmacro println [& args]
    `(.log js/console ((str ~@args)))

Refactor println to use .log on js/console


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

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

Update version info and deploy to clojars.


(ns mikron.compiler.util-macros
  #?(:cljs [:require-macros mikron.compiler.util-macros]))

(defmacro compile-time
  "Emits the body only at compile time."
  [& body]
  (when #?(:clj  (not (:ns &env))
           :cljs (re-matches #".*\$macros" (name (ns-name *ns*))))
    `(do ~@body)))

(ns mikron.compiler.util-macros
  #?(:cljs [:require-macros mikron.compiler.util-macros]))

(defmacro compile-time
  "Emits the body only at compile time."
  [& body]
  (when #?(:clj (not (:ns &env)))
    `(do ~@body)))

Change compile-time to always emit in self hosted cljs


(ns app.analysis
  "GitHub releases URL analysis"
  (:require
    [taoensso.timbre :as timbre :refer-macros [info]]))

(defn get-os
  [url]
  (cond
    (boolean (re-find #"windows" url)) "Windows"
    (boolean (re-find #"linux" url)) "Linux"
    (boolean (re-find #"mac|.dmg" url)) "Mac OS X"
    :else "Other"))

(defn get-word-size
  [url]
  (cond
    (boolean (re-find #"x86_64" url)) "64-bit"
    (boolean (re-find #"x64" url)) "64-bit"
    (boolean (re-find #"x86" url)) "32-bit"
    :else ""))

(defn get-file-type
  [url]
  (cond
    (boolean (re-find #".zip" url)) "Portable"
    (boolean (re-find #".tar.gz" url)) "Portable"
    (boolean (re-find #".dmg" url)) "Disk Image"
    :else "Installer"))

(defn analyze-download-url
  [asset-info]
  (let [{url :browser-download-url} asset-info]
    {:os (get-os url) :word-size (get-word-size url)
     :file-type (get-file-type url) :url url}))

(defn build-download-map
  [asset-info-vector]
  (group-by :os (map analyze-download-url asset-info-vector)))

(ns app.analysis
  "GitHub releases URL analysis"
  (:require
    [taoensso.timbre :as timbre :refer-macros [info]]))

(defn get-os
  [url]
  (cond
    (boolean (re-find #"windows" url)) "Windows"
    (boolean (re-find #"linux" url)) "Linux"
    (boolean (re-find #"mac|.dmg" url)) "macOS"
    :else "Other"))

(defn get-word-size
  [url]
  (cond
    (boolean (re-find #"x86_64" url)) "64-bit"
    (boolean (re-find #"x64" url)) "64-bit"
    (boolean (re-find #"x86" url)) "32-bit"
    :else ""))

(defn get-file-type
  [url]
  (cond
    (boolean (re-find #".zip" url)) "Portable"
    (boolean (re-find #".tar.gz" url)) "Portable"
    (boolean (re-find #"mac|.dmg" url)) "Disk Image"
    :else "Installer"))

(defn analyze-download-url
  [asset-info]
  (let [{url :browser-download-url} asset-info]
    {:os (get-os url) :word-size (get-word-size url)
     :file-type (get-file-type url) :url url}))

(defn build-download-map
  [asset-info-vector]
  (group-by :os (map analyze-download-url asset-info-vector)))

Update Mac OS name and file types

Update Mac OS name and file types


#!/usr/bin/env boot

#tailrecursion.boot.core/version "2.0.0"

(set-env!
  :dependencies  [['tailrecursion/boot.core   "2.0.0"]
                  ['tailrecursion/boot.task   "2.0.0"]
                  ['tailrecursion/hoplon      "5.0.0"]
                  ['markdown-clj              "0.9.38"]
                  ['org.clojure/clojurescript "0.0-2156"]]
  :src-paths     #{"src"}
  :out-path      "resources/public")

(add-sync! (get-env :out-path) #{"resources/assets"})

(require
  ['tailrecursion.boot.task   :refer :all]
  ['tailrecursion.hoplon.boot :refer :all])

(deftask dev
  "Build hoplon.io for local development."
  []
  (comp (watch) (hoplon {:pretty-print  true
                         :prerender     false
                         :optimizations :whitespace})))

(deftask prod
  "Build hoplon.io for production deployment."
  []
  (hoplon {:optimizations :advanced}))

#!/usr/bin/env boot

#tailrecursion.boot.core/version "2.3.1"

(set-env!
  :dependencies  [['tailrecursion/boot.task   "2.1.2"]
                  ['tailrecursion/hoplon      "5.7.0"]
                  ['markdown-clj              "0.9.41"]
                  ['org.clojure/clojurescript "0.0-2156"]]
  :src-paths     #{"src"}
  :out-path      "resources/public")

(add-sync! (get-env :out-path) #{"resources/assets"})

(require
  ['tailrecursion.boot.task   :refer :all]
  ['tailrecursion.hoplon.boot :refer :all])

(deftask dev
  "Build hoplon.io for local development."
  []
  (comp (watch) (hoplon {:pretty-print  true
                         :prerender     false
                         :optimizations :whitespace})))

(deftask prod
  "Build hoplon.io for production deployment."
  []
  (hoplon {:optimizations :advanced}))

Update dependencies to the latest hoplon...

...boot.task and boot.core


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

;; See: https://github.com/kumarshantanu/lein-localrepo
{:user {:plugins [[lein-localrepo "0.5.4"]
                  [lein-try "0.4.3"]
                  ;; Convert pom.xml to project.clj
                  ;; Note: from https://github.com/thickey/lein-nevam
                  [lein-nevam "0.1.2"]
                  ;; https://github.com/venantius/ultra
                  [venantius/ultra "0.5.2"]]
        ;; Experimental
        :dependencies [[pjstadig/humane-test-output "0.8.3"]]
        :injections [(require 'pjstadig.humane-test-output)
                     (pjstadig.humane-test-output/activate!)]}}

Update and use some cool leiningen plugins


(ns om-chat.components.message-composer
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            ))

(def ESCAPE_KEY 27)
(def ENTER_KEY 13)

(defn change [c e]
  (om/update-state! c assoc
                    :edit-text (.. e -target -value)))

(defn key-down [c id e on-new-msg]
  (condp == (.-keyCode e)
    ENTER_KEY
    (let [msg-text (or (om/get-state c :edit-text) "")]
      (on-new-msg id msg-text)
      (doto e (.preventDefault) (.stopPropagation)))
    nil))

(defui MessageComposer
  ;; static om/IQuery
  ;; (query [this]
  ;;        :thread/id)
  Object
  (render [this]
          (let [{:keys [thread/id] :as props} (om/props this)
                {:keys [on-new-msg]} (om/get-computed props)]
;;            (println "RENDER composer: " props)
            (dom/textarea #js{:className "message-composer"
                              :name      "message"
                              :value     (om/get-state this :edit-text)
                              :onChange  #(change this %)
                              :onKeyDown #(key-down this id % on-new-msg)})
            )))

(def message-composer (om/factory MessageComposer))

(ns om-chat.components.message-composer
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            ))

(def ESCAPE_KEY 27)
(def ENTER_KEY 13)

(defn change [c e]
  (om/update-state! c assoc
                    :edit-text (.. e -target -value)))

(defn key-down [c id e on-new-msg]
  (condp == (.-keyCode e)
    ENTER_KEY
    (let [msg-text (or (om/get-state c :edit-text) "")]
      (if-not (= msg-text "") (on-new-msg id msg-text))
      (om/update-state! c assoc :edit-text "")
      (doto e (.preventDefault) (.stopPropagation)))
    nil))

(defui MessageComposer
  ;; static om/IQuery
  ;; (query [this]
  ;;        :thread/id)
  Object
  (render [this]
          (let [{:keys [thread/id] :as props} (om/props this)
                {:keys [on-new-msg]} (om/get-computed props)]
;;            (println "RENDER composer: " props)
            (dom/textarea #js{:className "message-composer"
                              :name      "message"
                              :value     (om/get-state this :edit-text)
                              :onChange  #(change this %)
                              :onKeyDown #(key-down this id % on-new-msg)})
            )))

(def message-composer (om/factory MessageComposer))

Reset textarea after message posted

Reset textarea after message posted


(ns router.core
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
            [ring.util.response :refer [response]]
            [router.haproxy :as h])
  (:gen-class))

(def services
  (atom {}))

(defn merge-services [one two]
  (let [in (one :in-port)
        outs (into (one :out-port) (two :out-port))]
    {:in-port  in
     :out-port outs}))

(defn register-service [{name :name in :in-port out :out-port}]
  (let [new-service {name {:in-port  in
                           :out-port [out]}}]
    (swap! services
           #(merge-with merge-services % new-service))))

(defroutes app-routes
  (GET "/status" [] (response (str @services)))
  (POST "/register" {body :body} (register-service body))
  (route/not-found "Not Found"))

(def app
  (-> app-routes
      (wrap-defaults api-defaults)
      (wrap-json-body {:keywords? true})
      (wrap-json-response)))

(ns router.core
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.json :refer [wrap-json-body wrap-json-response]]
            [ring.util.response :refer [response]]
            [router.haproxy :as h])
  (:gen-class))

(def services
  (atom {}))

(defn merge-services [one two]
  (let [in (one :in-port)
        outs (into (one :out-port) (two :out-port))]
    {:in-port  in
     :out-port outs}))

(defn register-service [{name :name in :in-port out :out-port}]
  (let [new-service {name {:in-port  in
                           :out-port [out]}}]
    (swap! services
           #(merge-with merge-services % new-service))))

(defroutes app-routes
  (GET "/status" [] (response (str @services)))
  (POST "/register" {body :body} (register-service body))
  (POST "/start" [] (h/start-haproxy! @services))
  (route/not-found "Not Found"))

(def app
  (-> app-routes
      (wrap-defaults api-defaults)
      (wrap-json-body {:keywords? true})
      (wrap-json-response)))

Add handler to start load balancer

Add handler to start load balancer


(defproject degasolv/degasolv "1.1.1-SNAPSHOT"
  :description "Dependency resolver with an eye toward building software."
  :url "http://github.com/djhaskin987/degasolv"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :main degasolv.cli
  :dependencies [
                 [org.clojure/clojure "1.9.0-alpha14"]
                 [version-clj "0.1.2"]
                 [org.clojure/tools.cli "0.3.5"]
                 [me.raynes/fs "1.4.6"]
                 [com.velisco/tagged "0.5.0"]
                 ]
  :plugins [[lein-print "0.1.0"]]
  :test-selectors
  {
   :resolve-basic :resolve-basic
   :resolve-harden :resolve-harden
   :string-to-requirement :string-to-requirement
   :repo-aggregation :repo-aggregation
   :resolve-conflict-strat :resolve-conflict-strat
   }
  :profiles {
             :dev {:dependencies [
                                  [org.clojure/core.match "0.3.0-alpha4"]
                                  [version-clj "0.1.2"
                                   :exclusions [org.clojure/clojure]]
                                  ]}
             :uberjar {:aot [degasolv.cli degasolv.resolver]}
             }
  :target-path "target/%s")

(defproject degasolv/degasolv "1.2.0"
  :description "Dependency tracker with an eye toward building and shipping software."
  :url "http://github.com/djhaskin987/degasolv"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :main degasolv.cli
  :dependencies [
                 [org.clojure/clojure "1.9.0-alpha14"]
                 [version-clj "0.1.2"]
                 [org.clojure/tools.cli "0.3.5"]
                 [me.raynes/fs "1.4.6"]
                 [com.velisco/tagged "0.5.0"]
                 ]
  :plugins [[lein-print "0.1.0"]]
  :test-selectors
  {
   :resolve-basic :resolve-basic
   :resolve-harden :resolve-harden
   :string-to-requirement :string-to-requirement
   :repo-aggregation :repo-aggregation
   :resolve-conflict-strat :resolve-conflict-strat
   }
  :profiles {
             :dev {:dependencies [
                                  [org.clojure/core.match "0.3.0-alpha4"]
                                  [version-clj "0.1.2"
                                   :exclusions [org.clojure/clojure]]
                                  ]}
             :uberjar {:aot [degasolv.cli degasolv.resolver]}
             }
  :target-path "target/%s")

Bump version number, improve description


(ns zetawar.devcards.scenarios
  (:require
   [datascript.core :as d]
   [devcards.core :as dc :include-macros true]
   [integrant.core :as ig]
   [posh.core :as posh]
   [reagent.core :as r]
   [zetawar.app :as app]
   [zetawar.system :as system]
   [zetawar.views :as views])
  (:require-macros
   [devcards.core :refer [defcard defcard-rg]]))

(defcard-rg sterlings-aruba-multiplayer-card
  (let [system (ig/init system/game-config)
        game-cfg (:zetwar.system/game system)
        views-cfg (:zetwar.system/game-views system)]
    (app/start-new-game! game-cfg :sterlings-aruba-multiplayer)
    [views/board views-cfg]))

(defcard-rg city-sprawl-multiplayer-card
  (let [system (ig/init system/game-config)
        game-cfg (:zetwar.system/game system)
        views-cfg (:zetwar.system/game-views system)]
    (app/start-new-game! game-cfg :city-sprawl-multiplayer)
    [views/board views-cfg]))

(ns zetawar.devcards.scenarios
  (:require
   [datascript.core :as d]
   [devcards.core :as dc :include-macros true]
   [integrant.core :as ig]
   [posh.core :as posh]
   [reagent.core :as r]
   [zetawar.app :as app]
   [zetawar.system :as system]
   [zetawar.views :as views])
  (:require-macros
   [devcards.core :refer [defcard defcard-rg]]))

(defcard-rg sterlings-aruba-multiplayer-card
  (let [system (ig/init system/game-config)
        game-cfg (:zetawar.system/game system)
        views-cfg (:zetawar.system/game-views system)]
    (app/start-new-game! game-cfg :sterlings-aruba-multiplayer)
    [views/board views-cfg]))

(defcard-rg city-sprawl-multiplayer-card
  (let [system (ig/init system/game-config)
        game-cfg (:zetawar.system/game system)
        views-cfg (:zetawar.system/game-views system)]
    (app/start-new-game! game-cfg :city-sprawl-multiplayer)
    [views/board views-cfg]))

Fix a couple devcard typos

Fix a couple devcard typos


(ns clojush.ns) ;; provides a macro that uses all clojush namespaces except for examples/* and experimental/*

(defmacro use-clojush
  []
  '(do
     (use '(clojush core evaluate globals individual interpreter pushstate random simplification util))
     (use '(clojush.instructions boolean code common numbers random-instructions return string tag zip))
     (use '(clojush.pushgp breed genetic-operators parent-selection pushgp report))))

(ns clojush.ns) ;; provides a macro that uses all clojush namespaces except for examples/* and experimental/*

(defmacro use-clojush
  []
  '(do
     (use '(clojush.core :exclude (-main)))
     (use '(clojush evaluate globals individual interpreter pushstate random simplification util))
     (use '(clojush.instructions boolean code common numbers random-instructions return string tag zip))
     (use '(clojush.pushgp breed genetic-operators parent-selection pushgp report))))

Exclude -main when doing use-clojush.

Exclude -main when doing use-clojush.


{:user {:plugins [[lein-exec "0.3.0"]
                  [lein-depgraph "0.1.0"]
                  [lein-deps-tree "0.1.2"]
                  [jonase/eastwood "0.1.2"]]
        :dependencies [[org.clojure/tools.namespace "0.2.4"]
                       [criterium "0.4.2"]
                       [slamhound "1.5.5"]]
        :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}

{:user {:plugins [[lein-exec "0.3.0"]
                  [lein-depgraph "0.1.0"]
                  [lein-deps-tree "0.1.2"]]
        :dependencies [[org.clojure/tools.namespace "0.2.4"]
                       [criterium "0.4.2"]
                       [slamhound "1.5.5"]]
        :aliases {"slamhound" ["run" "-m" "slam.hound"]}}}

[.lein] Remove eastwood; it's breaking 'lein new'


(ns runbld.build
  (:require [runbld.util.date :as date]))

(defn make-rand-uuid []
  (.replaceAll (str (java.util.UUID/randomUUID)) "-" ""))

(defn make-id []
  (format "%s-%s"
          (date/yyyymmdd-hhmmss)
          (make-rand-uuid)))

(defn wrap-build-meta [proc]
  (fn [opts]
    (proc (assoc opts :id (make-id)))))

(ns runbld.build
  (:require [runbld.util.date :as date]))

(defn make-rand-uuid []
  (.replaceAll (str (java.util.UUID/randomUUID)) "-" ""))

(defn make-id []
  (format "%s-%s"
          (date/yyyymmdd-hhmmss)
          (make-rand-uuid)))

(defn split-jenkins-name [s]
  (let [[_ org project branch] (re-find #"^([^,]+),([^,]+),([^,]+)$" s)]
    {:org org
     :project project
     :branch branch}))

(defn inherited-build-info [opts]
  (if (get-in opts [:env "JENKINS_HOME"])
    (split-jenkins-name (get-in opts [:env "JOB_NAME"]))))

(defn wrap-build-meta [proc]
  (fn [opts]
    (proc (assoc opts
                 :build (merge
                         {:id (make-id)}
                         (inherited-build-info opts))))))

Break out project org, name, branch

Break out project org, name, branch


(ns {{namespace}}
  (:import [com.badlogic.gdx Game Gdx Graphics Screen]
           [com.badlogic.gdx.graphics Color GL20]
           [com.badlogic.gdx.graphics.g2d BitmapFont]
           [com.badlogic.gdx.scenes.scene2d Stage]
           [com.badlogic.gdx.scenes.scene2d.ui Label Label$LabelStyle]))

(def main-screen
  (let [stage (atom nil)]
    (proxy [Screen] []
      (show []
        (reset! stage (Stage.))
        (let [style (Label$LabelStyle. (BitmapFont.) (Color. 1 1 1 1))
              label (Label. "Hello world!" style)]
          (.addActor @stage label)))
      (render [delta]
        (.glClearColor (Gdx/gl) 0 0 0 0)
        (.glClear (Gdx/gl) GL20/GL_COLOR_BUFFER_BIT)
        (doto @stage
          (.act delta)
          (.draw)))
      (dispose [])
      (hide [])
      (pause [])
      (resize [w h])
      (resume []))))

(gen-class
  :name {{package}}.Game
  :extends com.badlogic.gdx.Game)
(defn -create [^Game this]
  (.setScreen this main-screen))

(ns {{namespace}}
  (:import [com.badlogic.gdx Game Gdx Graphics Screen]
           [com.badlogic.gdx.graphics Color GL20]
           [com.badlogic.gdx.graphics.g2d BitmapFont]
           [com.badlogic.gdx.scenes.scene2d Stage]
           [com.badlogic.gdx.scenes.scene2d.ui Label Label$LabelStyle]))

(defn show
  [stage]
  (let [style (Label$LabelStyle. (BitmapFont.) (Color. 1 1 1 1))
        label (Label. "Hello world!" style)]
    (.addActor stage label)))

(defn render
  [stage delta]
  (.glClearColor (Gdx/gl) 0 0 0 0)
  (.glClear (Gdx/gl) GL20/GL_COLOR_BUFFER_BIT)
  (doto stage
    (.act delta)
    (.draw)))

(def main-screen
  (let [stage (atom nil)]
    (proxy [Screen] []
      (show [] (show (reset! stage (Stage.))))
      (render [delta] (render @stage delta))
      (dispose [])
      (hide [])
      (pause [])
      (resize [w h])
      (resume []))))

(gen-class
  :name {{package}}.Game
  :extends com.badlogic.gdx.Game)
(defn -create [^Game this]
  (.setScreen this main-screen))

Break out the show/render methods into funtions so Refresh redefines them


(ns leftpad.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.util.response :refer [response]]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defroutes app-routes
  (GET "/" [] (response {:foo "bar"}))
  (route/not-found "Not Found"))

(def app
  (wrap-json-response app-routes site-defaults))

(ns leftpad.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.middleware.params :refer [wrap-params]]
            [ring.util.response :refer [response]]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defroutes app-routes
  (GET "/" {:keys [params] :as request} (response {:foo (get params :str "none")}))
  (route/not-found "Not Found"))

(def app
  (-> (handler/api app-routes)
             (wrap-params)
             (wrap-json-response)))

Add working query parameter reading

Add working query parameter reading


(ns io.aviso.launch
  (use io.aviso.twixt
       [io.aviso.twixt exceptions tracker]
       ring.adapter.jetty)
  (import [java.sql SQLException]))

(defn handler [request]
  (trace "Invoking handler (that throws exceptions)"
         (throw
           (->>
             (SQLException. "Inner Exception" "SQL-STATE", 999)
             (RuntimeException. "Middle Exception")
             (IllegalArgumentException. "Outer Exception")))))

(defn app []
  (let [twixt (new-twixt {:development-mode true})]
    (->
      handler
      (wrap-with-twixt twixt)
      (wrap-with-exception-reporting twixt))))

(defn launch []
  (let [server (run-jetty (app) {:port 8888 :join? false})]
    #(.stop server)))

(ns io.aviso.launch
  (use io.aviso.twixt
       [io.aviso.twixt exceptions tracker]
       ring.adapter.jetty))

(defn make-handler [twixt]
  (fn [request]
    (trace "Invoking handler (that throws exceptions)"
           ;; This will fail at some depth:
           (get-asset-uri twixt "invalid-coffeescript.coffee"))))

(defn app []
  (let [twixt (new-twixt {:development-mode true})]
    (->
      (make-handler twixt)
      (wrap-with-twixt twixt)
      (wrap-with-exception-reporting twixt))))

(defn launch []
  (let [server (run-jetty (app) {:port 8888 :join? false})]
    #(.stop server)))

Change the demo page for excepton reporting to be more involved


(ns fault.core
  (:require [fault.future :as f]
            [fault.service :as s])
  (:import (fault ServiceExecutor ResilientAction ResilientFuture)))

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

(defn service [pool-size]
  (s/service-executor pool-size))

(defn submit-action [^ServiceExecutor service f time-out-ms]
  (f/->CLJResilientFuture
    (.promise ^ResilientFuture (.submitAction service
                                              (reify ResilientAction
                                                (run [_] (f)))
                                              time-out-ms))))

(ns fault.core
  (:require [fault.future :as f]
            [fault.service :as s])
  (:import (fault ServiceExecutor ResilientAction ResilientFuture ResilientPromise)))

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

(defn service [pool-size]
  (s/service-executor pool-size))

(defn submit-action [^ServiceExecutor service f time-out-ms]
  (f/->CLJResilientFuture
    (.promise ^ResilientFuture (.submitAction service
                                              (reify ResilientAction
                                                (run [_] (f)))
                                              time-out-ms))))

(defn perform-action [^ServiceExecutor service f]
  (f/->CLJResilientFuture
    ^ResilientPromise (.performAction service
                                      (reify ResilientAction
                                        (run [_] (f))))))

Add clojure function for perform sync action


(ns made-merits.service.leaderboard-users
    (:require [made-merits.service.winner-calculator :as winner-calculator]
              [made-merits.service.score-calculator :as score-calculator]))

  (defn presentable
    [db-users]
    (winner-calculator/with-winner (score-calculator/with-score db-users)))

(ns made-merits.service.leaderboard-users
    (:require [made-merits.service.winner-calculator :as winner-calculator]
              [made-merits.service.score-calculator :as score-calculator]))

(defn with-winner-first
  [scored-users-with-merits]
  (reverse (sort-by #(= "winner" (:status %)) scored-users-with-merits)))

(defn presentable
  [db-users]
  (with-winner-first
    (winner-calculator/with-winner
      (score-calculator/with-score db-users))))

Move the winner to the top of the list.

Move the winner to the top of the list.


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

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

Update Jetty dependency to 9.4.12.v20180830

Jetty 9.2 has reached End of Life. See the announcement:
https://www.eclipse.org/lists/jetty-announce/msg00116.html

Fixes #347.


(ns buildviz.main
  (:require [buildviz.build-results :as results]
            [buildviz.handler :as handler]
            [buildviz.storage :as storage]
            [clojure.tools.logging :as log]))

(def jobs-filename "buildviz_jobs")
(def tests-filename "buildviz_tests")

(defn- wrap-log-request [handler]
  (fn [req]
    (let [resp (handler req)
          method (.toUpperCase (name (:request-method req)))
          uri (:uri req)
          status (:status resp)]
      (log/info (format "\"%s %s\" %s" method uri status))
      resp)))

(defn- wrap-log-errors [handler]
  (fn [req]
    (let [resp (handler req)
          status (:status resp)
          body (:body resp)
          uri (:uri req)]
      (when (>= status 400)
        (log/warn (format "Returned %s for %s: \"%s\"" status uri body)))
      resp)))

(defn- persist-jobs! [build-data]
  (storage/store-jobs! build-data jobs-filename))

(defn- persist-tests! [tests-data]
  (storage/store-jobs! tests-data tests-filename))

(def app
  (let [builds (atom (storage/load-jobs jobs-filename))
        tests (atom (storage/load-jobs tests-filename))] ; TODO hide atom inside record
    (-> (handler/create-app (results/build-results builds tests) persist-jobs! persist-tests!)
        wrap-log-request
        wrap-log-errors)))

(ns buildviz.main
  (:require [buildviz.build-results :as results]
            [buildviz.handler :as handler]
            [buildviz.storage :as storage]
            [clojure.tools.logging :as log]))

(def jobs-filename "buildviz_jobs")
(def tests-filename "buildviz_tests")

(defn- wrap-log-request [handler]
  (fn [req]
    (let [resp (handler req)
          method (.toUpperCase (name (:request-method req)))
          uri (:uri req)
          status (:status resp)]
      (log/info (format "\"%s %s\" %s" method uri status))
      resp)))

(defn- wrap-log-errors [handler]
  (fn [req]
    (let [resp (handler req)
          status (:status resp)
          body (:body resp)
          uri (:uri req)]
      (when (and (some? status) (>= status 400))
        (log/warn (format "Returned %s for %s: \"%s\"" status uri body)))
      resp)))

(defn- persist-jobs! [build-data]
  (storage/store-jobs! build-data jobs-filename))

(defn- persist-tests! [tests-data]
  (storage/store-jobs! tests-data tests-filename))

(def app
  (let [builds (atom (storage/load-jobs jobs-filename))
        tests (atom (storage/load-jobs tests-filename))] ; TODO hide atom inside record
    (-> (handler/create-app (results/build-results builds tests) persist-jobs! persist-tests!)
        wrap-log-request
        wrap-log-errors)))

Fix logging for responses without status


(ns circleci.init
  ;;(:require circleci.swank)
  (:require circleci.db)
  (:require circleci.db.migrations)
  (:require circleci.web)
  (:require circleci.repl)
  (:require circleci.logging))

(defn -main []
  (try
    ;; (circleci.swank/init)
    (circleci.logging/init)
    (circleci.db/init)
    (circleci.db.migrations/init)
    (circleci.web/init)
    (circleci.repl/init)
    (catch Exception e
      (println "caught exception on startup:")
      (.printStackTrace e)
      (println "exiting")
      (System/exit 1))))

(ns circleci.init
  )

(defn -main []
  (try
    ;;(require 'circleci.swank)
    (require 'circleci.db)
    (require 'circleci.db.migrations)
    (require 'circleci.web)
    (require 'circleci.repl)
    (require 'circleci.logging)
    ;; (circleci.swank/init)
    (circleci.logging/init)
    (circleci.db/init)
    (circleci.db.migrations/init)
    (circleci.web/init)
    (circleci.repl/init)
    (catch Exception e
      (println "caught exception on startup:")
      (.printStackTrace e)
      (println "exiting")
      (System/exit 1))))

Move the requires inside the try

Move the requires inside the try


(ns incise.parsers.impl.markdown-spec
  (:require [speclj.core :refer :all]
            [clojure.java.io :refer [file resource]]
            [incise.core] ; Ensure that layouts have been loaded
            (incise.parsers [core :as pc]
                            [markdown :refer :all]))
  (:import [java.io File]))

(describe "parsing"
  (with markdown-file (file (resource "spec/another-forgotten-binding-pry.md")))
  (it "does something"
    (should= "" (pc/Parse->string (parse @markdown-file)))))

(run-specs)

(ns incise.parsers.impl.markdown-spec
  (:require [speclj.core :refer :all]
            [clojure.java.io :refer [file resource]]
            [incise.core] ; Ensure that layouts have been loaded
            [incise.parsers.core :as pc]
            [incise.parsers.impl.markdown :refer :all])
  (:import [java.io File]))

(describe "parsing"
  (with markdown-file (file (resource "spec/another-forgotten-binding-pry.md")))
  (it "does something"
    (should= "" (pc/Parse->string (parse @markdown-file)))))

(run-specs)

Fix require expression in markdown-spec.


(defproject funcool/postal "0.1.0-SNAPSHOT"
  :description "A parser, renderer and validation layer for POSTAL protocol for Clojure and ClojureScript."
  :url "http://github.com/funcool/postal"
  :license {:name "BSD (2-Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :source-paths ["src"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]
  :javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
  :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
                 [org.clojure/tools.reader "0.10.0-alpha1"]
                 [funcool/cuerdas "0.5.0"]]
  :profiles {:dev {:dependencies [[org.clojure/clojurescript "0.0-3308"]]}})

(defproject funcool/postal "0.1.0-SNAPSHOT"
  :description "A parser, renderer and validation layer for POSTAL protocol for Clojure and ClojureScript."
  :url "http://github.com/funcool/postal"
  :license {:name "BSD (2-Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :source-paths ["src"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]
  :javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
  :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
                 [org.clojure/clojurescript "0.0-3308" :scope "provided"]
                 [org.clojure/tools.reader "0.10.0-alpha1"]
                 [funcool/cuerdas "0.5.0"]])

Set cljs compiler as provided scope dependency.


(defproject strava-activity-graphs "0.1.0-SNAPSHOT"
  :description "Generate statistical charts for Strava activities"
  :url "https://github.com/nicokosi/strava-activity-graphs"
  :license {:name "Creative Commons Attribution 4.0"
            :url  "https://creativecommons.org/licenses/by/4.0/"}
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [incanter/incanter-core "1.9.3"]
                 [incanter/incanter-charts "1.9.3"]
                 [incanter/incanter-io "1.9.3"]
                 [org.clojure/data.json "1.0.0"]
                 [clj-http "3.10.2"]
                 [slingshot "0.12.2"]]
  :plugins [[lein-cljfmt "0.7.0"]]
  :main ^:skip-aot strava-activity-graphs.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

(defproject strava-activity-graphs "0.1.0-SNAPSHOT"
  :description "Generate statistical charts for Strava activities"
  :url "https://github.com/nicokosi/strava-activity-graphs"
  :license {:name "Creative Commons Attribution 4.0"
            :url  "https://creativecommons.org/licenses/by/4.0/"}
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [incanter/incanter-core "1.9.3"]
                 [incanter/incanter-charts "1.9.3"]
                 [incanter/incanter-io "1.9.3"]
                 [org.clojure/data.json "1.0.0"]
                 [clj-http "3.10.3"]
                 [slingshot "0.12.2"]]
  :plugins [[lein-cljfmt "0.7.0"]]
  :main ^:skip-aot strava-activity-graphs.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

Update dependency clj-http:clj-http to v3.10.3


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

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

Prepare for next release cycle.

Prepare for next release cycle.


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject hawk "0.2.0-SNAPSHOT"
  :description "Watch files with clojure (in the manner of a hawk)"
  :url "https://github.com/wkf/hawk"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :test-paths ["src/test"]
  :source-paths ["src/main"]
  :java-source-paths ["vendor/barbarywatchservice/src"]
  :aot [hawk.watcher]
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [net.java.dev.jna/jna "3.2.3"]]
  :profiles {:dev {:dependencies [[org.clojure/core.async "0.1.346.0-17112a-alpha"]]}})

(defproject hawk "0.2.0-SNAPSHOT"
  :description "Watch files with clojure (in the manner of a hawk)"
  :test-paths ["src/test"]
  :source-paths ["src/main"]
  :java-source-paths ["vendor/barbarywatchservice/src"]
  :aot [hawk.watcher]
  :dependencies [[org.clojure/clojure _]
                 [net.java.dev.jna/jna "3.2.3"]]
  :plugins [[lein-shell "0.4.0"]
            [lein-modules "0.3.10"]]
  :profiles {:dev {:dependencies [[org.clojure/core.async "0.1.346.0-17112a-alpha"]]}}
  :modules {:subprocess false
            :versions {hawk :version
                       org.clojure/clojure "1.6.0"
                       org.clojure/clojurescript "0.0-2850"}
            :inherited {:url "https://github.com/wkf/hawk"
                        :scm {:name "git"
                              :url "https://github.com/wkf/hawk"}
                        :license {:name "Eclipse Public License"
                                  :url "http://www.eclipse.org/legal/epl-v10.html"}}}
  :aliases {"export-gh-pages" ["modules" "export"]
            "deploy-gh-pages"
            ["do"
             ["shell" "git" "branch" "-D" "gh-pages"]
             ["shell" "git" "subtree" "split" "--prefix" "hawk_www/resources/public" "--branch" "gh-pages"]
             ["vcs" "push" "origin" "gh-pages" "--force"]]}
  :release-tasks [["vcs" "assert-committed"]
                  ["test"]
                  ["modules" "change" "version" "leiningen.release/bump-version" "release"]
                  ["change" "version" "leiningen.release/bump-version" "release"]
                  ["export-gh-pages"]
                  ["vcs" "commit"]
                  ["vcs" "tag"]
                  ["deploy-gh-pages"]
                  ["deploy" "clojars"]
                  ["modules" "change" "version" "leiningen.release/bump-version"]
                  ["change" "version" "leiningen.release/bump-version"]
                  ["vcs" "commit"]
                  ["vcs" "push"]])

Add release tasks for gh-pages site.

Add release tasks for gh-pages site.


(defproject cascade "0.2-SNAPSHOT"
  :description "Simple, fast, easy web applications in idiomatic Clojure"
  :url "http://github.com/hlship/cascade"
  :source-path "src/main/clojure"
  :resources-path "src/main/resources"
  :test-path "src/test/clojure"
  :dev-resources-path "src/test/resources"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/algo.monads "0.1.0"]
                 [compojure "0.6.5"]]
  :dev-dependencies [[ring/ring-jetty-adapter "0.3.11"]
                     [swank-coljure "1.3.1"]
                     [midje "1.1.1"]])

(defproject cascade "0.2-SNAPSHOT"
  :description "Simple, fast, easy web applications in idiomatic Clojure"
  :url "http://github.com/hlship/cascade"
  :source-path "src/main/clojure"
  :resources-path "src/main/resources"
  :test-path "src/test/clojure"
  :dev-resources-path "src/test/resources"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/algo.monads "0.1.0"]
                 [compojure "0.6.5"]]
  :dev-dependencies [[ring/ring-jetty-adapter "0.3.11"]
                     [swank-clojure "1.3.1"]
                     [midje "1.1.1"]])

Correct a typo in a dependency name

Correct a typo in a dependency name


(defproject manners "0.1.0-SNAPSHOT"
  :description "A validation library built on using predicates properly."
  :url "https://github.com/RyanMcG/manners"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [speclj "2.5.0"]]
  :plugins [[speclj "2.5.0"]]
  :test-paths ["spec/"])

(defproject manners "0.1.0-SNAPSHOT"
  :description "A validation library built on using predicates properly."
  :url "https://github.com/RyanMcG/manners"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]]
  :profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
  :plugins [[speclj "2.5.0"]]
  :test-paths ["spec/"])

Move speclj to dev dependencies.

Move speclj to dev dependencies.


(defproject org.platypope/parenskit "0.1.1-SNAPSHOT"
  :description "Clojure integration library for the LensKit framework."
  :url "http://github.com/llasram/parenskit"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :global-vars {*warn-on-reflection* true}
  :source-paths ["src/clojure"]
  :java-source-paths ["src/java"]
  :javac-options ["-target" "1.6" "-source" "1.6"]
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.grouplens.lenskit/lenskit-core "2.0.2"]
                 [org.platypope/esfj "0.2.0"]]
  :profiles {:dev
             {:dependencies
              [[com.google.code.findbugs/annotations "2.0.2"]]}
             :java6
             {:dependencies
              [[org.codehaus.jsr166-mirror/jsr166y "1.7.0"]]}})

(defproject org.platypope/parenskit "0.1.1-SNAPSHOT"
  :description "Clojure integration library for the LensKit framework."
  :url "http://github.com/llasram/parenskit"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :global-vars {*warn-on-reflection* true}
  :source-paths ["src/clojure"]
  :java-source-paths ["src/java"]
  :javac-options ["-target" "1.6" "-source" "1.6"]
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.grouplens.lenskit/lenskit-core "2.0.2"]
                 [org.platypope/esfj "0.2.0"]]
  :profiles {:default [:base :system :user :provided :java6 :dev]
             :java6 {:dependencies
                     [[org.codehaus.jsr166-mirror/jsr166y "1.7.0"]]}
             :dev {:dependencies
                   [[com.google.code.findbugs/annotations "2.0.2"]]}})

Include :java6 in :default profile.

Include :java6 in :default profile.


(defproject org.onyxplatform/onyx-datomic "0.10.0.0-beta4"
  :description "Onyx plugin for Datomic"
  :url "https://github.com/onyx-platform/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.8.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.10.0-beta4"]]
  :test-selectors {:default (complement :ci)
                   :ci :ci
                   :all (constantly true)}
  :profiles {:dev {:dependencies [[com.datomic/datomic-free "0.9.5544"]
                                  [aero "0.2.0"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]
                   :resource-paths ["test-resources/"]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

(defproject org.onyxplatform/onyx-datomic "0.10.0.0-SNAPSHOT"
  :description "Onyx plugin for Datomic"
  :url "https://github.com/onyx-platform/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.8.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.10.0-beta4"]]
  :test-selectors {:default (complement :ci)
                   :ci :ci
                   :all (constantly true)}
  :profiles {:dev {:dependencies [[com.datomic/datomic-free "0.9.5544"]
                                  [aero "0.2.0"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]
                   :resource-paths ["test-resources/"]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

Prepare for next release cycle.

Prepare for next release cycle.


(defproject tile-game "1.0.0-SNAPSHOT"
  :description "A Tile Puzzle Game and Solver"
  :min-lein-version "2.0.0"
  :main tile-game.core
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.494"]
                 [reagent "0.6.1"]]
  :plugins [[lein-figwheel "0.5.9"]]
  :sources-paths ["src"]
  :clean-targets ^{:protect false}
  ["resources/public/js/out"
   "resources/public/js/tile-game.js"
   :target-path]
  :cljsbuild
  { :builds [{:id "tile-game"
              :source-paths ["src"]
              :figwheel true
              :compiler {:main "tile-game.grid"
                         :asset-path "js/out"
                         :output-to "resources/public/js/tile-game.js"
                         :output-dir "resources/public/js/out"
                         :source-map-timestamp true}}]}
  :figwheel { :css-dirs ["resources/public/css"]
              :open-file-command "emacsclient" })

(defproject tile-game "1.0.0-SNAPSHOT"
  :description "A Tile Puzzle Game and Solver"
  :min-lein-version "2.0.0"
  :main tile-game.core
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.494"]
                 [reagent "0.6.1"]]
  :plugins [[lein-figwheel "0.5.9"]
            [lein-cljsbuild "1.1.5"]]
  :sources-paths ["src"]
  :clean-targets ^{:protect false}
  ["resources/public/js/out"
   "resources/public/js/release"
   "resources/public/js/tile-game.js"
   :target-path]
  :cljsbuild
  { :builds [{:id "dev"
              :source-paths ["src"]
              :figwheel true
              :compiler {:main tile-game.grid
                         :asset-path "js/out"
                         :output-to "resources/public/js/tile-game.js"
                         :output-dir "resources/public/js/out"
                         :source-map-timestamp true}}
             {:id "release"
              :source-paths ["src"]
              :compiler {:main tile-game.grid
                         :output-to "resources/public/js/tile-game.js"
                         :output-dir "resources/public/js/release"
                         :optimizations :advanced
                         :source-map "resources/public/js/tile-game.js.map"}}]}
  :figwheel { :css-dirs ["resources/public/css"]
              :open-file-command "emacsclient" })

Add basic cljsbuild release build

Add basic cljsbuild release build


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

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

Revert back to snapshot version.

Revert back to snapshot version.


(defproject org.clojure-grimoire/lib-grimoire "0.9.0"
  :description "A shared library for Grimoire infrastructure"
  :url "http://github.com/clojure-grimoire/lib-grimoire"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [version-clj "0.1.0"
                  :exclusions [org.clojure/clojure]]
                 [me.arrdem/detritus "0.2.2"
                  :exclusions [org.clojure/clojure]]
                 [com.cemerick/url "0.1.1"
                  :exclusions [org.clojure/clojure]]]
  :profiles {:dev {:dependencies [[org.clojure/test.check "0.6.1"
                                   :exclusions [org.clojure/clojure]]]}})

(defproject org.clojure-grimoire/lib-grimoire "0.9.0"
  :description "A shared library for Grimoire infrastructure"
  :url "http://github.com/clojure-grimoire/lib-grimoire"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [version-clj "0.1.0"
                  :exclusions [org.clojure/clojure]]
                 [me.arrdem/detritus "0.2.2"
                  :exclusions [org.clojure/clojure]]
                 [com.cemerick/url "0.1.1"
                  :exclusions [com.cemerick/clojurescript.test
                               org.clojure/clojure]]]
  :profiles {:dev {:dependencies [[org.clojure/test.check "0.6.1"
                                   :exclusions [org.clojure/clojure]]]}})

Exclude some unused deps for size

Exclude some unused deps for size


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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject strava-activity-graphs "0.1.0-SNAPSHOT"
  :description "Generate statistical charts for Strava activities"
  :url "https://github.com/nicokosi/strava-activity-graphs"
  :license {:name "Creative Commons Attribution 4.0"
            :url  "https://creativecommons.org/licenses/by/4.0/"}
  :dependencies [[org.clojure/clojure "1.10.3"]
                 [incanter/incanter-core "1.9.3"]
                 [incanter/incanter-charts "1.9.3"]
                 [incanter/incanter-io "1.9.3"]
                 [org.clojure/data.json "2.3.0"]
                 [clj-http "3.12.1"]
                 [slingshot "0.12.2"]]
  :plugins [[lein-cljfmt "0.7.0"]]
  :main ^:skip-aot strava-activity-graphs.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

(defproject strava-activity-graphs "0.1.0-SNAPSHOT"
  :description "Generate statistical charts for Strava activities"
  :url "https://github.com/nicokosi/strava-activity-graphs"
  :license {:name "Creative Commons Attribution 4.0"
            :url  "https://creativecommons.org/licenses/by/4.0/"}
  :dependencies [[org.clojure/clojure "1.10.3"]
                 [incanter/incanter-core "1.9.3"]
                 [incanter/incanter-charts "1.9.3"]
                 [incanter/incanter-io "1.9.3"]
                 [org.clojure/data.json "2.3.0"]
                 [clj-http "3.12.1"]
                 [slingshot "0.12.2"]]
  :plugins [[lein-cljfmt "0.8.0"]]
  :main ^:skip-aot strava-activity-graphs.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

Update dependency lein-cljfmt:lein-cljfmt to v0.8.0


(defproject cctray-clj "0.1.0"
            :description "XML parser for cctray"
            :url "https://github.com/cowley05/cctray-clj"
            :license {:name "Eclipse Public License"
                      :url  "http://www.eclipse.org/legal/epl-v10.html"}
            :dependencies [[org.clojure/data.json "0.2.5"]
                           [clj-time "0.8.0"]]
            :profiles {:dev {:plugins      [[lein-midje "3.1.3"]
                                            [lein-ancient "0.5.5"]]
                             :dependencies [[org.clojure/clojure "1.6.0"]
                                            [midje "1.6.3"]]}})

(defproject clj-cctray "0.1.0"
            :description "Clojure parser for cctray.xml"
            :url "https://github.com/build-canaries/clj-cctray"
            :license {:name "Eclipse Public License"
                      :url  "http://www.eclipse.org/legal/epl-v10.html"}
            :dependencies [[org.clojure/data.json "0.2.5"]
                           [clj-time "0.8.0"]]
            :profiles {:dev {:plugins      [[lein-midje "3.1.3"]
                                            [lein-ancient "0.5.5"]]
                             :dependencies [[org.clojure/clojure "1.6.0"]
                                            [midje "1.6.3"]]}})

Update the name to be more standard with other clojure libs


(defproject clj-gatling "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.5.1"]
                 [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
                 [clojure-csv/clojure-csv "2.0.1"]
                 [clj-time "0.6.0"]
                 [http-kit "2.1.16"]
                 [io.gatling/gatling-charts "2.0.0-M3a"]
                 [io.gatling.highcharts/gatling-charts-highcharts "2.0.0-M3a"]]
  :repositories { "excilys" "http://repository.excilys.com/content/groups/public" }
  :main clj-gatling.core)

(defproject clj-gatling "0.0.1"
  :description ""
  :url "http://github.com/mhjort/clj-gatling"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/core.async "0.1.267.0-0d7780-alpha"]
                 [clojure-csv/clojure-csv "2.0.1"]
                 [clj-time "0.6.0"]
                 [http-kit "2.1.16"]
                 [io.gatling/gatling-charts "2.0.0-M3a"]
                 [io.gatling.highcharts/gatling-charts-highcharts "2.0.0-M3a"]]
  :repositories { "excilys" "http://repository.excilys.com/content/groups/public" }
  :main clj-gatling.core)

Add proper version number and url

Add proper version number and url


(defproject madouc "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"]
                 [ring/ring-core "1.5.1"]
                 [org.immutant/web "2.1.6"]]
  :main madouc.core
  :profiles {:uberjar {:aot :all}})

(defproject madouc "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"]
                 [ring/ring-core "1.5.1"]
                 [com.taoensso/timbre "4.8.0"]
                 [com.fzakaria/slf4j-timbre "0.3.4"]
                 [org.immutant/web "2.1.6"
                  :exclusions [ch.qos.logback/logback-classic]]]
  :main madouc.core
  :profiles {:uberjar {:aot :all}})

Enable logging and server logging via timbre


(ns leftpad.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.middleware.params :refer [wrap-params]]
            [ring.util.response :refer [response]]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defroutes app-routes
  (GET "/" {:keys [params] :as request} (response {:foo (get params :str "none")}))
  (route/not-found "Not Found"))

(def app
  (-> (handler/api app-routes)
             (wrap-params)
             (wrap-json-response)))

(ns leftpad.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [ring.middleware.json :refer [wrap-json-response]]
            [ring.middleware.params :refer [wrap-params]]
            [ring.util.response :refer [response]]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defn leftpad
  [mystr len]
  (if (= len "0") mystr (format (str "%" (str len) "s") mystr)))

(defroutes app-routes
  (GET "/" {:keys [params] :as request} (response {:foo
                                                  (leftpad (get params :str "") (get params :len "0"))}))
  (route/not-found "Not Found"))

(def app
  (-> (handler/api app-routes)
             (wrap-params)
             (wrap-json-response)))

Add initial clojure leftpad implementation


(ns advent-2017.day-08
  (:refer-clojure :exclude [inc dec])
  (:require
   #?(:cljs [planck.core :refer [eval read]])
   [#?(:clj clojure.java.io :cljs planck.io) :as io]
   [clojure.string :as str]
   [clojure.spec.alpha :as s])
  #?(:clj (:import (java.io PushbackReader))))

(def input (->> "advent_2017/day_08/input" io/resource io/reader #?(:clj PushbackReader.)))

(s/def ::instr (s/* (s/cat :tgt symbol? :upd symbol? :val number? :if #{'if} :lhs symbol? :cmp symbol? :rhs number?)))

(def data (->> (repeatedly #(read {:eof nil} input)) (take-while some?) (s/conform ::instr)))

(def inc +)
(def dec -)
(def != not=)

(def register-history
  (reductions (fn [acc {:keys [tgt upd val lhs cmp rhs]}]
                (eval `(cond-> '~acc (~cmp ('~acc '~lhs 0) ~rhs) (update '~tgt (fnil ~upd 0) ~val))))
    {}
    data))

(defn max-register-val [registers]
  (apply max (or (vals registers) [0])))

(defn part-1 []
  (max-register-val (last register-history)))

(defn part-2 []
  (apply max (map max-register-val register-history)))

(ns advent-2017.day-08
  (:refer-clojure :exclude [inc dec])
  (:require
   #?(:cljs [planck.core :refer [eval read]])
   [#?(:clj clojure.java.io :cljs planck.io) :as io]
   [clojure.string :as str]
   [clojure.spec.alpha :as s])
  #?(:clj (:import (java.io PushbackReader))))

(def input (->> "advent_2017/day_08/input" io/resource io/reader #?(:clj PushbackReader.)))

(s/def ::instr (s/* (s/cat :tgt symbol? :upd symbol? :val number? :if #{'if} :lhs symbol? :cmp symbol? :rhs number?)))

(def data (->> (repeatedly #(read {:eof nil} input)) (take-while some?) (s/conform ::instr)))

(def inc +)
(def dec -)
(def != not=)

(def register-history
  (reductions (fn [acc {:keys [tgt upd val lhs cmp rhs]}]
                (eval `(cond-> '~acc (~cmp ('~acc '~lhs 0) ~rhs) (update '~tgt (fnil ~upd 0) ~val))))
    (zipmap (map :lhs data) (repeat 0))
    data))

(defn max-register-val [registers]
  (apply max (or (vals registers) [0])))

(defn part-1 []
  (max-register-val (last register-history)))

(defn part-2 []
  (apply max (map max-register-val register-history)))

Fix bug if all touched registers driven negative