(ns onyx.static.default-vals)

(def defaults
  {; input task defaults
   :onyx/input-retry-timeout 1000
   :onyx/pending-timeout 60000
   :onyx/max-pending 10000

   ; task defaults
   :onyx/batch-timeout 1000

   ; zookeeper defaults
   :onyx.peer/zookeeper-timeout 50000

   ; peer defaults
   :onyx.peer/inbox-capacity 1000
   :onyx.peer/outbox-capacity 1000
   :onyx.peer/drained-back-off 400
   :onyx.peer/sequential-back-off 2000
   :onyx.peer/job-not-ready-back-off 500

   ; messaging defaults
   :onyx.messaging.aeron/embedded-driver? true
   :onyx.messaging.netty/thread-pool-sizes 1
   :onyx.messaging.netty/connect-timeout-millis 1000
   :onyx.messaging.netty/pending-buffer-size 10000
   :onyx.messaging/completion-buffer-size 50000
   :onyx.messaging/release-ch-buffer-size 10000
   :onyx.messaging/retry-ch-buffer-size 10000})

(ns onyx.static.default-vals)

(def defaults
  {; input task defaults
   :onyx/input-retry-timeout 1000
   :onyx/pending-timeout 60000
   :onyx/max-pending 10000

   ; task defaults
   :onyx/batch-timeout 1000

   ; zookeeper defaults
   :onyx.peer/zookeeper-timeout 6000

   ; peer defaults
   :onyx.peer/inbox-capacity 1000
   :onyx.peer/outbox-capacity 1000
   :onyx.peer/drained-back-off 400
   :onyx.peer/sequential-back-off 2000
   :onyx.peer/job-not-ready-back-off 500

   ; messaging defaults
   :onyx.messaging.aeron/embedded-driver? true
   :onyx.messaging.netty/thread-pool-sizes 1
   :onyx.messaging.netty/connect-timeout-millis 1000
   :onyx.messaging.netty/pending-buffer-size 10000
   :onyx.messaging/completion-buffer-size 50000
   :onyx.messaging/release-ch-buffer-size 10000
   :onyx.messaging/retry-ch-buffer-size 10000})

Reduce ZK timeout back to default for zookeeper-clj


(ns org.knotation.editor.line-map
  (:require [clojure.set :as set]

            [org.knotation.state :as st]

            [org.knotation.editor.util :as util]))

(def empty {})

(defn compiled->line-map
  ([compiled] (compiled->line-map empty compiled))
  ([line-map compiled]
   (let [modified
         (fn [m ed in out]
           (if (and in out)
             (update-in
              (update-in m [ed in] #(conj (or % #{}) [:out (dec out)]))
              [:out (dec out)] #(conj (or % #{})  [ed in]))
             m))]
     (:map
      (reduce
       (fn [memo elem]
         (let [ed (if (= ::st/graph-end (::st/event elem)) (+ 1 (:ed memo)) (:ed memo))
               in (::st/line-number (::st/input elem))
               out (::st/line-number (::st/output elem))
               lns (count (::st/lines (::st/input elem)))
               comp (:compensate memo)
               m (:map memo)]
           {:ed ed
            :compensate (if (> lns 1) (+ (dec lns) comp) comp)
            :map (reduce (fn [m delta] (modified m ed (+ delta in) (+ delta comp out))) m (range lns))}))
       {:ed 0 :compensate 0 :map line-map}
       compiled)))))

(defn lookup
  [line-map editor-ix line-ix]
  (get-in line-map [editor-ix line-ix] #{}))

(ns org.knotation.editor.line-map
  (:require [clojure.set :as set]

            [org.knotation.state :as st]

            [org.knotation.editor.util :as util]))

(def empty {})

(defn compiled->line-map
  ([compiled] (compiled->line-map empty compiled))
  ([line-map compiled]
   (let [modified
         (fn [m ed in out]
           (if (and in out)
             (update-in
              (update-in m [ed (dec in)] #(conj (or % #{}) [:out out]))
              [:out out] #(conj (or % #{}) [ed (dec in)]))
             m))]
     (:map
      (reduce
       (fn [memo elem]
         (let [ed (if (= ::st/graph-end (::st/event elem)) (+ 1 (:ed memo)) (:ed memo))
               in (::st/line-number (::st/input elem))
               out (::st/line-number (::st/output elem))
               lns (count (::st/lines (::st/input elem)))
               m (:map memo)]
           {:ed ed
            :map (reduce (fn [m delta] (modified m ed (+ delta in) (+ delta out))) m (range lns))}))
       {:ed 0 :map line-map}
       compiled)))))

(defn lookup
  [line-map editor-ix line-ix]
  (get-in line-map [editor-ix line-ix] #{}))

Update highlighting to accomodate new knotation-cljs


(ns audio-utils.mp3-encoder
  (:require [cljsjs.lamejs]
            [audio-utils.worker :as w]))

(defrecord MP3Encoder [bit-rate sample-rate next]
  w/IWorkerAudioNode
  (connect [this destination]
    (reset! next destination))

  (disconnect [this]
    (reset! next nil))

  (process-audio [this data]
    (let [int-data (mapv (fn [samples]
                           (into-array (map #(* 32768 %) samples)))
                         data)
          encoder  (js/lamejs.Mp3Encoder. (count data) sample-rate
                                          bit-rate)
          encoded  #js []]
      (doto encoded
        (.push (apply (aget encoder "encodeBuffer") int-data))
        (.push (.flush encoder)))
      (some-> @next (w/process-audio encoded)))))

(defn mp3-encoder
  [{:keys [bit-rate
           sample-rate]
    :or   {bit-rate    128
           sample-rate 44100}}]
  (map->MP3Encoder {:bit-rate    bit-rate
                    :sample-rate sample-rate
                    :next        (atom nil)}))

(ns audio-utils.mp3-encoder
  (:require [cljsjs.lamejs]
            [audio-utils.util :as u]
            [audio-utils.worker :as w]))

(defrecord MP3Encoder [bit-rate sample-rate next]
  w/IWorkerAudioNode
  (connect [this destination]
    (reset! next destination))

  (disconnect [this]
    (reset! next nil))

  (process-audio [this data]
    (let [int-data (u/amap (fn [samples]
                             (u/amap #(* 32768 %) samples))
                           data)
          encoder  (js/lamejs.Mp3Encoder. (u/acount data) sample-rate
                                          bit-rate)
          encoded  #js []]
      (doto encoded
        (.push (apply (.-encodeBuffer encoder) int-data))
        (.push (.flush encoder)))
      (some-> @next (w/process-audio encoded)))))

(defn mp3-encoder
  [{:keys [bit-rate
           sample-rate]
    :or   {bit-rate    128
           sample-rate 44100}}]
  (map->MP3Encoder {:bit-rate    bit-rate
                    :sample-rate sample-rate
                    :next        (atom nil)}))

Update MP3 encoder to operate on JS arrays/data


(ns om-tut.core
  (:require [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]))

(enable-console-print!)

(println "A new developer message. Pay attention, dev guy!")

;; define your app data so that it doesn't get over-written on reload

(defonce app-state (atom {:list ["Lion" "Zebra" "Buffalo" "Antelope"]}))

(om/root
 (fn [data owner]
   (om/component
    (apply dom/ul nil
           (map (fn [text] (dom/li nil text)) (:list data)))))
 app-state
 {:target (. js/document (getElementById "app0"))})

(defn on-js-reload []
  ;; optionally touch your app-state to force rerendering depending on
  ;; your application
  ;; (swap! app-state update-in [:__figwheel_counter] inc)
)

(ns om-tut.core
  (:require [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]))

(enable-console-print!)

(println "A new developer message. Pay attention, dev guy!")

;; define your app data so that it doesn't get over-written on reload

(defonce app-state (atom {:list ["Lion" "Zebra" "Buffalo" "Antelope"]}))

(om/root
 (fn [data owner]
   (om/component
    (apply dom/ul #js {:className "animals"}
           (map (fn [text] (dom/li nil text)) (:list data)))))
 app-state
 {:target (. js/document (getElementById "app0"))})

(defn on-js-reload []
  ;; optionally touch your app-state to force rerendering depending on
  ;; your application
  ;; (swap! app-state update-in [:__figwheel_counter] inc)
)

Implement code to render a list of things.


(ns leiningen.new.vdom-app
  (:use [leiningen.new.templates :only [renderer name-to-path ->files]]))

(def render (renderer "vdom-app"))

(defn vdom-app [name]
  (let [data {:name name
              :path (name-to-path name)}]
    (->files data
      ["index.html" (render "index.html" data)]
      ["dev.html" (render "dev.html" data)]
      ["project.clj" (render "project.clj" data)]
      "externs"
      ["externs/vdom.js" (render "externs/vdom.js" data)]
      "src/{{path}}"
      ["src/{{path}}/core.cljs" (render "src/vdom_app/core.cljs" data)]
      "resources/public/js"
      ["resources/public/js/vdom.js" (render "resources/public/js/vdom.js" data)]
      "resources/public/css"
      "resources/public/css/{{path}}.css" (render "resources/public/css/styles.css" data))))

(ns leiningen.new.vdom-app
  (:use [leiningen.new.templates :only [renderer name-to-path ->files]]))

(def render (renderer "vdom-app"))

(defn vdom-app [name]
  (let [data {:name name
              :path (name-to-path name)}]
    (->files data
      ["index.html" (render "index.html" data)]
      ["dev.html" (render "dev.html" data)]
      ["project.clj" (render "project.clj" data)]
      "externs"
      ["externs/vdom.js" (render "externs/vdom.js" data)]
      "src/{{path}}"
      ["src/{{path}}/core.cljs" (render "src/vdom_app/core.cljs" data)]
      "resources/public/js"
      ["resources/public/js/vdom.js" (render "resources/public/js/vdom.js" data)]
      "resources/public/css"
      ["resources/public/css/{{path}}.css" (render "resources/public/css/styles.css" data)])))

Fix creating directory instead of file.

Fix creating directory instead of file.


(ns quil-site.core
  (:require [compojure.core :refer [defroutes GET]]
            [compojure.handler :refer [site]]
            [compojure.route :refer [files]]
            [ring.middleware.json :as json]
            [ring.adapter.jetty :refer [run-jetty]]
            [ring.middleware.stacktrace :as stacktrace]
            [quil-site.sketches :as sketches]
            [quil-site.views.about :refer [about-page]]))

(defroutes app
  (GET "/" [] (about-page))
  sketches/routes
  (files "/"))

(defn dump-request [handler]
  (fn [req]
    (clojure.pprint/pprint req)
    (handler req)))

(def handler
  (-> #'app
      dump-request
      site
      (json/wrap-json-body {:keywords? true})
      json/wrap-json-response
      stacktrace/wrap-stacktrace))

(comment

 (def server (run-jetty #(handler %) {:port 8080 :join? false}))

 (.stop server)

)

(ns quil-site.core
  (:require [compojure.core :refer [defroutes GET]]
            [compojure.handler :refer [site]]
            [compojure.route :refer [files]]
            [ring.middleware.json :as json]
            [ring.adapter.jetty :refer [run-jetty]]
            [ring.middleware.stacktrace :as stacktrace]
            [quil-site.sketches :as sketches]
            [quil-site.views.about :refer [about-page]]))

(defroutes app
  (GET "/" [] (about-page))
  sketches/routes
  (files "/"))

(defn dump-request [handler]
  (fn [req]
    (clojure.pprint/pprint req)
    (handler req)))

(def handler
  (-> #'app
      dump-request
      site
      (json/wrap-json-body {:keywords? true})
      json/wrap-json-response
      stacktrace/wrap-stacktrace))

(defn run []
  (run-jetty handler {:port 8080}))

(comment

 (def server (run-jetty #(handler %) {:port 8080 :join? false}))

 (.stop server)

)

Add method for running server.

Add method for running server.


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

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

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

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

[search] Make leaving the search page clear the search bar


(ns discuss.test.lib
  (:require [cljs.pprint :as pprint]
            [cljs.test :refer-macros [is]]))

(defn- summarize-results' [spec-check]
  (doall (map #(-> % :clojure.test.check/ret pprint/pprint) spec-check)))

(defn check' [spec-check]
  (summarize-results' spec-check)
  (is (nil? (-> spec-check first :failure))))

(ns discuss.test.lib
  (:require [cljs.pprint :as pprint]
            [cljs.test :refer-macros [is]]))

(defn- summarize-results' [spec-check]
  (doall (map #(-> %
                   (select-keys [:clojure.test.check/ret :sym])
                   vals
                   pprint/pprint) spec-check)))

(defn check' [spec-check]
  (summarize-results' spec-check)
  (is (nil? (-> spec-check first :failure))))

Add name of fn which was automatically tested


(ns rill.event-store.psql-test
  (:require [rill.event-store.psql :refer [psql-event-store]]
            [rill.event-store.psql.tools :as tools]
            [rill.event-store.generic-test-base :refer [test-store]]
            [clojure.test :refer :all]))

(def config {:user (System/getenv "RILL_POSTGRES_USER")
             :password (System/getenv "RILL_POSTGRES_PASSWORD")
             :hostname (System/getenv "RILL_POSTGRES_HOST")
             :port (System/getenv "RILL_POSTGRES_PORT")
             :database (System/getenv "RILL_POSTGRES_DATABASE")})

(defn get-clean-psql-store! [config]
  (tools/clear-db! config)
  (psql-event-store (tools/connection config)))

(deftest test-psql-store
  (if (System/getenv "RILL_POSTGRES_DATABASE")
    (do (tools/load-schema! config)
        (test-store #(get-clean-psql-store! config)))
    (println "Skipped tests for rill postgres backend. Set at least RILL_POSTGRES_DATABASE environment variable to configure and enable tests")))

(ns rill.event-store.psql-test
  (:require [rill.event-store.psql :refer [psql-event-store]]
            [rill.event-store.psql.tools :as tools]
            [rill.event-store.generic-test-base :refer [test-store]]
            [clojure.test :refer :all]))

(def config {:user (System/getenv "RILL_POSTGRES_USER")
             :password (System/getenv "RILL_POSTGRES_PASSWORD")
             :hostname (System/getenv "RILL_POSTGRES_HOST")
             :port (System/getenv "RILL_POSTGRES_PORT")
             :database (System/getenv "RILL_POSTGRES_DB")})

(defn get-clean-psql-store! [config]
  (tools/clear-db! config)
  (psql-event-store (tools/connection config)))

(deftest test-psql-store
  (if (System/getenv "RILL_POSTGRES_DB")
    (do (tools/load-schema! config)
        (test-store #(get-clean-psql-store! config)))
    (println "Skipped tests for rill postgres backend. Set at least RILL_POSTGRES_DB environment variable to configure and enable tests")))

Fix accidental rename of environment variable


(ns continuo.postgresql-spec
  (:require [clojure.test :as t]
            [continuo.postgresql.schema :as schema]))

(t/deftest schema-internal-tests
  (let [schema [[:db/add :user/username {:type :continuo/string}]
                [:db/add :user/fullname {:type :continuo/string}]
                [:db/drop :user/name]]
        cschema (schema/compile-schema schema)]
    (cschema (fn [sql]
               (println "Executing:" sql)))))

(ns continuo.postgresql-spec
  (:require [clojure.test :as t]
            [suricatta.core :as sc]
            [continuo.core :as co]
            [continuo.impl :as impl]
            [continuo.executor :as exec]
            [continuo.postgresql.connection :as conn]
            [continuo.postgresql.schema :as schema])
  (:import java.net.URI))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Fixtures & Initialization
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def +ctx+)
(def dbspec {:subprotocol "postgresql"
             :subname "//127.0.0.1/test"})

(defn transaction-fixture
  [continuation]
  (with-open [ctx (sc/context dbspec)]
    (sc/atomic ctx
      (alter-var-root #'+ctx+ (constantly ctx))
      (continuation)
      (sc/set-rollback! ctx))))

(deftype Transactor [schema]
  conn/ITrasactor
  (-get-connection [_] +ctx+)
  (-get-schema [_] schema))

(defmethod impl/connect :pgtest
  [_ _]
  (exec/submit (fn [] (Transactor. (atom nil)))))

(t/use-fixtures :each transaction-fixture)

(def ^:static uri "pgtest://localhost/test")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(t/deftest facked-connect-tests
  (let [tx @(impl/connect (URI. uri) {})]
    (t/is (instance? Transactor tx))))

;; (t/deftest schema-internal-tests
;;   (let [schema [[:db/add :user/username {:type :continuo/string}]
;;                 [:db/add :user/fullname {:type :continuo/string}]
;;                 [:db/drop :user/name]]
;;         cschema (schema/compile-schema schema)]
;;     (cschema (fn [sql]
;;                (println "Executing:" sql)))))

Add first test for fake transactor creation process.


(ns fhofherr.clj-db-util.jdbc-template-test
  (:require [clojure.test :refer :all]
            [fhofherr.clj-db-util.support.test-db :as test-db]
            [fhofherr.clj-db-util.jdbc-template :as t]
            [fhofherr.clj-db-util.dialect :refer [h2]]))

(deftest named-parameters
  (let [stmt "SELECT 1 AS result FROM dual WHERE 1 = :number"]
    (is (= {:result 1}
         (t/query-str h2
                      (test-db/h2-private-in-memory)
                      stmt
                      :params {:number 1}
                      :result-set-fn first)))
    (is (nil?
         (t/query-str h2
                      (test-db/h2-private-in-memory)
                      stmt
                      :params {:number 2}
                      :result-set-fn first)))))

(ns fhofherr.clj-db-util.jdbc-template-test
  (:require [clojure.test :refer :all]
            [fhofherr.clj-db-util.support.test-db :as test-db]
            [fhofherr.clj-db-util.jdbc-template :as t]
            [fhofherr.clj-db-util.dialect :refer [h2]]))

(deftest named-parameters
  (testing "simple statements"
    (let [stmt "SELECT 1 AS result FROM dual WHERE 1 = :number"]
      (is (= {:result 1}
             (t/query-str h2
                          (test-db/h2-private-in-memory)
                          stmt
                          :params {:number 1}
                          :result-set-fn first)))
      (is (nil?
            (t/query-str h2
                         (test-db/h2-private-in-memory)
                         stmt
                         :params {:number 2}
                         :result-set-fn first)))))
  (testing "subselects"
    (let [stmt "SELECT 1 AS result
                FROM dual
                WHERE 1 = :number
                  AND EXISTS (SELECT 1 FROM DUAL WHERE 2 = :another-number)"]
      (is (= {:result 1}
             (t/query-str h2
                          (test-db/h2-private-in-memory)
                          stmt
                          :params {:number 1
                                   :another-number 2}
                          :result-set-fn first))))))

Test subselects with named parameters.

Test subselects with named parameters.


(ns pangram-test
  (:require [clojure.test :refer [is deftest]]
            [pangram :refer [pangram?]]))

(deftest empty-sentence
  (is (false? (pangram? ""))))

(deftest lowercase-pangram
  (is (pangram? "the quick brown fox jumps over the lazy dog")))

(deftest missing-character-x
  (is
   (false?
    (pangram? "a quick movement of the enemy will jeopardize five gunboats"))))

(deftest another-missing-character-x
  (is
   (false?
    (pangram? "the quick brown fish jumps over the lazy dog"))))

(deftest with-underscores
  (is (pangram? "the_quick_brown_fox_jumps_over_the_lazy_dog")))

(deftest with-numbers
  (is (pangram? "the 1 quick brown fox jumps over the 2 lazy dogs")))

(deftest missing-letters-replaced-by-numbers
  (is
   (false?
    (pangram? "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"))))

(deftest mixed-case-and-punctuation
  (is (pangram? "\"Five quacking Zephyrs jolt my wax bed.\"")))

(deftest non-ascii-characters
  (is (pangram?
       "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.")))

(ns pangram-test
  (:require [clojure.test :refer [is deftest]]
            [pangram :refer [pangram?]]))

(deftest empty-sentence
  (is (false? (pangram? ""))))

(deftest lowercase-pangram
  (is (pangram? "the quick brown fox jumps over the lazy dog")))

(deftest missing-character-x
  (is
   (false?
    (pangram? "a quick movement of the enemy will jeopardize five gunboats"))))

(deftest another-missing-character-x
  (is
   (false?
    (pangram? "the quick brown fish jumps over the lazy dog"))))

(deftest with-underscores
  (is (pangram? "the_quick_brown_fox_jumps_over_the_lazy_dog")))

(deftest with-numbers
  (is (pangram? "the 1 quick brown fox jumps over the 2 lazy dogs")))

(deftest missing-letters-replaced-by-numbers
  (is
   (false?
    (pangram? "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog"))))

(deftest mixed-case-and-punctuation
  (is (pangram? "\"Five quacking Zephyrs jolt my wax bed.\"")))

(deftest upper-and-lower-not-counted-separately
  (is
    (false?
      (pangram? "the quick brown fox jumps over with lazy FX"))))

Update tests to reflect master problem spec


(ns dragon.generator
  (:require [dragon.config :as config]
            [dragon.web :as web]
            [stasis.core :as stasis]
            [taoensso.timbre :as log]))

(defn run
  [routes out-dir]
  (log/infof "Generating static content to %s ..." out-dir)
  (stasis/export-pages routes out-dir)
  (log/info "Static generation complete."))

(ns dragon.generator
  (:require [dragon.config :as config]
            [dragon.web :as web]
            [stasis.core :as stasis]
            [taoensso.timbre :as log]))

(defn run
  [routes out-dir]
  (log/infof "Generating static content to '%s' ..." out-dir)
  (stasis/export-pages routes out-dir)
  (log/info "Static generation complete."))

Add quote marks to log message.

Add quote marks to log message.


(ns airhead-cljs.core
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [reagent.core :as r]
            [ajax.core :refer [GET POST]]))

(def state (r/atom {:server "http://localhost:8080"}))

(defn change-server! [event]
  (swap! state
         assoc :server
         (-> event .-target .-value)))

;; -------------------------
;; Views

(defn server-form []
  [:div
   [:input {:type "text"
            :value (:server @state)
            :on-change change-server!}]])

(defn playlist-div []
  (let [playlist (r/atom [])
        handler #(reset! playlist (% "items"))]
    (GET "http://localhost:8080/api/queue"
         {:handler handler
          :response-format :json})
    (fn []
      [:div [:h2 "Playlist"]
       [:ul (for [track @playlist]
              [:li (track "title")])]])))

(defn home-page []
  [:div [:h1 "Airhead"]
   [server-form]
   [playlist-div]
   ])

;; -------------------------
;; Initialize app

(defn mount-root []
  (r/render [home-page] (.getElementById js/document "app")))

(defn init! []
  (mount-root))

(ns airhead-cljs.core
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [reagent.core :as r]
            [ajax.core :refer [GET POST]]))

(def state (r/atom {:server "http://localhost:8080"
                    :playlist []}))

(defn update-state! [k value]
  (swap! state assoc k value))

;; -------------------------
;; Views

(defn server-form []
  [:div
   [:input {:type "text"
            :value (@state :server)
            :on-change #(update-state! :server
                                       (-> % .-target .-value))}]])

(defn playlist-div []
  (GET "http://localhost:8080/api/queue"
       {:handler #(update-state! :playlist (% "items"))
        :response-format :json})
  (fn []
    [:div [:h2 "Playlist"]
     [:ul (for [track (@state :playlist)]
            [:li (track "title")])]]))

(defn home-page []
  [:div [:h1 "Airhead"]
   [server-form]
   [playlist-div]
   ])

;; -------------------------
;; Initialize app

(defn mount-root []
  (r/render [home-page] (.getElementById js/document "app")))

(defn init! []
  (mount-root))

Move playlist in state atom

Move playlist in state atom


(ns leipzig-live.core
  (:require
    [leipzig-live.processing] ; Import action defs.
    [leipzig-live.eval :as eval]
    [leipzig-live.views :as view]
    [leipzig-live.framework :as framework]
    [reagent.core :as reagent]))

(def initial-text
  "(->> (phrase [1 1 1 1] [0 1 2 0])
       (where :time (bpm 90))
       (where :duration (bpm 90))
       (where :pitch (comp equal-temperament B major)))")

(defonce state-atom
  (reagent/atom
    {:looping? false
     :error nil
     :text initial-text
     :music (-> initial-text eval/uate :value)}))

(defn reload! []
  (swap! state-atom identity))

(defn mount-root []
  (reagent/render
    [view/home-page (framework/handler-for state-atom) state-atom]
    js/document.body))

(defn main []
  (mount-root))

(main)

(ns leipzig-live.core
  (:require
    [leipzig-live.processing] ; Import action defs.
    [leipzig-live.eval :as eval]
    [leipzig-live.views :as view]
    [leipzig-live.framework :as framework]
    [reagent.core :as reagent]))

(def initial-text
  "(->> (phrase [1 1/2 1/2 1 1 2 2] [0 1 0 2 -3 -10 -10])
     (where :time (bpm 180))
     (where :duration (bpm 180))
     (where :pitch (comp equal-temperament C sharp major)))")

(defonce state-atom
  (reagent/atom
    {:looping? false
     :error nil
     :text initial-text
     :music (-> initial-text eval/uate :value)}))

(defn reload! []
  (swap! state-atom identity))

(defn mount-root []
  (reagent/render
    [view/home-page (framework/handler-for state-atom) state-atom]
    js/document.body))

(defn main []
  (mount-root))

(main)

Use a more visually pleasing starting melody.


{:user {:dependencies [[org.clojure/tools.namespace "0.3.0-alpha4"]
                       [eftest "0.5.2"]]
        :repl-options {:color false}
        :plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]
                  [lein-cloverage "1.0.6" :exclusions [org.clojure/clojure]]
                  [lein-kibit "0.1.3" :exclusions [org.clojure/clojure]]
                  [lein-eftest "0.5.2" :exclusions [org.clojure/clojure]]
                  [lein-ancient "0.6.15", :exclusions [org.clojure/clojure]]]}}

{:user {:dependencies [[org.clojure/tools.namespace "0.3.0-alpha4"]
                       [com.cemerick/pomegranate "1.0.0"]
                       [eftest "0.5.2"]]
        :repl-options {:color false}
        :plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]
                  [lein-cloverage "1.0.6" :exclusions [org.clojure/clojure]]
                  [lein-kibit "0.1.3" :exclusions [org.clojure/clojure]]
                  [lein-eftest "0.5.2" :exclusions [org.clojure/clojure]]
                  [lein-ancient "0.6.15", :exclusions [org.clojure/clojure]]]}}

Add pomegranate to global dependencies

[clojure] Add pomegranate to global dependencies


(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]))

(declare ^Stage stage)

(def main-screen
  (proxy [Screen] []
    (show []
      (def stage (Stage.))
      (let [style (Label$LabelStyle. (BitmapFont.) (Color. 1.0 1.0 1.0 1.0))
            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 {{namespace}}.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]))

(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 {{namespace}}.Game
  :extends com.badlogic.gdx.Game)
(defn -create [^Game this]
  (.setScreen this main-screen))

Make Clojure LibGDX code more idiomatic

Make Clojure LibGDX code more idiomatic


;-
; Copyright 2011 (c) Meikel Brandmeyer.
; All rights reserved.
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.

(ns vimclojure.core)

(defn init-server
  []
  )

;-
; Copyright 2011 (c) Meikel Brandmeyer.
; All rights reserved.
;
; Permission is hereby granted, free of charge, to any person obtaining a copy
; of this software and associated documentation files (the "Software"), to deal
; in the Software without restriction, including without limitation the rights
; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
; copies of the Software, and to permit persons to whom the Software is
; furnished to do so, subject to the following conditions:
;
; The above copyright notice and this permission notice shall be included in
; all copies or substantial portions of the Software.
;
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
; THE SOFTWARE.

(ns vimclojure.core)

(defn init-server
  []
  ; Check for doc macro. 1.2 in c.core, 1.3 in c.repl
  (when-not (ns-resolve 'clojure.core 'doc)
    (binding [*ns* *ns*]
      (in-ns 'user)
      (refer-clojure)
      (use 'clojure.repl))))

Load repl namespace when running on 1.3

Load repl namespace when running on 1.3


(ns clojure.lang.apersistent-map
  (:refer-clojure :only [bit-and defmacro defn let loop +])
  (:require [clojure.lang.counted   :refer [count]]
            [clojure.lang.hash      :refer [hash]]
            [clojure.lang.lookup    :refer [contains? get]]
            [clojure.lang.map-entry :refer [key val]]
            [clojure.lang.operators :refer [and =]]
            [clojure.lang.seq       :refer [first next seq]]))

(defmacro map-hash [-seq]
  `(loop [entries# ~-seq
          acc#     0]
     (if entries#
       (let [entry# (first entries#)]
         (recur
           (next entries#)
           (+ acc# (bit-and (hash (key entry#))
                            (hash (val entry#))))))
      acc#)))

(defn map-equals? [m1 m2]
  (if (= (count m1) (count m2))
    (loop [m1-seq (seq m1)]
      (if m1-seq
        (let [first-entry (first m1-seq)
              k (key first-entry)
              v (val first-entry)]
          (if (and (contains? m2 k)
                   (= v (get m2 k)))
            (recur (next m1-seq))
            false))
        true))
    false))

(ns clojure.lang.apersistent-map
  (:refer-clojure :only [bit-and defmacro defn let loop +])
  (:require [clojure.lang.counted   :refer [count]]
            [clojure.lang.hash      :refer [hash]]
            [clojure.lang.lookup    :refer [contains? get]]
            [clojure.lang.map-entry :refer [key val]]
            [clojure.lang.operators :refer [and =]]
            [clojure.lang.seq       :refer [first next seq]]))

(defn map-hash [-seq]
  (loop [entries -seq
         acc     0]
    (if entries
      (let [entry (first entries)]
        (recur
          (next entries)
          (+ acc (bit-and (hash (key entry))
                          (hash (val entry))))))
      acc)))

(defn map-equals? [m1 m2]
  (if (= (count m1) (count m2))
    (loop [m1-seq (seq m1)]
      (if m1-seq
        (let [first-entry (first m1-seq)
              k (key first-entry)
              v (val first-entry)]
          (if (and (contains? m2 k)
                   (= v (get m2 k)))
            (recur (next m1-seq))
            false))
        true))
    false))

Change map-hash from macro to fn

Change map-hash from macro to fn


; https://projecteuler.net/problem=3

(ns euler.003
  (:require [clojure.math.numeric-tower :as math]))

(defmulti prime?
  "Returns true if a number is divisible by only 1 and itself, false otherwise."
  (fn [n] (cond
            (> 2 n) :not
            (= 2 n) :is)))

(defmethod prime? :not [_] false)

(defmethod prime? :is [_] true)

(defmethod prime? :default [n]
  (empty? (filter #(zero? (mod n %))
                  (range 2 (+ 1 (math/sqrt n))))))

(defn primes-below [n]
  "Returns a lazy seq of all possible primes below n."
  (filter prime? (range (int (math/floor n)) 1 -1)))

(defn possible-prime-factors-of [n]
  "Returns a lazy seq of all possible prime factors of n in order of largest to smallest."
  (primes-below (math/floor (math/sqrt n))))

(defn biggest-prime-divisor-of-n [n]
  "Lazily retrieves the first prime divisor "
  (let [possible-primes (possible-prime-factors-of n)]
    (first (drop-while #(not (zero? (mod n %)))
                       possible-primes))))

; https://projecteuler.net/problem=3

(ns euler.003
  (:require [clojure.math.numeric-tower :as math]))

(defmulti prime?
  "Returns true if a number is divisible by only 1 and itself, false otherwise."
  (fn [n] (cond
            (> 2 n) :not
            (= 2 n) :is)))

(defmethod prime? :not [_] false)

(defmethod prime? :is [_] true)

(defmethod prime? :default [n]
  (empty? (filter #(zero? (mod n %))
                  (range 2 (+ 1 (math/sqrt n))))))

(defn primes-below [n]
  "Returns a lazy seq of all possible primes less than n."
  ; Use `int` to cast and floor n, subtract 1 so it's exclusive of `n`
  (filter prime? (range (dec (int n)) 1 -1)))

(defn possible-prime-factors-of [n]
  "Returns a lazy seq of all possible prime factors of n in order of largest to smallest."
  ; Add 1 so `primes-below` results includes `sqrt(n)`
  (primes-below (inc (math/floor (math/sqrt n)))))

(defn biggest-prime-divisor-of-n [n]
  "Returns the first prime divisor of n, or `nil` if ."
  (let [possible-primes (possible-prime-factors-of n)]
    (first (drop-while #(not (zero? (mod n %)))
                       possible-primes))))

Clean up with comments, semantic fix

Clean up with comments, semantic fix


(ns decktouch.handler
  (:require [decktouch.dev :refer [browser-repl start-figwheel]]
            [compojure.core :refer [GET defroutes]]
            [compojure.route :refer [not-found resources]]
            [ring.middleware.defaults :refer [site-defaults wrap-defaults]]
            [selmer.parser :refer [render-file]]
            [environ.core :refer [env]]
            [prone.middleware :refer [wrap-exceptions]]
            [decktouch.mtg-card-master :as mtg-card-master]
            [clojure.data.json :as json]))

(defroutes routes
  (GET "/" [] (render-file "templates/index.html" {:dev (env :dev?)}))
  (GET "/data/input/:query" [query]
       (json/write-str
         (mtg-card-master/get-cards-matching-query query)))
  (resources "/")
  (not-found "Not Found"))

(def app
  (let [handler (wrap-defaults routes site-defaults)]
    (if (env :dev?) (wrap-exceptions handler) handler)))

(ns decktouch.handler
  (:require [decktouch.dev :refer [browser-repl start-figwheel]]
            [compojure.core :refer [GET POST defroutes]]
            [compojure.route :refer [not-found resources]]
            [ring.middleware.defaults :refer [site-defaults wrap-defaults]]
            [ring.middleware.params :refer [wrap-params]]
            [ring.middleware.reload :refer [wrap-reload]]
            [ring.adapter.jetty :as jetty]
            [selmer.parser :refer [render-file]]
            [environ.core :refer [env]]
            [prone.middleware :refer [wrap-exceptions]]
            [decktouch.mtg-card-master :as mtg-card-master]
            [clojure.data.json :as json]))

(defroutes routes
  (GET "/" [] (render-file "templates/index.html" {:dev (env :dev?)}))
  (GET "/data/input/:query" [query]
       (json/write-str
         (mtg-card-master/get-cards-matching-query query)))
  (POST "/data/card" request
        (let [card-name ((request :params) "card-name")]
          (str (mtg-card-master/get-card-info card-name))))
  (resources "/")
  (not-found "Not Found"))

(def app
  (let [handler (wrap-reload (wrap-params routes site-defaults))]
    (if (env :dev?) (wrap-reload (wrap-exceptions handler)) handler)))

Add route for getting card info

Add route for getting card info


(ns cmr.common.test.util
  (:require [clojure.test :refer :all]
            [cmr.common.util :as util]))

(deftest test-sequence->fn
  (testing "vector of values"
    (let [f (util/sequence->fn [1 2 3])]
      (is (= 1 (f)))
      (is (= 2 (f)))
      (is (= 3 (f)))
      (is (= nil (f)))
      (is (= nil (f)))))
  (testing "list of values"
    (let [f (util/sequence->fn '(1 2 3))]
      (is (= 1 (f)))
      (is (= 2 (f)))
      (is (= 3 (f)))
      (is (= nil (f)))))
  (testing "empty vector"
    (let [f (util/sequence->fn [])]
      (is (= nil (f)))
      (is (= nil (f)))))
  (testing "empty list"
    (let [f (util/sequence->fn '())]
      (is (= nil (f)))
      (is (= nil (f)))))
  (testing "infinite sequence of values"
    (let [f (util/sequence->fn (iterate inc 1))]
      (is (= 1 (f)))
      (is (= 2 (f)))
      (is (= 3 (f)))
      (is (= 4 (f)))
      (is (= 5 (f))))))

(deftest this-should-fail
  (is (= 5 4)))

Revert "Adding failing test to test ci."

This reverts commit 788e5af5fbec49f0b77ea36b05831145dd610c23.


(ns lab-notebook.core
  (:require [om.core :as om]
            [om.dom :as dom]))

(defonce appstate (atom {}))

(defn item-view [cursor component]
  (reify
    om/IRender
    (render [this]
      (dom/div nil
        (dom/div nil (:summary cursor))
        (dom/div nil (:date-time cursor))
        (dom/div nil (:notes cursor))))))

(defn app-container [cursor component]
  (reify
    om/IRender
    (render [this]
      (apply dom/div nil
        (dom/h1 nil "Lab notebook")
        nil
        (for [entry (:entries cursor)]
          (om/build item-view entry))))))

(om/root app-container appstate
  {:target (. js/document (getElementById "app"))})

(ns lab-notebook.core
  (:require [om.core :as om]
            [om.dom :as dom]))

(defonce appstate (atom {}))

(defn item-view [cursor component]
  (reify
    om/IRender
    (render [this]
      (dom/div #js {:style #js {:marginTop "2em"}}
        (dom/div nil (:summary cursor))
        (dom/div nil (:date-time cursor))
        (dom/div nil (:notes cursor))))))

(defn app-container [cursor component]
  (reify
    om/IRender
    (render [this]
      (apply dom/div nil
        (dom/h1 nil "Lab notebook")
        nil
        (for [entry (:entries cursor)]
          (om/build item-view entry))))))

(om/root app-container appstate
  {:target (. js/document (getElementById "app"))})

Add our first style, just a bit of margin


(ns example.core
  (:require [clojure.string :as str]
            [example.lib :as lib]))

(defn collatz [n]
  (lazy-seq
    (cons n
          (if (lib/even? n)
            (collatz (/ n 2))
            (collatz (+ (* 3 n) 1))))))

(defmacro let1 [name expr & body]
  `(let [~name ~expr]
     ~@body))

(def x 42)

(defn f []
  (let1 x (* x x)
    (+ x x)))

(->> (str/split "hoge\nfuga\npiyo" #"\n")
     (map #(str "[" % "]"))
     (str/join \newline))

(ns example.core
  (:require [clojure.java.io :as io]
            [clojure.string :as str]
            [example.lib :as lib]))

(defn collatz [n]
  (lazy-seq
    (cons n
          (if (lib/even? n)
            (collatz (/ n 2))
            (collatz (+ (* 3 n) 1))))))

(defmacro let1 [name expr & body]
  `(let [~name ~expr]
     ~@body))

(def x 42)

(defn f []
  (let1 x (* x x)
    (+ x x)))

(->> (str/split "hoge\nfuga\npiyo" #"\n")
     (map #(str "[" % "]"))
     (str/join \newline))

(defmacro aif [test then else]
  `(let [~'it ~test]
     ~then
     ~else))

(defn g [x]
  (aif (:k x)
    (inc it)
    0))

(let [x 0]
  (let [[x & y] [1 2 3]]
    (let [x x]
      x)))

(defn f [x]
  (with-open [x (io/reader "hoge")]
    x))

Update example code demonstrating some features


(ns clj-chrome-devtools.automation-test
  (:require [clj-chrome-devtools.automation :as a]
            [clj-chrome-devtools.automation.fixture :refer [create-chrome-fixture]]
            [clojure.spec.test.alpha :as stest]
            [clojure.test :as t :refer [deftest is testing]]))

(stest/instrument)

(defonce chrome-fixture (create-chrome-fixture))
(t/use-fixtures :each chrome-fixture)

(deftest evaluate
  (testing "a call that takes longer than the default timeout should throw an exception"
    (let [[prior-default-timeout _] (reset-vals! a/default-timeout-ms 100)]
      (is (thrown-with-msg?
           RuntimeException
           #"^Timeout!.+"
           (a/evaluate "Array(1024 ** 3).fill().map(Math.random).length")))
      (reset! a/default-timeout-ms prior-default-timeout)))
  (testing "a call that takes longer than the supplied timeout should throw an exception"
    (is (thrown-with-msg?
         RuntimeException
         #"^Timeout!.+"
         (a/evaluate @a/current-automation
                    "Array(1024 ** 3).fill().map(Math.random).length"
                    100)))))

(ns clj-chrome-devtools.automation-test
  (:require [clj-chrome-devtools.automation :as a]
            [clj-chrome-devtools.automation.fixture :refer [create-chrome-fixture]]
            [clojure.spec.test.alpha :as stest]
            [clojure.test :as t :refer [deftest is testing]]
            [clojure.string :as str]))

(stest/instrument)

(defonce chrome-fixture (create-chrome-fixture))
(t/use-fixtures :each chrome-fixture)

(deftest evaluate
  (testing "a call that takes longer than the default timeout should throw an exception"
    (let [[prior-default-timeout _] (reset-vals! a/default-timeout-ms 100)]
      (is (thrown-with-msg?
           RuntimeException
           #"^Timeout!.+"
           (a/evaluate "Array(1024 ** 3).fill().map(Math.random).length")))
      (reset! a/default-timeout-ms prior-default-timeout)))
  (testing "a call that takes longer than the supplied timeout should throw an exception"
    (is (thrown-with-msg?
         RuntimeException
         #"^Timeout!.+"
         (a/evaluate @a/current-automation
                    "Array(1024 ** 3).fill().map(Math.random).length"
                    100)))))

(deftest pdf-print-test
  (a/to "http://example.com")
  (a/print-pdf @a/current-automation "example.pdf")
  (let [pdf (slurp "example.pdf")]
    (is (str/starts-with? pdf "%PDF-1.4")) ; file exists and starts with proper PDF header
    (is (> (count pdf) 50000)))) ; file should be little over 50k

Add test that prints example.com site to PDF


(ns doctopus.test-utilities
  (:require [clojure.test :refer :all]
            [doctopus.test-utilities :refer :all])
  (:import [org.joda.time DateTime]
           [org.joda.time.format DateTimeFormat]))

(def iso-formatter (DateTimeFormat/forPattern "yyyy-MM-dd"))

(defn make-today
  []
  (let [today (DateTime.)]
    (.print iso-formatter today)))

(ns doctopus.test-utilities
  (:require [clojure.test :refer :all]
            [doctopus.storage :refer [remove-from-storage backend]]
            [doctopus.test-utilities :refer :all])
  (:import [org.joda.time DateTime]
           [org.joda.time.format DateTimeFormat]))

(def iso-formatter (DateTimeFormat/forPattern "yyyy-MM-dd"))

(defn make-today
  []
  (let [today (DateTime.)]
    (.print iso-formatter today)))

(defn clean-up-test-html
  [k]
  (remove-from-storage backend k))

Add a test cleanup util

Add a test cleanup util


(defn swap [a i j]
  (assoc a j (a i) i (a j)))

(defn generatePermutations [v n]
  (if (zero? n)
    (println (apply str v))

    (loop [i 0 a v]
      (if (<= i n)
        (do
          (generatePermutations a (dec n))
          (recur (inc i) (swap a (if (even? n) i 0) n)))))))

(if (not= (count *command-line-args*) 1)
  (do
    (println "Exactly one argument is required")
    (System/exit 1))
  (let [word (-> *command-line-args* first vec)]
    (generatePermutations word (dec (count word)))))

(defn swap [a i j]
  (assoc a j (a i) i (a j)))

(defn generatePermutations [v n]
  (if (zero? n)
    (println (apply str v))

    (loop [i 0 a v]
      (if (< i n)
        (do
          (generatePermutations a (dec n))
          (recur (inc i) (swap a (if (even? n) i 0) n)))
        (generatePermutations a (dec n))))))

(if (not= (count *command-line-args*) 1)
  (do
    (println "Exactly one argument is required")
    (System/exit 1))
  (let [word (-> *command-line-args* first vec)]
    (generatePermutations word (dec (count word)))))

Improve algorithm, it was swapping too many times


(use '[clojure.java.shell :only [sh]])
(use '[clojure.string :only [trim]])

(def version
  (trim ((sh "python" "-c"
             "import vcversioner; print vcversioner.find_version().version")
         :out)))

(defproject sphinxcontrib/githubcomments version
  :source-paths ["src-cljs/main/"]
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.228"]
                 [cljs-http "0.1.39"]
                 [cljsjs/moment "2.10.6-2"]
                 [hiccups "0.3.0"]]
  :cljsbuild {:builds [{:compiler {:output-to "sphinxcontrib/githubcomments/_static/githubcomments.js"
                                   :optimizations :whitespace
                                   :pretty-print true}}]}
  :profiles {:dev {:source-paths ["src-cljs/main/" "src-cljs/dev/"]
                   :plugins [[lein-cljsbuild "1.1.2"]]
                   :dependencies [[com.cemerick/piggieback  "0.2.1"]]
                   :repl-options  {:nrepl-middleware
                                   [cemerick.piggieback/wrap-cljs-repl]}}})

(use '[clojure.java.shell :only [sh]])
(use '[clojure.string :only [trim]])

(def version
  (trim ((sh "python" "-c"
             "import vcversioner; print vcversioner.find_version().version")
         :out)))

(defproject sphinxcontrib/githubcomments version
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.228"]
                 [cljs-http "0.1.39"]
                 [cljsjs/moment "2.10.6-2"]
                 [hiccups "0.3.0"]]
  :plugins [[lein-cljsbuild "1.1.2"]]
  :source-paths ["src-cljs/main/"]
  :hooks [leiningen.cljsbuild]
  :cljsbuild {:builds [{:compiler {:output-to "sphinxcontrib/githubcomments/_static/githubcomments.js"
                                   :optimizations :whitespace
                                   :pretty-print true}}]}
  :profiles {:dev {:source-paths ["src-cljs/main/" "src-cljs/dev/"]
                   :dependencies [[com.cemerick/piggieback  "0.2.1"]]
                   :repl-options  {:nrepl-middleware
                                   [cemerick.piggieback/wrap-cljs-repl]}}})

Add hooks support which hooks into some stuff I don't use yet.


(defproject superstring "1.0.0"
  :description "String manipulation library for clojure"
  :url "http://github.com/expez/superstring"
  :license {:name "Eclipse Public License 1.0"
            :url "http://www.eclipse.org/legal/epl-v10.html"
            :year 2015
            :key "epl-1.0"}
  :plugins [[codox "0.8.11"]]
  :codox {:src-dir-uri "http://github.com/expez/superstring/blob/master/"
          :src-linenum-anchor-prefix "L"}
  :profiles {:dev {:dependencies [[org.clojure/clojure "1.6.0"]
                                  [org.clojure/test.check "0.7.0"]]
                   :repl-options {:init-ns superstring.core}}
             :provided {:dependencies [[org.clojure/clojure "1.6.0"]]}
             :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
             :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0-beta3"]]}})

(defproject superstring "1.0.0"
  :description "String manipulation library for clojure"
  :url "http://github.com/expez/superstring"
  :license {:name "Eclipse Public License 1.0"
            :url "http://www.eclipse.org/legal/epl-v10.html"
            :year 2015
            :key "epl-1.0"}
  :plugins [[codox "0.8.11"]]
  :codox {:src-dir-uri "http://github.com/expez/superstring/blob/master/"
          :src-linenum-anchor-prefix "L"}
  :profiles {:dev {:dependencies [[org.clojure/clojure "1.7.0-RC2"]
                                  [org.clojure/test.check "0.7.0"]]
                   :repl-options {:init-ns superstring.core}}
             :provided {:dependencies [[org.clojure/clojure "1.6.0"]]}
             :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]}
             :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0-RC2"]]}})

Bump clojure versions for dev and test

Bump clojure versions for dev and test


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(ns time-tracker.invoices.handlers
  (:require [ring.util.response :as res]
            [time-tracker.users.db :as users-db]
            [time-tracker.projects.db :as projects-db]
            [time-tracker.timers.db :as timers-db]
            [time-tracker.invoices.core :as invoices-core]
            [time-tracker.util :as util]))

;; Download invoice endpoint
;; /download/invoice/

(defn generate-invoice
  [request connection]
  (let [users      (util/normalize-entities (users-db/retrieve-all connection))
        projects   (util/normalize-entities (projects-db/retrieve-all connection))
        timers     (util/normalize-entities (timers-db/retrieve-all connection))
        csv-string (invoices-core/generate-csv users projects timers)]
    ;; TODO: add current date in the invoice filename
    (-> (res/response csv-string)
        (res/header "Content-Disposition" "attachment; filename=\"invoice.csv\""))))

(ns time-tracker.invoices.handlers
  (:require [ring.util.response :as res]
            [time-tracker.users.db :as users-db]
            [time-tracker.projects.db :as projects-db]
            [time-tracker.timers.db :as timers-db]
            [time-tracker.invoices.core :as invoices-core]
            [time-tracker.util :as util]))

;; Download invoice endpoint
;; /download/invoice/

(defn generate-invoice
  [request connection]
  (let [users      (util/normalize-entities (users-db/retrieve-all connection))
        projects   (util/normalize-entities (projects-db/retrieve-all connection))
        timers     (util/normalize-entities (timers-db/retrieve-all connection))
        csv-string (invoices-core/generate-csv users projects timers)]
    (res/response csv-string)))

Remove attachment header from invoice response


(defproject replete "0.1.0"
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "0.0-3422"]
                 [org.clojure/tools.reader "0.10.0-SNAPSHOT" :exclusions [org.clojure/clojure]]
                 [com.cognitect/transit-cljs "0.8.220"]
                 [com.cognitect/transit-clj "0.8.275"]])

(defproject replete "0.1.0"
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "0.0-3426"]
                 [org.clojure/tools.reader "0.10.0-SNAPSHOT" :exclusions [org.clojure/clojure]]
                 [com.cognitect/transit-cljs "0.8.220"]
                 [com.cognitect/transit-clj "0.8.275"]]
  :clean-targets ["out" "target"])

Update deps and add clean-targets

Update deps and add clean-targets


;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>

(ns uxbox.services.core
  (:require [clojure.walk :as walk]
            [cuerdas.core :as str]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main Api
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def +hierarchy+
  (as-> (make-hierarchy) $
    (derive $ :auth/login :command)))

(defmulti -novelty
  (fn [conn data] (:type data))
  :hierarchy #'+hierarchy+)

(defmulti -query
  (fn [conn data] (:type data))
  :hierarchy #'+hierarchy+)

(defmethod -novelty :default
  [data]
  (throw (ex-info "Not implemented" {})))

(defmethod -query :default
  [data]
  (throw (ex-info "Not implemented" {})))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Common Helpers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn normalize-attrs
  "Recursively transforms all map keys from strings to keywords."
  [m]
  (letfn [(tf [[k v]]
            (let [ks (-> (name k)
                         (str/replace "_" "-"))]
              [(keyword ks) v]))
          (walker [x]
            (if (map? x)
              (into {} (map tf) x)
              x))]
    (walk/postwalk walker m)))

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>

(ns uxbox.services.core
  (:require [clojure.walk :as walk]
            [cuerdas.core :as str]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main Api
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(def +hierarchy+
  (as-> (make-hierarchy) $
    (derive $ :auth/login :command)))

(defmulti -novelty
  (fn [conn data] (:type data))
  :hierarchy #'+hierarchy+)

(defmulti -query
  (fn [conn data] (:type data))
  :hierarchy #'+hierarchy+)

(defmethod -novelty :default
  [conn data]
  (throw (ex-info "Not implemented" {})))

(defmethod -query :default
  [conn data]
  (throw (ex-info "Not implemented" {})))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Common Helpers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defn normalize-attrs
  "Recursively transforms all map keys from strings to keywords."
  [m]
  (letfn [(tf [[k v]]
            (let [ks (-> (name k)
                         (str/replace "_" "-"))]
              [(keyword ks) v]))
          (walker [x]
            (if (map? x)
              (into {} (map tf) x)
              x))]
    (walk/postwalk walker m)))

Add missing parameter to default impl of services.


(ns scrabble.test (:require [clojure.test :refer :all]))
(load-file "scrabble.clj")

(deftest lower-case-letter
  (is (= 1 (score-letter "a"))))
(deftest upper-case-letter
  (is (= 1 (score-letter "A"))))
(deftest two-letter-word
  (is (= 2 (score-word "at"))))
(deftest bigger-word-1
  (is (= 6 (score-word "street"))))
(deftest bigger-word-2
  (is (= 22 (score-word "quirky"))))
(deftest all-upper-case-word
  (is (= 20 (score-word "MULTIBILLIONAIRE"))))

(run-tests)

(ns scrabble.test (:require [clojure.test :refer :all]))
(load-file "scrabble.clj")

(deftest lower-case-letter
  (is (= 1 (scrabble/score-letter "a"))))
(deftest upper-case-letter
  (is (= 1 (scrabble/score-letter "A"))))
(deftest two-letter-word
  (is (= 2 (scrabble/score-word "at"))))
(deftest bigger-word-1
  (is (= 6 (scrabble/score-word "street"))))
(deftest bigger-word-2
  (is (= 22 (scrabble/score-word "quirky"))))
(deftest all-upper-case-word
  (is (= 20 (scrabble/score-word "MULTIBILLIONAIRE"))))

(run-tests)

Move the scrabble exercise under a namespace.

Related: PR #8.


(defproject ring/ring-core "0.3.2"
  :description "Ring core libraries."
  :url "http://github.com/mmcgrana/ring"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [commons-codec "1.4"]
                 [commons-io "1.4"]
                 [commons-fileupload "1.2.1"]
                 [javax.servlet/servlet-api "2.5"]])

(defproject ring/ring-core "0.3.2"
  :description "Ring core libraries."
  :url "http://github.com/mmcgrana/ring"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [commons-codec "1.4"]
                 [commons-io "1.4"]
                 [commons-fileupload "1.2.1"]
                 [javax.servlet/servlet-api "2.5"]]
  :dev-dependencies [[org.clojure/clojure-contrib "1.2.0"]])

Make contrib a dev dependency for session tests.


{:user {:plugins [[lein-try "0.4.1"]
                  [lein-pprint "1.1.1"]
                  [cider/cider-nrepl "0.7.0"]]}}

{:user {:plugins [[lein-try "0.4.1"]
                  [lein-pprint "1.1.1"]
                  [cider/cider-nrepl "0.8.0"]]}}

Upgrade `cider-nrepl` to just-released "0.8.0"


(ns spec-tools.visitor-test
  (:require [clojure.test :refer [deftest is]]
            [clojure.spec :as s]
            [spec-tools.visitor :refer [visit]]
            [clojure.set :as set]))

(s/def ::str string?)
(s/def ::int integer?)
(s/def ::map (s/keys :req [::str] :opt [::int]))

(defn collect [dispatch spec children] `[~dispatch ~@children])

(deftest test-visit
  (is (= (visit #{1 2 3} collect) [:spec-tools.visitor/set 1 3 2]))
  (is (= (visit ::map collect)
         '[clojure.spec/keys [clojure.core/string?] [clojure.core/integer?]])))

(ns spec-tools.visitor-test
  (:require [clojure.test :refer [deftest is]]
            [clojure.spec :as s]
            [spec-tools.visitor :refer [visit]]))

(s/def ::str string?)
(s/def ::int integer?)
(s/def ::map (s/keys :req [::str] :opt [::int]))

(defn collect [dispatch spec children] `[~dispatch ~@children])

(deftest test-visit
  (is (= (visit #{1 2 3} collect) [:spec-tools.visitor/set 1 3 2]))
  (is (= (visit ::map collect)
         '[clojure.spec/keys [clojure.core/string?] [clojure.core/integer?]])))

(s/def ::age number?)
(s/def ::first-name string?)
(s/def ::last-name string?)
(s/def ::name (s/keys :req-un [::first-name ::last-name]))
(s/def ::user (s/keys :req-un [::name ::age]))

; https://gist.github.com/shafeeq/c2ded8e71579a26e44c2191536e01c0d
(deftest recursive-visit
  (let [specs (atom {})
        collect (fn [_ spec _]
                  (swap! specs assoc spec (s/form (s/get-spec spec))))]
    (is (= (visit ::user collect)
           {::age (s/form ::age)
            ::first-name (s/form ::first-name)
            ::last-name (s/form ::last-name)
            ::name (s/form ::name)
            ::user (s/form ::user)}))))

Add recursive test for the visitor

Add recursive test for the visitor

* https://gist.github.com/shafeeq/c2ded8e71579a26e44c2191536e01c0d


{:user {:mirrors {#"central|clojars"
                  "http://s3pository.herokuapp.com/clojure"}}
 :production {:mirrors {#"central|clojars"
                        "http://s3pository.herokuapp.com/clojure"}}}

{:user {:mirrors {#"central|clojars"
                  "http://s3pository.herokuapp.com/clojure"}}
 :production {:mirrors {#"central|clojars"
                        "http://s3pository.herokuapp.com/clojure"}}
 :heroku {:mirrors {#"central|clojars"
                    "http://s3pository.herokuapp.com/clojure"}}}

Add back heroku profile with mirrors.

Add back heroku profile with mirrors.

To avoid getting profile not found for users with it in their procfile.


{:shared {:clean-targets ["out" :target-path]

          :test-paths ["test/cljs"]
          :resources-paths ["dev-resources"]

          :dependencies [[com.cemerick/double-check "0.5.7-SNAPSHOT"]]
          :plugins [[com.cemerick/clojurescript.test "0.3.1-SNAPSHOT"]]

          :cljsbuild
          {:builds
           {:beatha
            {:source-paths ["test/cljs"]
             :compiler {:libs [""]
                        :optimizations :whitespace
                        :pretty-print true}}}
           :test-commands
           {"phantomjs"
            ["phantomjs" :runner
             "dev-resources/public/js/beatha.js"]}}}

 :dev [:shared
       {:source-paths ["dev-resources/tools/http" "dev-resources/tools/repl"]

        :dependencies [[ring "1.2.1"]
                       [compojure "1.1.6"]
                       [enlive "1.1.5"]]
        :plugins [[com.cemerick/austin "0.1.5-SNAPSHOT"]]

        :cljsbuild
        {:builds {:beatha
                  {:source-paths ["dev-resources/tools/repl"]}}}

        :injections
        [(require '[ring.server :as http :refer [run]]
                  'cemerick.austin.repls)
         (defn browser-repl-env []
           (reset! cemerick.austin.repls/browser-repl-env
                   (cemerick.austin/repl-env)))
         (defn browser-repl []
           (cemerick.austin.repls/cljs-repl
            (browser-repl-env)))]}]}

{:shared {:clean-targets ["out" :target-path]

          :test-paths ["test/cljs"]
          :resources-paths ["dev-resources"]

          :dependencies [[com.cemerick/double-check "0.5.7-SNAPSHOT"]]
          :plugins [[com.cemerick/clojurescript.test "0.3.1-SNAPSHOT"]]

          :cljsbuild
          {:builds
           {:beatha
            {:source-paths ["test/cljs"]
             :compiler {:libs [""]
                        :optimizations :whitespace
                        :pretty-print true}}}
           :test-commands
           {"phantomjs"
            ["phantomjs" :runner
             "dev-resources/public/js/beatha.js"]}}}

 :tdd [:shared]

 :dev [:shared
       {:source-paths ["dev-resources/tools/http" "dev-resources/tools/repl"]

        :dependencies [[ring "1.2.1"]
                       [compojure "1.1.6"]
                       [enlive "1.1.5"]]
        :plugins [[com.cemerick/austin "0.1.5-SNAPSHOT"]]

        :cljsbuild
        {:builds {:beatha
                  {:source-paths ["dev-resources/tools/repl"]}}}

        :injections
        [(require '[ring.server :as http :refer [run]]
                  'cemerick.austin.repls)
         (defn browser-repl-env []
           (reset! cemerick.austin.repls/browser-repl-env
                   (cemerick.austin/repl-env)))
         (defn browser-repl []
           (cemerick.austin.repls/cljs-repl
            (browser-repl-env)))]}]}

Fix tests on Travis CI.

Fix tests on Travis CI.


(defproject org.onyxplatform/onyx-datomic "0.10.0.0-beta2"
  :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-beta2"]]
  :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-beta2"]]
  :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.


(ns solver.core
  (:gen-class))

(defn determine-floor [xs]
  (let [to-direction (fn [index direction] {:index index :direction direction})
        determine-floor (fn [floor data] (+ floor  (case (data :direction)
                                             "(" +1
                                             ")" -1)))]
    (reduce determine-floor 0  (map-indexed to-direction xs))))

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (let [directions (clojure.string/split (slurp "input") #"")]
    (println (determine-floor directions))))

(ns solver.core
  (:gen-class))

(defn- to-direction [index direction] { :index index :direction direction })

(defn determine-floor [xs]
  (let [
        determine-floor (fn [floor data] (+ floor  (case (data :direction)
                                             "(" +1
                                             ")" -1)))]
    (reduce determine-floor 0  (map-indexed to-direction xs))))

(defn first-basement [directions]
  (let [to-floor (fn [direction] (assoc direction
                                        :floor (determine-floor
                                                (take (direction :index) directions))))
        hit-basement (fn [data] (= (data :floor) -1))]
    (first (filter hit-basement (map to-floor (map-indexed to-direction directions))))))

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (let [directions (clojure.string/split (slurp "input") #"")]
    (println (determine-floor directions))
    (println (first-basement directions))))

Solve part two of day 1 puzzle

Solve part two of day 1 puzzle


(ns beckon
  (:import [com.hypirion.beckon SignalAtoms]
           [sun.misc Signal]))

(defn signal-atom [signal-name]
  (SignalAtoms/getSignalAtom signal-name))

(defn raise! [signal-name]
  (Signal/raise (Signal. signal-name)))

(defn true!
  "Takes a function of no arguments, and returns a function taking no arguments
  which calls f and returns true. f has presumably side effects."
  [f]
  (fn [] (f) true))

(defn false!
  "Takes a function of no arguments, and returns a function taking no arguments
  which calls f and returns false. f has presumably side effects."
  [f]
  (fn [] (f) false))

(ns beckon
  (:import (com.hypirion.beckon SignalAtoms SignalRegisterer)))

(defn signal-atom [signal-name]
  (SignalAtoms/getSignalAtom signal-name))

(defn raise! [signal-name]
  (SignalRegisterer/raiseSignal signal-name))

(defn re-init! [signal-name]
  (SignalRegisterer/resetDefaultHandler signal-name))

(defn re-init-all! []
  (SignalRegisterer/resetAllHandlers))

(defn always-true
  "Takes a function of no arguments, and returns a function taking no arguments
  which calls f and returns true. f has presumably side effects."
  [f]
  (fn [] (f) true))

(defn always-false
  "Takes a function of no arguments, and returns a function taking no arguments
  which calls f and returns false. f has presumably side effects."
  [f]
  (fn [] (f) false))

Make the actual interface of Beckon.

Make the actual interface of Beckon.


(ns hello.core
  (:require [hello.foo.bar :as bar]))

(defn ^{:export "greet"} greet [n]
  (str "Hello " n))

(defn ^:export sum [xs]
  (bar/sum xs))

(ns hello.core
  (:require [hello.foo.bar :as bar]))

(defn ^{:export greet} greet [n]
  (str "Hello " n))

(defn ^:export sum [xs]
  (bar/sum xs))

Use a symbol instead of a string to specify export name in example.


{:user {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                  ;; TODO: re-enable once clojars releases repo is up
                  ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                  }
        :aliases {"repl" "standalone-repl"}
        :plugins [[lein-standalone-repl "0.1.3"]]}
 :production {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                        ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                        }}
 :heroku {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                    ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                    }}}

{:user {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                  ;; TODO: re-enable once clojars releases repo is up
                  ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                  }
        :aliases {"repl" ["trampoline" "repl"]}}
 :production {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                        ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                        }
              :offline true}
 :heroku {:mirrors {"central" "http://s3pository.herokuapp.com/maven-central"
                    ;; "clojars" "http://s3pository.herokuapp.com/clojars"
                    }}}

Remove backported repl trampoline bugfix. Add :offline to production profile.


(ns hydrofoil.expectations.evolution
  (:require [expectations :refer :all]
            [hydrofoil.model :refer :all]
            [hydrofoil.core :refer :all]
            [hydrofoil.evolution :refer :all]
            [hydrofoil.utils :refer :all]))

(expect true
  (let [child (new-indv (NACA-design 2 4 12))]
    (and (<= (child :max-camber) 22) (>= (child :max-camber 2)))))

(expect true
  (let [child (new-indv (NACA-design 2 4 12))]
    (and (<= (child :positon-camber) 5) (>= (child :positon-camber 3)))))

(expect true
  (let [child (new-indv (NACA-design 2 4 12))]
    (and (<= (child :thickness) 22) (> (child :thickness 2)))))

(expect nil
        (some #(and (> (% :max-camber) 100) (< (% :max-camber) 0)) (take 100 (iterate new-indv (NACA-design 2 4 12)))))

(expect nil
        (some #(and (> (% :positon-camber) 10) (< (% :positon-camber) 0)) (take 100 (iterate new-indv (NACA-design 2 4 12)))))

(expect nil
        (some #(and (> (% :thickness) 100) (< (% :thickness) 0)) (take 100 (iterate new-indv (NACA-design 2 4 12)))))

;;; ---------------------- p-min -----------------------------
(expect 0.0100
        (round-double (p-min 0)))
(expect 0.2194
        (round-double (p-min 0.1)))
(expect 0.8796
        (round-double (p-min 10)))
(expect 2.8578
        (round-double (p-min 19.99)))
(expect 2.79
        (round-double (p-min 20)))
(expect 2.79
        (round-double (p-min 35)))
(expect 2.79
        (round-double (p-min 100)))
;;; ---------------------- p-min -----------------------------

Update new indiv tests and add p-min tests


(ns catacumba.impl.helpers
  (:import ratpack.func.Action
           ratpack.func.Function
           ratpack.handling.Context
           io.netty.buffer.Unpooled))

(defn action
  "Coerce a plain clojure function into
  ratpacks's Action interface."
  [callable]
  (reify Action
    (^void execute [_ x]
      (callable x))))

(defn function
  "Coerce a plain clojure function into
  ratpacks's Function interface."
  [callable]
  (reify Function
    (apply [_ x]
      (callable x))))

(defn promise
  "A convenience function for create ratpack
  promises from context instance."
  [^Context ctx callback]
  (.promise ctx (action callback)))

(defprotocol IByteBuffer
  (bytebuffer [_] "Coerce to byte buffer."))

(extend-protocol IByteBuffer
  String
  (bytebuffer [s]
    (Unpooled/wrappedBuffer (.getBytes s "UTF-8"))))

(ns catacumba.impl.helpers
  (:refer-clojure :exclusions [promise])
  (:require [futura.promise :as p])
  (:import ratpack.func.Action
           ratpack.func.Function
           ratpack.exec.Promise
           ratpack.handling.Context
           io.netty.buffer.Unpooled))

(defn action
  "Coerce a plain clojure function into
  ratpacks's Action interface."
  [callable]
  (reify Action
    (^void execute [_ x]
      (callable x))))

(defn function
  "Coerce a plain clojure function into
  ratpacks's Function interface."
  [callable]
  (reify Function
    (apply [_ x]
      (callable x))))

(defn promise
  "A convenience function for create ratpack
  promises from context instance."
  [^Context ctx callback]
  (.promise ctx (action callback)))

(defprotocol IByteBuffer
  (bytebuffer [_] "Coerce to byte buffer."))

(extend-protocol IByteBuffer
  String
  (bytebuffer [s]
    (Unpooled/wrappedBuffer (.getBytes s "UTF-8"))))

(extend-protocol p/IPromise
  ratpack.exec.Promise
  (then* [this callback]
    (.onYield ^Promise this ^Runnable callback))
  (error* [this callback]
    (.onError ^Promise this (action callback))))

Make the ratpack promise type play on the futura IPromise protocol.


(defproject tokyocabinet "1.24.4"
  :url "https://github.com/flatland/tokyocabinet"
  :license {:name "GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1"
            :url "http://www.gnu.org/licenses/lgpl.html"}
  :min-lein-version "2.0.0"
  :description "native tokyo cabinet libraries"
  :dependencies [[fs "1.1.2"]
                 [conch "0.2.4"]]
  :source-paths ["somewhereovertherainbow"]
  :eval-in-leiningen true)

(defproject tokyocabinet "1.24.4"
  :url "https://github.com/flatland/tokyocabinet"
  :license {:name "GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1"
            :url "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html"}
  :min-lein-version "2.0.0"
  :description "native tokyo cabinet libraries"
  :dependencies [[fs "1.1.2"]
                 [conch "0.2.4"]]
  :source-paths ["somewhereovertherainbow"]
  :eval-in-leiningen true)

Use the actual correct link to lgpl 2.1

Use the actual correct link to lgpl 2.1


(defproject io.aviso/twixt "0.1.12"
  :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.6.0"]
                 [io.aviso/pretty "0.1.10"]
                 [io.aviso/tracker "0.1.0"]
                 [ring/ring-core "1.2.2"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.5.3"]
                 [de.neuland-bfi/jade4j "0.4.0"]
                 [hiccup "1.0.4"]]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/twixt/blob/master/"
          :src-linenum-anchor-prefix "L"}
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

(defproject io.aviso/twixt "0.1.13-SNAPSHOT"
  :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.6.0"]
                 [io.aviso/pretty "0.1.10"]
                 [io.aviso/tracker "0.1.0"]
                 [ring/ring-core "1.2.2"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.5.3"]
                 [de.neuland-bfi/jade4j "0.4.0"]
                 [hiccup "1.0.4"]]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/twixt/blob/master/"
          :src-linenum-anchor-prefix "L"}
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

Update version for next milestone

Update version for next milestone


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject kamituel/systems-toolbox-chrome "0.1.0-SNAPSHOT"
  :description "Chrome DevTools support for systems-toolbox library"
  :url ""
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [matthiasn/systems-toolbox "0.2.17"]
                 [org.clojure/clojurescript "0.0-3308"]]
  :plugins [[lein-cljsbuild "1.0.6"]]
  :cljsbuild {:builds {:devtools {:source-paths ["src/devtools/cljs"]
                                  :compiler {:asset-path "js"
                                             :optimizations :simple
                                             :output-dir "resources/devtools/js"
                                             :output-to "resources/devtools/js/all.js"
                                             :source-map "resources/devtools/js/all.map"}}}})

(defproject kamituel/systems-toolbox-chrome "0.1.0-SNAPSHOT"
  :description "Chrome DevTools support for systems-toolbox library"
  :url ""
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [matthiasn/systems-toolbox "0.2.17"]
                 [org.clojure/clojurescript "0.0-3308"]]
  :plugins [[lein-cljsbuild "1.0.6"]]
  :clean-targets ^{:protect false} ["resources/devtools/js/"]
  :cljsbuild {:builds {:devtools {:source-paths ["src/devtools/cljs"]
                                  :compiler {:asset-path "js"
                                             :optimizations :simple
                                             :output-dir "resources/devtools/js"
                                             :output-to "resources/devtools/js/all.js"
                                             :source-map "resources/devtools/js/all.map"}}}})

Fix for lein clean not cleaning compiled js files


(defproject onyx-app/lein-template "0.9.14.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.14.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 stencil "0.1.3-SNAPSHOT"
  :description "Mustache in Clojure"
  :dependencies [[clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]]
  :dev-dependencies [[swank-clj "0.1.7-SNAPSHOT"]
                     [org.clojure/clojure-contrib "1.2.0"]]
  :tasks [cake.tasks.swank-clj stencil.cake.tasks])

(defproject stencil "0.2.0-SNAPSHOT"
  :description "Mustache in Clojure"
  :dependencies [[clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]]
  :dev-dependencies [[swank-clj "0.1.7-SNAPSHOT"]
                     [org.clojure/clojure-contrib "1.2.0"]]
  :tasks [cake.tasks.swank-clj stencil.cake.tasks])

Bump version for new development.

Bump version for new development.


(ns doctopus.test-utilities
  (:require [clojure.test :refer :all]
            [doctopus.storage :refer [remove-from-storage backend]]
            [doctopus.test-utilities :refer :all])
  (:import [org.joda.time DateTime]
           [org.joda.time.format DateTimeFormat]))

(def iso-formatter (DateTimeFormat/forPattern "yyyy-MM-dd"))

(defn make-today
  []
  (let [today (DateTime.)]
    (.print iso-formatter today)))

(defn clean-up-test-html
  [k]
  (remove-from-storage backend k))

(ns doctopus.test-utilities
  (:require [clojure.string :as str]
            [clojure.test :refer :all]
            [doctopus.storage :refer [remove-from-storage backend]]
            [doctopus.test-utilities :refer :all])
  (:import [org.joda.time DateTime]
           [org.joda.time.format DateTimeFormat]))

(def iso-formatter (DateTimeFormat/forPattern "yyyy-MM-dd"))

(defn make-today
  []
  (let [today (DateTime.)]
    (.print iso-formatter today)))

(defn clean-up-test-html
  [k]
  (remove-from-storage backend k))

(defmulti mock-data (fn [kind length] kind))

(defmethod mock-data :int
  [_ length]
  (rand-int length))

(defmethod mock-data :string
  [_ length]
  (let [upper-alphas "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        lower-alphas (str/lower-case upper-alphas)
        nums "0123456789"
        punct-and-spaces " -!,?:~_ \"'$%&"
        candidate-chars (apply str
                               upper-alphas
                               lower-alphas
                               nums
                               punct-and-spaces)]
    (loop [acc []]
      (if (= (count acc) length)
        (apply str acc)
        (recur (conj acc (rand-nth candidate-chars)))))))

Add some data-mocking test utils

Add some data-mocking test utils


(defproject sqls "0.1.1"
  :description "SQLS"
  :url "https://github.com/mpietrzak/sqls"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0-alpha6"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/java.jdbc "0.3.6"]
                 [org.clojure/tools.cli "0.3.1"]
                 [org.clojure/tools.logging "0.3.1"]
                 [org.xerial/sqlite-jdbc "3.8.7"]
                 ;[com.taoensso/timbre "3.4.0"]
                 [seesaw "1.4.5"]
                 ]
  :main sqls.core
  :java-source-paths ["src"]
  :target-path "target/%s"
  :plugins [[codox "0.8.11"]]
  :codox {:output-dir "doc/codox"}
  :profiles {:uberjar {:aot :all}
             :dev {:global-vars {*warn-on-reflection* true}
                   :jvm-opts ["-Xms4M" "-Xmx1G" "-XX:+PrintGC" "-XX:+UseG1GC"]}})

(defproject sqls "0.1.1"
  :description "SQLS"
  :url "https://github.com/mpietrzak/sqls"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0-beta2"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/java.jdbc "0.3.6"]
                 [org.clojure/tools.cli "0.3.1"]
                 [org.clojure/tools.logging "0.3.1"]
                 [org.xerial/sqlite-jdbc "3.8.7"]
                 ;[com.taoensso/timbre "3.4.0"]
                 [seesaw "1.4.5"]
                 ]
  :main sqls.core
  :java-source-paths ["src"]
  :target-path "target/%s"
  :plugins [[codox "0.8.11"]]
  :codox {:output-dir "doc/codox"}
  :profiles {:uberjar {:aot :all}
             :dev {:global-vars {*warn-on-reflection* true}
                   :jvm-opts ["-Xms4M" "-Xmx1G" "-XX:+PrintGC" "-XX:+UseG1GC"]}})

Update Clojure dep to 1.7.0-beta2.

Update Clojure dep to 1.7.0-beta2.


(defproject funcool/beicon "1.1.1"
  :description "Reactive Streams for ClojureScript (built on top of RxJS 5.x)"
  :url "https://github.com/funcool/beicon"
  :license {:name "Public Domain" :url "http://unlicense.org/"}
  :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
                 [org.clojure/clojurescript "1.8.34" :scope "provided"]
                 [funcool/promesa "1.1.1" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src" "assets"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]

  :codeina {:sources ["src"]
            :reader :clojurescript
            :target "doc/dist/latest/api"
            :src-uri "http://github.com/funcool/beicon/blob/master/"
            :src-uri-prefix "#L"}

  :plugins [[funcool/codeina "0.3.0"]])

(defproject funcool/beicon "1.1.1"
  :description "Reactive Streams for ClojureScript (built on top of RxJS 5.x)"
  :url "https://github.com/funcool/beicon"
  :license {:name "Public Domain" :url "http://unlicense.org/"}
  :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
                 [org.clojure/clojurescript "1.8.40" :scope "provided"]
                 [funcool/promesa "1.1.1" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src" "assets"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]

  :codeina {:sources ["src"]
            :reader :clojurescript
            :target "doc/dist/latest/api"
            :src-uri "http://github.com/funcool/beicon/blob/master/"
            :src-uri-prefix "#L"}

  :plugins [[funcool/codeina "0.3.0"]])

Update cljs compiler version to 1.8.40

Update cljs compiler version to 1.8.40


(defproject org.flatland/useful "0.9.3-SNAPSHOT"
  :description "A collection of generally-useful Clojure utility functions"
  :license {:name "Eclipse Public License - v 1.0"
            :url "http://www.eclipse.org/legal/epl-v10.html"
            :distribution :repo}
  :url "https://github.com/flatland/useful"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/tools.macro "0.1.1"]]
  :aliases {"testall" ["with-profile" "dev,default:dev,1.3,default:dev,1.2,default" "test"]}
  :profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}
             :1.2 {:dependencies [[org.clojure/clojure "1.2.1"]]}})

(defproject org.flatland/useful "0.9.3-SNAPSHOT"
  :description "A collection of generally-useful Clojure utility functions"
  :license {:name "Eclipse Public License - v 1.0"
            :url "http://www.eclipse.org/legal/epl-v10.html"
            :distribution :repo}
  :url "https://github.com/flatland/useful"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [org.clojure/tools.macro "0.1.1"]]
  :aliases {"testall" ["with-profile" "dev,default:dev,1.3,default:dev,1.5,default" "test"]}
  :profiles {:1.5 {:dependencies [[org.clojure/clojure "1.5.0-RC16"]]}
             :1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]}})

Remove 1.2.1 stuff because we don't support it anymore.


(defproject reply "0.0.2-SNAPSHOT"
  :description "REPL-y: A fitter, happier, more productive REPL for Clojure."
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojars.trptcolin/jline "2.6-SNAPSHOT"]
                 [clojure-complete "0.1.4"]]
  :dev-dependencies [[midje "1.3-alpha4"]
                     [lein-midje "[1.0.0,)"]]
  :aot [reply.reader.jline.JlineInputReader]
  :java-source-path "src")

(defproject reply "0.0.2-SNAPSHOT"
  :description "REPL-y: A fitter, happier, more productive REPL for Clojure."
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [net.sf.jline/jline "2.6-SNAPSHOT"]
                 [clojure-complete "0.1.4"]]
  :dev-dependencies [[midje "1.3-alpha4"]
                     [lein-midje "[1.0.0,)"]]
  :aot [reply.reader.jline.JlineInputReader]
  :repositories {"sonatype"
                 {:url "http://oss.sonatype.org/content/repositories/snapshots"}}
  :java-source-path "src")

Use the sonatype repo, now that the patches are in


(defproject org.onyxplatform/onyx-metrics "0.8.2.0"
  :description "Instrument Onyx workflows"
  :url "https://github.com/MichaelDrogalis/onyx"
  :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 [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.2"]
                 [org.clojure/clojure "1.7.0"]
                 [interval-metrics "1.0.0"]
                 [stylefruits/gniazdo "0.4.0"]]
  :java-opts ^:replace ["-server" "-Xmx3g"]
  :global-vars  {*warn-on-reflection* true
                 *assert* false
                 *unchecked-math* :warn-on-boxed}
  :profiles {:dev {:dependencies [[riemann-clojure-client "0.4.1"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}})

(defproject org.onyxplatform/onyx-metrics "0.8.2.1-SNAPSHOT"
  :description "Instrument Onyx workflows"
  :url "https://github.com/MichaelDrogalis/onyx"
  :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 [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.2"]
                 [org.clojure/clojure "1.7.0"]
                 [interval-metrics "1.0.0"]
                 [stylefruits/gniazdo "0.4.0"]]
  :java-opts ^:replace ["-server" "-Xmx3g"]
  :global-vars  {*warn-on-reflection* true
                 *assert* false
                 *unchecked-math* :warn-on-boxed}
  :profiles {:dev {:dependencies [[riemann-clojure-client "0.4.1"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}})

Prepare for next release cycle.

Prepare for next release cycle.