(ns ktra-indexer.config
  "Namespace for configuration reading functions"
  (:require [clojure.edn :as edn]))

(defn load-config
  "Given a filename, load and return a config file."
  [filename]
  (edn/read-string (slurp filename)))

(defn get-conf-value
  "Return a key value from the configuration."
  [property & {:keys [k use-sample]
               :or {k nil
                    use-sample false}}]
  (let [config (load-config
                (clojure.java.io/resource
                 (if use-sample
                   "config.edn_sample"
                   "config.edn")))]
    (if k
      (k (property config))
      (property config))))

(defn db-conf
  "Returns the value of the requested database configuration key"
  [k & [use-sample]]
  (get-conf-value :database :k k :use-sample use-sample))

(ns ktra-indexer.config
  "Namespace for configuration reading functions"
  (:require [clojure.edn :as edn]
            [clojure.java.io :refer [resource]]))

(defn load-config
  "Given a filename, load and return a config file."
  [filename]
  (edn/read-string (slurp filename)))

(defn get-conf-value
  "Return a key value from the configuration."
  [property & {:keys [k use-sample]
               :or {k nil
                    use-sample false}}]
  (let [config (load-config
                (resource (if use-sample
                            "config.edn_sample"
                            "config.edn")))]
    (if k
      (k (property config))
      (property config))))

(defn db-conf
  "Returns the value of the requested database configuration key"
  [k & [use-sample]]
  (get-conf-value :database :k k :use-sample use-sample))

Fix a warning reported by eastwood

Fix a warning reported by eastwood


(ns five-three-one.server
  (:require [five-three-one.handler :refer [app]]
            [environ.core :refer [env]]
            [ring.adapter.jetty :refer [run-jetty]]
            [five-three-one.model.migration :refer [migrate]])
  (:gen-class))

(defn -main [& args]
  (let [port (Integer/parseInt (or (env :port) "3000"))]
    (migrate)
    (run-jetty app {:port port :join? false})))

(ns five-three-one.server
  (:require [five-three-one.handler :refer [app]]
            [environ.core :refer [env]]
            [ring.adapter.jetty :refer [run-jetty]]
            [five-three-one.model.migration :refer [migrate]])
  (:gen-class))

(defn -main [& args]
  (if (some #{"migrate"} args)
    (migrate)
    (let [port (Integer/parseInt (or (env :port) "3000"))]
      (run-jetty app {:port port :join? false}))))

Enable "lein run migrate" command for db migration


(ns ^:figwheel-always sidequarter-frontend.api
    (:require-macros [sidequarter-frontend.env :refer [cljs-env]]
                     [cljs.core.async.macros :refer [go]])
    (:require [cljs-http.client :as http]
              [cljs.core.async :refer [<! >! put! chan]]))

(def api-url (cljs-env :api-url))

(defn get-sidekiqs []
  (http/jsonp api-url {:callback-name "callback"}))

(ns ^:figwheel-always sidequarter-frontend.api
    (:require-macros [sidequarter-frontend.env :refer [cljs-env]]
                     [cljs.core.async.macros :refer [go]])
    (:require [cljs-http.client :as http]
              [cljs.core.async :refer [<! >! put! chan]]
              [clojure.string :refer [join]]))

(def api-url (cljs-env :api-url))

(defn get-sidekiqs []
  (http/jsonp api-url {:callback-name "callback"}))

(defn stats-path [sidekiq-id]
  (join "/" [api-url sidekiq-id "stats"]))

(defn get-stats [sidekiq-id]
  (let [url (stats-path sidekiq-id)]
    (http/jsonp url {:callback-name "callback"})))

Implement API call to get stats of a sidekiq instance


(ns metabase.models.label
  (:require [korma.core :as k]
            [metabase.db :as db]
            [metabase.models.interface :as i]
            [metabase.util :as u]))

(i/defentity Label :label)

(defn- pre-insert [{label-name :name, :as label}]
  (assoc label :slug (u/slugify label-name)))

(defn- pre-update [{label-name :name, :as label}]
  (if-not label-name
    label
    (assoc label :slug (u/slugify label-name))))

(defn- pre-cascade-delete [{:keys [id]}]
  (db/cascade-delete 'CardLabel :label_id id))

(u/strict-extend (class Label)
  i/IEntity
  (merge i/IEntityDefaults
         {:can-read?          (constantly true)
          :can-write?         (constantly true)
          :pre-insert         pre-insert
          :pre-update         pre-update
          :pre-cascade-delete pre-cascade-delete}))

(ns metabase.models.label
  (:require [korma.core :as k]
            [metabase.db :as db]
            [metabase.models.interface :as i]
            [metabase.util :as u]))

(i/defentity Label :label)

(defn- assert-unique-slug [slug]
  (when (db/exists? Label :slug slug)
    (throw (ex-info "Name already taken" {:status-code 400, :errors {:name "A label with this name already exists"}}))))

(defn- pre-insert [{label-name :name, :as label}]
  (assoc label :slug (u/prog1 (u/slugify label-name)
                       (assert-unique-slug <>))))

(defn- pre-update [{label-name :name, :as label}]
  (if-not label-name
    label
    (assoc label :slug (u/prog1 (u/slugify label-name)
                         (assert-unique-slug <>)))))

(defn- pre-cascade-delete [{:keys [id]}]
  (db/cascade-delete 'CardLabel :label_id id))

(u/strict-extend (class Label)
  i/IEntity
  (merge i/IEntityDefaults
         {:can-read?          (constantly true)
          :can-write?         (constantly true)
          :pre-insert         pre-insert
          :pre-update         pre-update
          :pre-cascade-delete pre-cascade-delete}))

Throw 400 if slug name already taken :scream_cat:


(defproject hatnik/tools.backup "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [com.google.apis/google-api-services-storage "v1beta2-rev43-1.18.0-rc"]
                 [com.google.http-client/google-http-client-jackson2 "1.17.0-rc"]
                 [com.google.oauth-client/google-oauth-client-jetty "1.17.0-rc"]]

  :main hatnik.tools.backup
  :aot :all)

(defproject hatnik/tools.backup "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [com.google.apis/google-api-services-storage "v1-rev22-1.19.0"]
                 [com.google.http-client/google-http-client-jackson2 "1.19.0"]
                 [com.google.oauth-client/google-oauth-client-jetty "1.19.0"]]

  :main hatnik.tools.backup
  :aot :all)

Fix backup tool by updating to latest version of google API.


(defproject io.atomix/trinity "1.0.0-SNAPSHOT"
  :description "A sweet little Clojure API for Atomix"
  :url "http://github.com/atomix/trinity"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [io.atomix/atomix-all "1.0.1-SNAPSHOT"]
                 [io.atomix.catalyst/catalyst-netty "1.1.2"]]
  :repositories [["sonatype-nexus-snapshots" {:url "https://oss.sonatype.org/content/repositories/snapshots"}]]
  :plugins [[lein-codox "0.9.0"]
            [lein-localrepo "0.5.3"]]
  :codox {:output-path "target/docs/api"
          :metadata {:doc/format :markdown}
          :source-uri "http://github.com/atomix/trinity/blob/master/{filepath}#L{line}"})

(defproject io.atomix/trinity "1.0.0"
  :description "A sweet little Clojure API for Atomix"
  :url "http://github.com/atomix/trinity"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [io.atomix/atomix-all "1.0.0"]
                 [io.atomix.catalyst/catalyst-netty "1.1.2"]]
  :repositories [["sonatype-nexus-snapshots" {:url "https://oss.sonatype.org/content/repositories/snapshots"}]]
  :plugins [[lein-codox "0.9.0"]
            [lein-localrepo "0.5.3"]]
  :codox {:output-path "target/docs/api"
          :metadata {:doc/format :markdown}
          :source-uri "http://github.com/atomix/trinity/blob/master/{filepath}#L{line}"})

Use release versions instead of SNAPSHOT


(defproject funcool/promesa "0.5.0-SNAPSHOT"
  :description "A promise library for ClojureScript"
  :url "https://github.com/funcool/promesa"
  :license {:name "BSD (2 Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
                 [org.clojure/clojurescript "1.7.48" :scope "provided"]
                 [funcool/cats "1.0.0-SNAPSHOT"]]
  :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"}
  :plugins [[funcool/codeina "0.3.0"]
            [lein-externs "0.1.3"]])

(defproject funcool/promesa "0.5.0-SNAPSHOT"
  :description "A promise library for ClojureScript"
  :url "https://github.com/funcool/promesa"
  :license {:name "BSD (2 Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
                 [org.clojure/clojurescript "1.7.48" :scope "provided"]
                 [funcool/cats "1.0.0"]]
  :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"}
  :plugins [[funcool/codeina "0.3.0"]
            [lein-externs "0.1.3"]])

Set cats version to 1.0.0 final.

Set cats version to 1.0.0 final.


(ns bltool.data.steam
  (:require [bltool.data.default :refer [read-games]])
  (:require [bltool.flags :refer :all])
  (:require [clj-http.client :as http])
  (:require [clojure.data.xml :as xml])
  (:require [clojure.string :refer [trim]]))

(register-flags ["--steam-name" "Steam Community name"]
                ["--steam-platform" "Default platform to use for Steam games (recommended: PC, PCDL, or Steam)" :default "PC"])

(defn- xml-to-map
  [tag]
    (let [tag-content (fn [tag] [(:tag tag) (apply str (:content tag))])]
      (into {} (map tag-content (:content tag)))))

(defmethod read-games "steam" [_]
  (let [name (:steam-name *opts*)
        url (str "http://steamcommunity.com/id/" name "/games?tab=all&xml=1")]
    (->> url http/get :body xml/parse-str xml-seq (filter #(= :game (:tag %)))
      (map (comp trim :name xml-to-map))
      sort
      (map (fn [name] { :id "0" :name name :platform (:steam-platform *opts*) :progress "unplayed" })))))

(ns bltool.data.steam
  (:require [bltool.data.default :refer [read-games]])
  (:require [bltool.flags :refer :all])
  (:require [clj-http.client :as http])
  (:require [clojure.data.xml :as xml])
  (:require [slingshot.slingshot :refer [throw+]])
  (:require [clojure.string :refer [trim]]))

(register-flags ["--steam-name" "Steam Community name"]
                ["--steam-platform" "Default platform to use for Steam games (recommended: PC, PCDL, or Steam)" :default "PC"])

(defn- xml-to-map
  [tag]
    (let [tag-content (fn [tag] [(:tag tag) (apply str (:content tag))])]
      (into {} (map tag-content (:content tag)))))

(defn- check-games
  [games]
  (if (empty? games)
    (throw+ (str "Couldn't find any games at http://steamcommunity.com/id/" (:steam-name *opts*)
                 " -- are you sure you specified the right --steam-name?"))
    games))

(defmethod read-games "steam" [_]
  (if (not (:steam-name *opts*))
    (throw+ "No Steam Community name specified - use the --steam-name option."))
  (let [name (:steam-name *opts*)
        url (str "http://steamcommunity.com/id/" name "/games?tab=all&xml=1")]
    (->> url http/get :body xml/parse-str xml-seq (filter #(= :game (:tag %)))
      (map (comp trim :name xml-to-map))
      sort
      (map (fn [name] { :id "0" :name name :platform (:steam-platform *opts*) :progress "unplayed" }))
      check-games)))

Add better error checking to Steam reader.

It will now throw if:
- --from steam was specified but --steam-name was not
- the game list for the given --steam-name is private, empty, or otherwise inaccessible


(use 'figwheel-sidecar.repl-api)
(start-figwheel!) ;; <-- fetches configuration
(cljs-repl)

(require '[figwheel.main.api :as fig])
(fig/start "dev")

Use figwheel main for cursive

Use figwheel main for cursive


(ns territory-bro.handler-test
  (:require [clojure.test :refer :all]
            [ring.mock.request :refer :all]
            [territory-bro.handler :refer :all]))

(deftest test-app
  (testing "main route"
    (let [response (app (request :get "/"))]
      (is (= 200 (:status response)))))

  (testing "not-found route"
    (let [response (app (request :get "/invalid"))]
      (is (= 404 (:status response))))))

(ns territory-bro.handler-test
  (:require [clojure.test :refer :all]
            [ring.mock.request :refer :all]
            [territory-bro.handler :refer :all]
            [territory-bro.db.migrations :as migrations]
            [territory-bro.db.core :as db]))

(use-fixtures
  :once
  (fn [f]
    (db/connect!)
    (migrations/migrate ["migrate"])
    (f)))

(deftest test-app
  (testing "main route"
    (let [response (app (request :get "/"))]
      (is (= 200 (:status response)))))

  (testing "not-found route"
    (let [response (app (request :get "/invalid"))]
      (is (= 404 (:status response))))))

Fix no DB connection when running tests

Fix no DB connection when running tests


(ns onyx.plugin.mysql
  "Implementation of MySQL-specific utility functions."

  (:require [honeysql.core :as hsql]
            [honeysql.format :as hformat]))

(defn upsert
  "Using honeysql-postgres, construct a SQL string to do upserts with Postgres.
  We expect the key in the 'where' map to be a primary key."
  [table row where]
  (hsql/format {:insert-into table
                :values [(merge where row)]
                :on-duplicate-key-update row}))

(defmethod hformat/format-clause :on-duplicate-key-update [[_ values] _]
  (str "ON DUPLICATE KEY UPDATE "
       (hformat/comma-join (for [[k v] values]
                             (str (hformat/to-sql k) " = "
                                  (hformat/to-sql v))))))

(hformat/register-clause! :on-duplicate-key-update 225)

(ns onyx.plugin.mysql
  "Implementation of MySQL-specific utility functions."

  (:require [honeysql.core :as hsql]
            [honeysql.format :as hformat]))

(defn upsert
  "Using honeysql-postgres, construct a SQL string to do upserts with Postgres.
  We expect the key in the 'where' map to be a primary key."
  [table row where]
  (hsql/format {:insert-into table
                :values [(merge where row)]
                :on-duplicate-key-update row}))

(defmethod hformat/format-clause :on-duplicate-key-update [[_ values] _]
  (str "ON DUPLICATE KEY UPDATE "
       (hformat/comma-join (for [[k v] values]
                             (str (hformat/to-sql k) " = "
                                  (hformat/to-sql v))))))

;; This number is used to insert the clause towards the end of the constructed
;; SQL string. honeysql-postgres was used as reference:
;; https://github.com/nilenso/honeysql-postgres/blob/master/src/honeysql_postgres/format.clj#L19
(def clause-order 225)

(hformat/register-clause! :on-duplicate-key-update clause-order)

Document :on-duplicate-key-update clause order number


{
  ;; inf-clojure support
  :jvm-opts ["-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl}"]
 ;; for all that repl goodness
 :user { :dependencies [[org.clojure/tools.namespace "0.3.0-alpha4"]
                        [eftest "0.5.1"]]
        :plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]
                  [lein-cloverage "1.0.6" :exclusions [org.clojure/clojure]]
                  [lein-ancient "0.6.10", :exclusions [org.clojure/clojure]]]}
}

{
  ;; inf-clojure support
  :jvm-opts ["-Dclojure.server.repl={:port 5555 :accept clojure.core.server/repl}"]
 ;; for all that repl goodness
 :user { :dependencies [[org.clojure/tools.namespace "0.3.0-alpha4"]
                        [clj-http "3.9.0"]
                        [eftest "0.5.1"]]
        :plugins [[lein-cljfmt "0.4.1" :exclusions [org.clojure/clojure]]
                  [lein-cloverage "1.0.6" :exclusions [org.clojure/clojure]]
                  [lein-ancient "0.6.15", :exclusions [org.clojure/clojure]]]}
}

Add clj-http and lein-ancient to lein profile


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

;;; Credits: https://github.com/swannodette/om

(enable-console-print!)

(println "Hello world!")

(defn widget [data owner]
  (reify
    om/IRender
    (render [this]
      (dom/h1 nil (:text data)))))

(om/root widget {:text "Hello world!"}
         {:target (. js/document (getElementById "app"))})

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

;;; Credits:
;;;  - https://github.com/swannodette/om
;;;  - https://github.com/swannodette/om/wiki/Basic-Tutorial

(enable-console-print!)

(println "Hello world!")

(defn handle-change [event owner {:keys [text]}]
  (om/set-state! owner :text (.. event -target -value)))

(defn process-input [owner]
  (let [input (.-value (om/get-node owner "misc-input"))]
    (when input
      (println (str "Input: " input))
      (om/set-state! owner :text ""))))

(defn widget [data owner]
  (reify
    om/IInitState
    (init-state [_] {:text ""})

    om/IRenderState
    (render-state [this state]
      (dom/div nil
        (dom/h1 nil (:headline data))
        (dom/input
          #js {:type "text"
               :ref "misc-input"
               :value (:text state)
               :onChange #(handle-change % owner state)
               :onKeyDown #(when (= (.-key %) "Enter")
                                 (process-input owner))})
        (dom/button
          #js {:onClick #(process-input owner)}
          "Send")))))

(om/root widget {:headline "Hello world!"}
         {:target (. js/document (getElementById "app"))})

Set up an input field on the try-it-out page

I'm going to do a bit of vertical experimentation: add an input field
on the client, send a request to the server, process it on the
server, store something in the database. This is the first step on that
way.


(defproject todomvc-re-frame "0.11.0-rc2-SNAPSHOT"
  :dependencies [[org.clojure/clojure        "1.10.1"]
                 [org.clojure/clojurescript  "1.10.520"
                  :exclusions [com.google.javascript/closure-compiler-unshaded
                               org.clojure/google-closure-library]]
                 [thheller/shadow-cljs "2.8.52"]
                 [reagent "0.9.0-rc1"]
                 [re-frame "0.11.0-rc2-SNAPSHOT"]
                 [binaryage/devtools "0.9.10"]
                 [clj-commons/secretary "1.2.4"]
                 [day8.re-frame/tracing "0.5.3"]]

  :plugins [[lein-shadow "0.1.5"]]

  :clean-targets ^{:protect false} [:target-path
                                    "shadow-cljs.edn"
                                    "package.json"
                                    "package-lock.json"
                                    "resources/public/js"]

  :shadow-cljs {:nrepl {:port 8777}

                :builds {:client {:target :browser
                                  :output-dir "resources/public/js"
                                  :modules {:client {:init-fn todomvc.core/main}}
                                  :devtools {:http-root "resources/public"
                                             :http-port 8280}}}}

  :aliases {"dev-auto" ["shadow" "watch" "client"]})

(defproject todomvc-re-frame "0.11.0-rc2-SNAPSHOT"
  :dependencies [[org.clojure/clojure        "1.10.1"]
                 [org.clojure/clojurescript  "1.10.520"
                  :exclusions [com.google.javascript/closure-compiler-unshaded
                               org.clojure/google-closure-library]]
                 [thheller/shadow-cljs "2.8.52"]
                 [reagent "0.9.0-rc1"]
                 [re-frame "0.11.0-rc2-SNAPSHOT"]
                 [binaryage/devtools "0.9.10"]
                 [clj-commons/secretary "1.2.4"]
                 [day8.re-frame/tracing "0.5.3"]]

  :plugins [[lein-shadow "0.1.6"]]

  :clean-targets ^{:protect false} [:target-path
                                    "shadow-cljs.edn"
                                    "package.json"
                                    "package-lock.json"
                                    "resources/public/js"]

  :shadow-cljs {:nrepl {:port 8777}

                :builds {:client {:target :browser
                                  :output-dir "resources/public/js"
                                  :modules {:client {:init-fn todomvc.core/main}}
                                  :devtools {:http-root "resources/public"
                                             :http-port 8280}}}}

  :aliases {"dev-auto" ["shadow" "watch" "client"]})

Upgrade todomvc example lein-shadow to 0.1.6


(ns ecregister.favorites
  (:gen-class)
  (:require [ecregister.posts :as posts])
  (:require [clj-time.core :as t])
  (:require [clj-time.format :as f]))

(defn parse-date [str]
  (f/parse (f/formatters :date-time-no-ms) str))

(defn is-more-recent [date post]
  "checks if post is more recent than date"
  (when-let [post-date (parse-date (:date post))]
    (t/within? (t/interval date (t/today-at 23 59))
               post-date)))

(defn print-post [p]
  (prn (format "%s, автор <ls user=\"%s\"/> (%s голосов)"
               (:link p) (:title p) (:author p) (:fav-count p))))

(defn print-favorites [since-date]
  (let [all-posts (posts/fetch-aw-posts #(is-more-recent since-date %))]
    (dorun (take 15 (map print-post
                         (sort-by #(Integer/parseInt (:fav-count %)) #(compare %2 %1) all-posts))))
    ))

(defn print-favorites-of-month []
  ;; print favs with dates more recent than month ago
  (print-favorites (t/minus (t/today-at 0 0) (t/months 1))))

;;(print-favorites-of-month)

(ns ecregister.favorites
  (:gen-class)
  (:require [ecregister.posts :as posts])
  (:require [clj-time.core :as t])
  (:require [clj-time.format :as f]))

(defn parse-date [str]
  (f/parse (f/formatters :date-time-no-ms) str))

(defn is-more-recent [date post]
  "checks if post is more recent than date"
  (when-let [post-date (parse-date (:date post))]
    (t/within? (t/interval date (t/today-at 23 59))
               post-date)))

(defn print-post [p]
  (println (format "%s, автор <ls user=\"%s\"/>"
               (:link p) (:title p) (:author p))))

(defn print-favorites [since-date]
  (let [all-posts (posts/fetch-aw-posts #(is-more-recent since-date %))]
    (dorun (take 15 (map print-post
                         (sort-by #(Integer/parseInt (:fav-count %)) #(compare %2 %1) all-posts))))
    ))

(defn print-favorites-of-month []
  ;; print favs with dates more recent than month ago
  (print-favorites (t/minus (t/today-at 0 0) (t/months 1))))

;;(print-favorites-of-month)

Update format of fav posts output

Update format of fav posts output


(ns subman.routes
  (:require [secretary.core :as secretary :include-macros true :refer [defroute]]
            [goog.events :as gevents]
            [goog.history.EventType :as history-event]
            [subman.deps :as d]))

(defn set-search-query
  "Set value of stable search query"
  [value]
  (when-let [state (secretary/get-config :state)]
    (swap! state assoc
           :stable-search-query value
           :search-query value)))

(defn change-url!
  "Change page url"
  [url]
  (when @d/history
    (.setToken @d/history url)))

(defn init-routes
  "Init history and spy to atom"
  [state]
  (when @d/history
    (secretary/set-config! :state state)
    (secretary/dispatch! (.getToken @d/history))
    (gevents/listen @d/history history-event/NAVIGATE
                    #(secretary/dispatch! (.-token %)))))

(defroute main-page "/" []
          (set-search-query ""))

(defroute search-page "/search/*query" {:keys [query]}
          (set-search-query query))

(ns subman.routes
  (:require [secretary.core :as secretary :include-macros true :refer [defroute]]
            [goog.events :as gevents]
            [goog.history.EventType :as history-event]
            [subman.deps :as d]))

(defn set-search-query
  "Set value of stable search query"
  [value]
  (when-let [state (secretary/get-config :state)]
    (when (not= (:search-query @state) value)
      (swap! state assoc
             :stable-search-query value
             :search-query value)
      (swap! state update-in
             [:search-query-counter] inc))))

(defn change-url!
  "Change page url"
  [url]
  (when @d/history
    (.setToken @d/history url)))

(defn init-routes
  "Init history and spy to atom"
  [state]
  (when @d/history
    (secretary/set-config! :state state)
    (secretary/dispatch! (.getToken @d/history))
    (gevents/listen @d/history history-event/NAVIGATE
                    #(secretary/dispatch! (.-token %)))))

(defroute main-page "/" []
          (set-search-query ""))

(defroute search-page "/search/*query" {:keys [query]}
          (set-search-query query))

Update search query only if it necessary


{:user {:aliases {"math" ^{:doc "Start a REPL with math dependencies added."}
                    ["with-profile" "+math" "repl"]
                  "eval" ^{:doc
                           "Evaluate a Clojure string with clojure.main/main."}
                    ["run" "-m" "clojure.main/main" "-e"]}
        :plugins [[lein-shell "0.3.0"]
                  [lein-miditest "0.1.0"]
                  [lein-pprint "1.1.1"]]}
 :math {:dependencies [[org.clojure/math.combinatorics "0.0.2"]
                       [org.clojure/math.numeric-tower "0.0.1"]
                       [org.clojure/tools.trace "0.7.3"]]
        :repl-options {:init (do (use 'clojure.math.combinatorics
                                      'clojure.math.numeric-tower
                                      'clojure.tools.trace)
                                 (require '[clojure.pprint
                                            :refer [pprint cl-format]]))}}}

{:user {:aliases {"math" ^{:doc "Start a REPL with math dependencies added."}
                    ["with-profile" "+math" "repl"]
                  "eval" ^{:doc
                           "Evaluate a Clojure string with clojure.main/main."}
                    ["run" "-m" "clojure.main/main" "-e"]}
        :plugins [[lein-shell "0.3.0"]
                  [lein-miditest "0.1.0"]
                  [lein-pprint "1.1.1"]]}
 :math {:dependencies [[org.clojure/math.combinatorics "0.0.2"]
                       [org.clojure/math.numeric-tower "0.0.1"]
                       [com.hypirion/primes "0.2.1"]
                       [org.clojure/tools.trace "0.7.3"]]
        :repl-options {:init (do (use 'clojure.math.combinatorics
                                      'clojure.math.numeric-tower
                                      'clojure.tools.trace)
                                 (require '[clojure.pprint
                                            :refer [pprint cl-format]]
                                          '[com.hypirion.primes :as primes]))}}}

Include primes in math repl.

Include primes in math repl.


{:user {:dependencies [[clj-stacktrace "0.2.4"]]
        :plugins [[lein-tarsier "0.9.4-SNAPSHOT"]
                  [lein-swank "1.4.4"]
                  [lein-difftest "1.3.7"]
                  [lein-clojars "0.9.1"]
                  ;[jark/jark-server "0.4.0"]
                  [lein-pprint "1.1.1"]
                  [slamhound "1.2.0"]
                  [lein-cljsbuild "0.1.9"]
                  [lein-deps-tree "0.1.1"]
                  ;[lein-autodoc "0.9.0"]
                  [lein-marginalia "0.7.1"]]
        :repl-options {:timeout 60000}
        :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                            'print-cause-trace)
                           new (ns-resolve (doto 'clj-stacktrace.repl require)
                                           'pst)]
                       (alter-var-root orig (constantly @new)))]
        :vimclojure-opts {:repl true}}}

{:user {:dependencies [[clj-stacktrace "0.2.4"]]
        :plugins [[lein-tarsier "0.9.4-SNAPSHOT"]
                  [lein-swank "1.4.4"]
                  [lein-difftest "1.3.7"]
                  [lein-clojars "0.9.1"]
                  ;[jark/jark-server "0.4.0"]
                  [lein-pprint "1.1.1"]
                  [slamhound "1.2.0"]
                  [lein-cljsbuild "0.1.9"]
                  [lein-deps-tree "0.1.1"]
                  ;[lein-autodoc "0.9.0"]
                  [lein-marginalia "0.7.1"]]
        :repl-options {:timeout 120000}
        :injections [(let [orig (ns-resolve (doto 'clojure.stacktrace require)
                                            'print-cause-trace)
                           new (ns-resolve (doto 'clj-stacktrace.repl require)
                                           'pst)]
                       (alter-var-root orig (constantly @new)))]
        :vimclojure-opts {:repl true}}}

Increase lein repl timeout to two minutes.


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

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

Change name of generated uberjar to statuses.jar

Makes deployment easier and there is not much information in keeping the
version number and the standalone part.


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject madouc "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [ring/ring-core "1.5.1"]
                 [ring/ring-devel "1.5.1"]
                 [ring-logger "0.7.7"]
                 [ring-logger-timbre "0.7.5"]
                 [com.taoensso/timbre "4.8.0"]
                 [com.fzakaria/slf4j-timbre "0.3.4"]
                 [compojure "1.5.2"]
                 [metosin/compojure-api "1.1.10"]
                 [cprop "0.1.10"]
                 [org.immutant/web "2.1.6"
                  :exclusions [ch.qos.logback/logback-classic]]
                 [selmer "1.10.6"]
                 [mount "0.1.11"]
                 [conman "0.6.3"]
                 [org.postgresql/postgresql "9.4.1212"]]
  :main madouc.core
  :profiles {:dev {:resource-paths ["config/dev"]}
             :prod {:resource-paths ["config/prod"]}
             :uberjar {:aot :all}})

(defproject madouc "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [ring/ring-core "1.5.1"]
                 [ring/ring-devel "1.5.1"]
                 [ring-logger "0.7.7"]
                 [ring-logger-timbre "0.7.5"]
                 [com.taoensso/timbre "4.8.0"]
                 [com.fzakaria/slf4j-timbre "0.3.4"]
                 [compojure "1.5.2"]
                 [metosin/compojure-api "1.1.10"]
                 [cprop "0.1.10"]
                 [org.immutant/web "2.1.6"
                  :exclusions [ch.qos.logback/logback-classic]]
                 [selmer "1.10.6"]
                 [mount "0.1.11"]
                 [hikari-cp "1.7.5"]
                 [com.layerware/hugsql "0.4.7"]
                 [org.postgresql/postgresql "9.4.1212"]]
  :main madouc.core
  :profiles {:dev {:resource-paths ["config/dev"]}
             :prod {:resource-paths ["config/prod"]}
             :uberjar {:aot :all}})

Replace conman by hikari-cp and hugsql

Replace conman by hikari-cp and hugsql


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

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

Add dependendy to http-kit to enable http requests


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

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

Switch back to snapshot version.

Switch back to snapshot version.


(defproject clj-fst "0.1.0"
  :description "Finite State Transducers (FST) for Clojure"
  :url "https://github.com/structureddynamics/clj-fst"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.apache.lucene/lucene-core "4.10.2"]
                 [org.apache.lucene/lucene-misc "4.10.2"]
                 [lein-marginalia "0.8.1-SNAPSHOT"]]
  :source-paths      ["src/clojure"]
  :java-source-paths ["src/java"]
  :target-path "target/%s"
  :marginalia {:exclude ["utils.clj"]})

(defproject clj-fst "0.1.0"
  :description "Finite State Transducers (FST) for Clojure"
  :url "https://github.com/structureddynamics/clj-fst"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.apache.lucene/lucene-core "4.10.2"]
                 [org.apache.lucene/lucene-misc "4.10.2"]
                 [lein-marginalia "0.8.0"]]
  :source-paths      ["src/clojure"]
  :java-source-paths ["src/java"]
  :target-path "target/%s"
  :marginalia {:exclude ["utils.clj"]})

Remove dependency on the marginalia snapshot


(defproject onyx-plugin/lein-template "0.8.1.2"
  :description "A Leiningen 2.0 template for new Onyx plugins"
  :url "http://github.com/MichaelDrogalis/onyx-plugin"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :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-plugin/lein-template "0.8.1.3-SNAPSHOT"
  :description "A Leiningen 2.0 template for new Onyx plugins"
  :url "http://github.com/MichaelDrogalis/onyx-plugin"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :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.


; vi: ft=clojure

(set-env!
  :resource-paths #{"src"}
  :dependencies '[[org.clojure/clojure "1.8.0"]
                  [incanter "1.9.1"]])

(task-options!
    aot {:all true}
    pom {:project 'analyze-data
         :version "0.0.0"}
    jar {:main 'analyze-data.core})

(deftask build []
  (comp (aot) (pom) (uber) (jar) (target)))

; vi: ft=clojure

(set-env!
  :resource-paths #{"src"}
  :dependencies '[[org.clojure/clojure "1.8.0"]
                  [incanter "1.9.0"]])

(task-options!
    aot {:all true}
    pom {:project 'analyze-data
         :version "0.0.0"}
    jar {:main 'analyze-data.core})

(deftask build []
  (comp (aot) (pom) (uber) (jar) (target)))

Downgrade to incanter 1.9.0 because 1.9.1 doesn't appear to be working.


(ns desdemona.query-test
  (:require
   [desdemona.query :as q]
   [clojure.test :refer [deftest is]]))

(deftest query-tests
  (is (= [{:ip "10.0.0.1"}]
         (q/query '(== (:ip entry) "10.0.0.1")
                  [{:ip "10.0.0.1"}]))))

(ns desdemona.query-test
  (:require
   [desdemona.query :as q]
   [clojure.test :refer [deftest is]]))

(deftest query-tests
  (is (= [{:ip "10.0.0.1"}]
         (q/query '(== (:ip x) "10.0.0.1")
                  [{:ip "10.0.0.1"}]))))

Use x as var for now

Use x as var for now

Later, I'll need to walk the tree to find which variables are logic
variables that should be fresh.


(defproject com.gfredericks/goog-integer "0.1.0-SNAPSHOT"
  :description "Temporary fork of goog.math.Integer from the google closure library."
  :url "https://github.com/gfredericks/goog-integer"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]])

(defproject com.gfredericks/goog-integer "0.1.0-SNAPSHOT"
  :description "Temporary fork of goog.math.Integer from the google closure library."
  :url "https://github.com/gfredericks/goog-integer"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]]
  :deploy-repositories [["releases" :clojars]])

Add clojars as deploy repo

Add clojars as deploy repo


(defproject clojurescript-npm "0.2.0-SNAPSHOT"
  :description "The ClojureScript Programming Language, packaged for Node.js"
  :url "https://github.com/nasser/clojurescript-npm"
  :license {:name "Eclipse Public License"
            :url "http://nasser.github.io/clojurescript-npm/blob/master/LICENSE"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [replumb/replumb "0.2.1"]]
  :clean-targets [:target-path "out"]
  :plugins [[lein-cljsbuild "1.1.1"]]
  :cljsbuild {
    :builds [{
        :source-paths ["src"]
        :compiler {
          :main          clojurescript.core
          :output-to     "lib/bootstrap.js"
          :output-dir    "out"
          :optimizations :simple}}]})

(defproject clojurescript-npm "0.2.0-SNAPSHOT"
  :description "The ClojureScript Programming Language, packaged for Node.js"
  :url "https://github.com/nasser/clojurescript-npm"
  :license {:name "Eclipse Public License"
            :url "http://nasser.github.io/clojurescript-npm/blob/master/LICENSE"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.170"]
                 [replumb/replumb "0.2.1"]]
  :clean-targets [:target-path "out"]
  :plugins [[lein-cljsbuild "1.1.1"]]
  :cljsbuild {
    :builds [{
        :source-paths ["src"]
        :compiler {
          :main          clojurescript.core
          :output-to     "lib/bootstrap.js"
          :output-dir    "out"
          :target        :nodejs
          :optimizations :simple}}]})

Set nodejs as the target

Set nodejs as the target


;; For repl.

;; Sample arb doc in edn
;;
;; [{:arb/metadata [{:html-tag :body}]
;;   :arb/value [{:arb/metadata [{:html-tag :h1}]
;;                :arb/value [{:text "Title"}]}
;;               {:arb/metadata [{:html-tag :p}]
;;                :arb/value [{:text "This is a paragraph."}]}]}]

(require '[clojure.core.async :refer [<!!]]
         '[datomic.client :as client])

(def conn
  (<!! (client/connect
        {:db-name "datemo"
         :account-id client/PRO_ACCOUNT
         :secret "datemo"
         :region "none"
         :endpoint "localhost:8998"
         :service "peer-server"
         :access-key "datemo"})))

(def db (client/db conn))

;; For repl.

;; Sample arb doc in edn
;;
;; [{:arb/metadata [{:html-tag :body}]
;;   :arb/value [{:arb/metadata [{:html-tag :h1}]
;;                :arb/value [{:text "Title"}]}
;;               {:arb/metadata [{:html-tag :p}]
;;                :arb/value [{:text "This is a paragraph."}]}]}]

;; for client api
(require '[clojure.core.async :refer [<!!]]
         '[datomic.client :as client])

(def conn
  (<!! (client/connect
        {:db-name "datemo"
         :account-id client/PRO_ACCOUNT
         :secret "datemo"
         :region "none"
         :endpoint "localhost:8998"
         :service "peer-server"
         :access-key "datemo"})))

(def db (client/db conn))

;; for datomic api
(require '[datomic.api :as d])

(def conn (d/connect "datomic:dev://localhost:4334/datemo"))
(def db-now (d/db conn))

Update repl cut and paste code

Update repl cut and paste code


(defproject simple "lein-git-inject/version"

  :dependencies [[org.clojure/clojure       "1.10.1"]
                 [org.clojure/clojurescript "1.10.520"
                  :exclusions [com.google.javascript/closure-compiler-unshaded
                               org.clojure/google-closure-library
                               org.clojure/google-closure-library-third-party]]
                 [thheller/shadow-cljs      "2.8.76"]
                 [reagent                   "0.9.0-rc2"]
                 [re-frame                  "0.11.0-rc2"]]

  :plugins      [[day8/lein-git-inject "0.0.2"]
                 [lein-shadow          "0.1.6"]]

  :middleware   [leiningen.git-inject/middleware]

  :clean-targets ^{:protect false} [:target-path
                                    "shadow-cljs.edn"
                                    "package.json"
                                    "package-lock.json"
                                    "resources/public/js"]

  :shadow-cljs {:nrepl  {:port 8777}

                :builds {:client {:target     :browser
                                  :output-dir "resources/public/js"
                                  :modules    {:client {:init-fn simple.core/run}}
                                  :devtools   {:http-root "resources/public"
                                               :http-port 8280}}}}

  :aliases {"dev-auto" ["shadow" "watch" "client"]})

(defproject simple "lein-git-inject/version"

  :dependencies [[org.clojure/clojure       "1.10.1"]
                 [org.clojure/clojurescript "1.10.520"
                  :exclusions [com.google.javascript/closure-compiler-unshaded
                               org.clojure/google-closure-library
                               org.clojure/google-closure-library-third-party]]
                 [thheller/shadow-cljs      "2.8.76"]
                 [reagent                   "0.9.0-rc2"]
                 [re-frame                  "0.11.0-rc2"]]

  :plugins      [[day8/lein-git-inject "0.0.2"]
                 [lein-shadow          "0.1.7"]]

  :middleware   [leiningen.git-inject/middleware]

  :clean-targets ^{:protect false} [:target-path
                                    "shadow-cljs.edn"
                                    "package.json"
                                    "package-lock.json"
                                    "resources/public/js"]

  :shadow-cljs {:nrepl  {:port 8777}

                :builds {:client {:target     :browser
                                  :output-dir "resources/public/js"
                                  :modules    {:client {:init-fn simple.core/run}}
                                  :devtools   {:http-root "resources/public"
                                               :http-port 8280}}}}

  :aliases {"dev-auto" ["shadow" "watch" "client"]})

Upgrade simple example lein-shadow to 0.1.7


(ns memoria.handlers.app
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.params :refer  [wrap-params]]
            [ring.middleware.json :refer [wrap-json-response wrap-json-body]]
            [taoensso.timbre :as timbre]
            [memoria.db :as db]
            [memoria.handlers.cards :as cards-handler]))

(defn wrap-request-logging [app]
  (fn [request]
    (timbre/info (str "Received request: " request))
    (let [response (app request)]
      (timbre/info (str "Response: " response "\n"))
      response)))

(defn wrap-db-conn [app]
  (fn [request]
    (let [datasource (if (= "test" (get-in request [:headers "memoria-mode"]))
                       (db/test-datasource)
                       (db/datasource))]
      (binding [db/*conn* datasource]
        (app request)))))

(defroutes app-routes
  cards-handler/cards-routes)

(def app
  (-> app-routes
      wrap-params
      wrap-json-body
      wrap-json-response
      wrap-db-conn
      wrap-request-logging))

(ns memoria.handlers.app
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.params :refer  [wrap-params]]
            [ring.middleware.json :refer [wrap-json-response wrap-json-body]]
            [taoensso.timbre :as timbre]
            [memoria.db :as db]
            [memoria.handlers.cards :as cards-handler]))

(defn wrap-request-logging
  "Logs the data received in the request and the data generated in the response. Useful
  for debugging."
  [app]
  (fn [request]
    (timbre/info (str "Received request: " request))
    (let [response (app request)]
      (timbre/info (str "Response: " response "\n"))
      response)))

(defn wrap-db-conn
  "Gets a new connection from the database connection pool and binds that to the
  memoria.db/*conn* dynamic var.

  If the `memoria-mode` header is present in the request and its value is `test`,
  then the test connection pool will be used. Otherwise, the default pool is used."
  [app]
  (fn [request]
    (let [datasource (if (= "test" (get-in request [:headers "memoria-mode"]))
                       (db/test-datasource)
                       (db/datasource))]
      (binding [db/*conn* datasource]
        (app request)))))

(defroutes app-routes
  cards-handler/cards-routes)

(def app
  (-> app-routes
      wrap-params
      wrap-json-body
      wrap-json-response
      wrap-db-conn
      wrap-request-logging))

Add documentation for ring middlewares.

Add documentation for ring middlewares.


;; Copyright (C) 2013 Anders Sundman <anders@4zm.org>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns spira.core.util)

(defn uuid []
  "Create a GUID string."
  (str (java.util.UUID/randomUUID)))

(defn parse-uint [s]
  "a2uint"
  (Integer. (re-find  #"\d+" s )))

(defn find-first [f coll]
  "Get first item in a seq matching a predicate."
  (first (filter f coll)))

;; Copyright (C) 2013 Anders Sundman <anders@4zm.org>
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns spira.core.util)

(defn uuid []
  "Create a GUID string."
  (str (java.util.UUID/randomUUID)))

(defn parse-uint [s]
  "a2uint (nil if not a number)"
  (if (re-find #"^\d+$" s)
    (read-string s)))

(defn find-first [f coll]
  "Get first item in a seq matching a predicate."
  (first (filter f coll)))

Support for parsing large numbers

Support for parsing large numbers


(ns robb1e.web
  (:require [compojure.core :refer [defroutes]]
            [ring.adapter.jetty :as container]
            [compojure.handler :as handler]
            [compojure.route :as route]
            [robb1e.controllers.home :as homeController])
  (:gen-class))

(defroutes routes
  (homeController/routes "postgresql://localhost:5432/robb1e")
  (route/resources "/"))

(def application (handler/site routes))

(defn start [port]
  (container/run-jetty application {:port port :join? false}))

(defn -main []
  (start 8080))

(ns robb1e.web
  (:require [compojure.core :refer [defroutes]]
            [ring.adapter.jetty :as container]
            [compojure.handler :as handler]
            [compojure.route :as route]
            [robb1e.controllers.home :as homeController])
  (:gen-class))

(def port
  (Integer. (or (System/getenv "PORT") "8080")))

(def db
  (or (System/getenv "DATABASE_URL") "postgresql://localhost:5432/robb1e"))

(defroutes routes
  (homeController/routes db)
  (route/resources "/"))

(def application (handler/site routes))

(defn start [port]
  (container/run-jetty application {:port port :join? false}))

(defn -main []
  (start port))

Use environment variables if present

Use environment variables if present


(ns fivethreeonern.sqlite
  (:require [mount.core :refer-macros [defstate]]))

(def node-module (js/require "react-native-sqlite-storage"))

(defstate sqlite
  :start (.openDatabase node-module #js {:name "531.db" :location "default"} #(js/console.log "sql ok") #(js/console.log "sql error")))

(defn execute-sql [tx final-cb [query & other-queries]]
  (.executeSql tx query #js [] (fn [tx results]
                                 (if (empty? other-queries)
                                   (let [results (-> results .-rows .raw js->clj)]
                                     (final-cb results))
                                   (execute-sql tx final-cb other-queries)))))

(defn transaction [query-strings final-cb]
  (.transaction @sqlite
                (fn [tx]
                  (execute-sql tx final-cb query-strings))))

(defn query [query-str cb]
  (transaction [query-str] cb))

(ns fivethreeonern.sqlite
  (:require [mount.core :refer-macros [defstate]]))

(def node-module (js/require "react-native-sqlite-storage"))

(defstate sqlite
  :start (.openDatabase node-module #js {:name "531.db" :location "default"} #(js/console.log "sql ok") #(js/console.log "sql error")))

(defn- execute-sql [tx [query & other-queries] final-cb on-error]
  (.executeSql tx query #js []
               (fn [tx results]
                 (if (empty? other-queries)
                   (let [results (-> results .-rows .raw js->clj)]
                     (final-cb results))
                   (execute-sql tx other-queries final-cb on-error)))
               on-error))

(defn transaction
  ([query-strings final-cb]
   (transaction query-strings final-cb (fn [_])))
  ([query-strings final-cb on-error]
   (.transaction @sqlite
                 (fn [tx]
                   (execute-sql tx query-strings final-cb on-error)))))

(defn query
  ([query-str cb]
   (query query-str cb (fn [_])))
  ([query-str cb on-error]
   (transaction [query-str] cb on-error)))

Add error handling to query functions

Add error handling to query functions


{:name "rnaseq-phase0-b",
 :path "",

 :graph {:strtscratch {:type "func"
                       :name "start-scratch-space"
                       :args ["#1"]}
         :bcstats {:type "func"
                   :name "collect-barcode-stats"}
         :wrtstats {:type "func"
                    :name "write-bcmaps"}
         :setexp {:type "func"
                  :name "set-exp"}
         :split-filter {:type "func"
                        :name "split-filter-fastqs"}
         :coll {:type "func"
                :name "collapser"}
         :mail {:type "func"
                :name "mailit"
                :args ["#2"         ; recipient
                       "Aerobio job status: tnseq phase-0b"
                       "Finished"]} ; subject, body intro

         :edges {:strtscratch [:bcstats]
                 :bcstats  [:wrtstats]
                 :wrtstats [:setexp]
                 :setexp [:split-filter]
                 :split-filter [:coll]
                 :coll [:mail]}}

 :description "Tn-Seq w/o bcl2fastq - start-scratch-space through barcode stats and filter/splitter. Using (prebuilt) fastq files creates scratch space for fastq file processing, copies fastqs to canonical dir in scratch area, collects barcode and NT stats, then writes that to canonical area, sets the experiments db value, splits and filters fastqs by replicates and lastly collapses those fqs."
 }

{:name "tnseq-phase0-b",
 :path "",

 :graph {:strtscratch {:type "func"
                       :name "start-scratch-space"
                       :args ["#1"]} ; EID
         :bcstats {:type "func"
                   :name "collect-barcode-stats"}
         :wrtstats {:type "func"
                    :name "write-bcmaps"}
         :setexp {:type "func"
                  :name "set-exp"}
         :split-filter {:type "func"
                        :name "split-filter-fastqs"}
         :coll {:type "func"
                :name "collapser"}
         :mail {:type "func"
                :name "mailit"
                :args ["#2"         ; recipient
                       "Aerobio job status: tnseq phase-0b"
                       "Finished"]} ; subject, body intro

         :edges {:strtscratch [:bcstats]
                 :bcstats  [:wrtstats]
                 :wrtstats [:setexp]
                 :setexp [:split-filter]
                 :split-filter [:coll]
                 :coll [:mail]}}

 :description "Tn-Seq w/o bcl2fastq - start-scratch-space through barcode stats and filter/splitter. Using (prebuilt) fastq files creates scratch space for fastq file processing, copies fastqs to canonical dir in scratch area, collects barcode and NT stats, then writes that to canonical area, sets the experiments db value, splits and filters fastqs by replicates and lastly collapses those fqs."
 }

Fix bug - wrong name!

Fix bug - wrong name!


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

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

Update dependency org.clojure:clojure to v1.10.2


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

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

Revert back to snapshot version.

Revert back to snapshot version.


(defproject buddy/buddy-sign "0.7.1"
  :description "High level message signing for Clojure"
  :url "https://github.com/funcool/buddy-sign"
  :license {:name "Apache 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0"}
  :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
                 [buddy/buddy-core "0.8.0"]
                 [com.taoensso/nippy "2.10.0"]
                 [funcool/cats "1.0.0"]
                 [clj-time "0.11.0"]
                 [cheshire "5.5.0"]]
  :source-paths ["src"]
  :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
  :test-paths ["test"])

(defproject buddy/buddy-sign "0.7.1"
  :description "High level message signing for Clojure"
  :url "https://github.com/funcool/buddy-sign"
  :license {:name "Apache 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0"}
  :dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
                 [buddy/buddy-core "0.8.1"]
                 [com.taoensso/nippy "2.10.0"]
                 [funcool/cats "1.0.0"]
                 [clj-time "0.11.0"]
                 [cheshire "5.5.0"]]
  :source-paths ["src"]
  :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
  :test-paths ["test"])

Update buddy-core dependency to 0.8.1

Update buddy-core dependency to 0.8.1


(defproject quil/processing-js "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"})

(defproject quil/processing-js "1.4.8"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"})

Set quil/processing-js version same as version of current supported Processing.js.


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

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

Update eastwood from 0.2.0 to 0.2.2

Update eastwood from 0.2.0 to 0.2.2


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

(defroutes app-routes
  (GET "/" []
    (resp/content-type (resp/resource-response "index.html" {:root "public"}) "text/html"))
  (GET "/sound" []
    (resp/response "../resources/a-team_crazy_fool_x.wav"))
  (route/resources "/")
  (route/not-found "Not Found"))

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

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

(defroutes app-routes
  (GET "/" []
    (resp/content-type (resp/resource-response "index.html" {:root "public"}) "text/html"))
  (GET "/sound" []
    (resp/file-response "../resources/a-team_crazy_fool_x.wav"))
  (route/resources "/")
  (route/not-found "Not Found"))

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

Change func to return file response, instead of litteral path


(ns radicalzephyr.boot-junit
  {:boot/export-tasks true}
  (:require [boot.core :as core])
  (:import org.junit.runner.JUnitCore))

(defn failure->map [failure]
  {:description (.. failure (getDescription) (toString))
   :exception (.getException failure)
   :message (.getMessage failure)})

(defn result->map [result]
  {:successful? (.wasSuccessful result)
   :run-time (.getRunTime result)
   :run     (.getRunCount result)
   :ignored (.getIgnoredCount result)
   :failed  (.getFailureCount result)
   :failures (map failure->map (.getFailures result))})

(core/deftask junit
  "Run the jUnit test runner."
  [p packages PACKAGE #{sym} "The set of Java packages to run tests in."]
  (core/with-pre-wrap fileset
    (let [result (JUnitCore/runClasses
                  (into-array Class
                              [#_ (magic goes here to find all test classes)]))]
      (when (> (.getFailureCount result) 0)
        (throw (ex-info "There were some test failures."
                        (result->map result)))))
    fileset))

(ns radicalzephyr.boot-junit
  {:boot/export-tasks true}
  (:require [boot.core :as core])
  (:import org.junit.runner.JUnitCore))

(defn failure->map [failure]
  {:description (.. failure (getDescription) (toString))
   :exception (.getException failure)
   :message (.getMessage failure)})

(defn result->map [result]
  {:successful? (.wasSuccessful result)
   :run-time (.getRunTime result)
   :run     (.getRunCount result)
   :ignored (.getIgnoredCount result)
   :failed  (.getFailureCount result)
   :failures (map failure->map (.getFailures result))})

(core/deftask junit
  "Run the jUnit test runner."
  [p packages PACKAGE #{sym} "The set of Java packages to run tests in."]
  (core/with-pre-wrap fileset
    (if (seq packages)
      (let [result (JUnitCore/runClasses
                    (into-array Class
                                [#_ (magic goes here to find all test classes)]))]
        (when (> (.getFailureCount result) 0)
          (throw (ex-info "There were some test failures."
                          (result->map result)))))
      (println "No packages were tested."))
    fileset))

Make the packages argument mandatory

Make the packages argument mandatory


(ns clojars.test.unit.certs
  (:require [clojure.test :refer :all]))

(def sixty-days (* 86400 1000 60))

(deftest fail-when-gpg-key-is-about-to-expire
  (let [expire-date #inst "2017-09-04T00:00:00.000-00:00"]
    (is (< (System/currentTimeMillis)
          (- (.getTime expire-date) sixty-days))
      (format "Security GPG key expires on %s" expire-date))))

(deftest fail-when-tls-cert-is-about-to-expire
  (let [expire-date #inst "2016-08-12T00:00:00.000-00:00"]
    (is (< (System/currentTimeMillis)
          (- (.getTime expire-date) sixty-days))
      (format "clojars.org TLS cert expires on %s" expire-date))))

(ns clojars.test.unit.certs
  (:require [clojure.test :refer :all]))

(def sixty-days (* 86400 1000 60))

(deftest fail-when-gpg-key-is-about-to-expire
  (let [expire-date #inst "2017-09-04T00:00:00.000-00:00"]
    (is (< (System/currentTimeMillis)
          (- (.getTime expire-date) sixty-days))
      (format "Security GPG key expires on %s" expire-date))))

(deftest fail-when-tls-cert-is-about-to-expire
  (let [expire-date #inst "2018-06-18T00:00:00.000-00:00"]
    (is (< (System/currentTimeMillis)
          (- (.getTime expire-date) sixty-days))
      (format "clojars.org TLS cert expires on %s" expire-date))))

Set cert test to check for new cert expire date


(ns buildviz.main
  (:require [buildviz.build-results :as results]
            [buildviz.handler :as handler]
            [buildviz.http :as http]
            [buildviz.storage :as storage]))

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

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

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

(def app
  (let [builds (storage/load-from-file jobs-filename)
        tests (storage/load-from-file tests-filename)]
    (-> (handler/create-app (results/build-results builds tests)
                            persist-jobs!
                            persist-tests!)
        http/wrap-log-request
        http/wrap-log-errors)))

(ns buildviz.main
  (:require [buildviz.build-results :as results]
            [buildviz.handler :as handler]
            [buildviz.http :as http]
            [buildviz.storage :as storage]
            [clojure.java.io :as io]
            [clojure.string :as str]))

(defn- path-for [file-name]
  (if-let [data-dir (System/getenv "BUILDVIZ_DATA_DIR")]
    (.getPath (io/file data-dir file-name))
    file-name))

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

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

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

(def app
  (let [builds (storage/load-from-file jobs-filename)
        tests (storage/load-from-file tests-filename)]
    (-> (handler/create-app (results/build-results builds tests)
                            persist-jobs!
                            persist-tests!)
        http/wrap-log-request
        http/wrap-log-errors)))

Allow to configure the data directory

Allow to configure the data directory


(ns hu.ssh.github-changelog
  (:require
    [environ.core :refer [env]]
    [tentacles.core :as core]
    [tentacles.repos :as repos]
    [tentacles.pulls :as pulls]
    [clj-semver.core :as semver]))

(defn repo
  "Gets the repository from its name"
  ([name] (repo "pro" name))
  ([org repo] [org repo]))

(defn parse-semver
  "Checks for semantic versions with or without v predicate"
  [tag]
  (let [version (:name tag)
        parse #(try (semver/parse %)
                    (catch java.lang.AssertionError _e nil))]
    (if (= \v (first version))
      (parse (apply str (rest version)))
      (parse version))))

(defn changelog
  "Fetches the changelog"
  [user repo]
  (let [tags (delay (map #(assoc % :version (parse-semver %)) (repos/tags user repo)))
        pulls (delay (pulls/pulls user repo {:state "closed"}))
        commits (delay (repos/commits user repo))]
    (println (first @tags))))

(core/with-defaults {:oauth-token (env :github-token) :all_pages true}
                    (changelog "raszi" "node-tmp"))

(ns hu.ssh.github-changelog
  (:require
    [environ.core :refer [env]]
    [tentacles.core :as core]
    [tentacles.repos :as repos]
    [tentacles.pulls :as pulls]
    [clj-semver.core :as semver]))

(defn repo
  "Gets the repository from its name"
  ([name] (repo "pro" name))
  ([org repo] [org repo]))

(defn parse-semver
  "Checks for semantic versions with or without v predicate"
  [tag]
  (let [version (:name tag)
        parse #(try (semver/parse %)
                    (catch java.lang.AssertionError _e nil))]
    (parse
      (if (= \v (first version))
        (subs version 1)
        version))))

(defn changelog
  "Fetches the changelog"
  [user repo]
  (let [tags (delay (map #(assoc % :version (parse-semver %)) (repos/tags user repo)))
        pulls (delay (pulls/pulls user repo {:state "closed"}))
        commits (delay (repos/commits user repo))]
    (println (first @tags))))

(core/with-defaults {:oauth-token (env :github-token) :all_pages true}
                    (changelog "raszi" "node-tmp"))

Use subs(tring) instead of seq operations and inline if


(ns comic-reader.scrape
  (:require [clojure.string :as s]
            [net.cgrand.enlive-html :as html])
  (:import java.net.URL))

(defn fetch-url [url]
  (html/html-resource (URL. url)))

(defn extract-list [html selector normalize]
  (map normalize (html/select html selector)))

(defn fetch-list [{:keys [url selector normalize]}]
  (when (every? (complement nil?) [url selector normalize])
    (extract-list (fetch-url url) selector normalize)))

(defn enlive->hiccup [{:keys [tag attrs content]}]
  (if (nil? content)
    [tag attrs]
    [tag attrs content]))

(defn clean-image-tag [[tag attrs & content]]
  [tag (select-keys attrs [:alt :src])])

(defn extract-image-tag [html selector]
  (some-> html
          (html/select selector)
          seq
          first
          enlive->hiccup
          clean-image-tag))

(defn fetch-image-tag [{:keys [url selector]}]
  (when (every? (complement nil?) [url selector])
    (-> (fetch-url url)
        (extract-image-tag selector))))

(ns comic-reader.scrape
  (:require [clojure.string :as s]
            [clojure.java.io :as io]
            [net.cgrand.enlive-html :as html])
  (:import java.net.URL))

(defn fetch-url [url]
  (html/html-resource (io/as-url url)))

(defn extract-list [html selector normalize]
  (map normalize (html/select html selector)))

(defn fetch-list [{:keys [url selector normalize]}]
  (when (every? (complement nil?) [url selector normalize])
    (extract-list (fetch-url url) selector normalize)))

(defn enlive->hiccup [{:keys [tag attrs content]}]
  (if (nil? content)
    [tag attrs]
    [tag attrs content]))

(defn clean-image-tag [[tag attrs & content]]
  [tag (select-keys attrs [:alt :src])])

(defn extract-image-tag [html selector]
  (some-> html
          (html/select selector)
          seq
          first
          enlive->hiccup
          clean-image-tag))

(defn fetch-image-tag [{:keys [url selector]}]
  (when (every? (complement nil?) [url selector])
    (-> (fetch-url url)
        (extract-image-tag selector))))

Use io/as-url instead of the URL constructor


(ns user
  (:refer-clojure :exclude [dec < range <= min long int > - time / >= inc + max complement atom])
  (:require
   [tick.alpha.api :refer :all]
   ;;[tick.deprecated.cal :refer [holidays-in-england-and-wales weekend?]]
   [tick.viz :refer [show-canvas view label]]
   ;;[tick.deprecated.schedule :as sch :refer [schedule]]
   [clojure.spec.alpha :as s]
   clojure.test)
  (:import [java.time DayOfWeek]))

(defn test-all []
  (require 'tick.alpha.api-test 'tick.core-test 'tick.interval-test)
  (clojure.test/run-all-tests #"(tick).*test$"))

(ns user
  (:require
   [tick.alpha.api :as t]
   ;;[tick.deprecated.cal :refer [holidays-in-england-and-wales weekend?]]
   [tick.viz :refer [show-canvas view label]]
   ;;[tick.deprecated.schedule :as sch :refer [schedule]]
   [clojure.spec.alpha :as s]
   clojure.test)
  (:import [java.time DayOfWeek]))

(defn test-all []
  (require 'tick.alpha.api-test 'tick.core-test 'tick.interval-test)
  (clojure.test/run-all-tests #"(tick).*test$"))

Fix to warnings on repl

Fix to warnings on repl


(ns devcards.discuss.utils
  (:require [discuss.communication.auth :as auth]
            [sablono.core :as html :refer-macros [html]]))

(def shortcuts
  (html [:div.btn.btn-primary {:onClick #(auth/login "Christian" "iamgroot")} "Login"]))

(ns devcards.discuss.utils
  (:require [discuss.communication.auth :as auth]
            [sablono.core :as html :refer-macros [html]]
            [discuss.utils.common :as lib]))

(def shortcuts
  (html [:div
         [:div.btn.btn-primary {:onClick #(auth/login "Christian" "iamgroot")} "Login"]
         [:div.btn.btn-primary {:onClick #(lib/last-api! "/town-has-to-cut-spending/justify/37/agree?history=/attitude/37")} "Set :api/last-url"]]))

Add more buttons to devcard-shortcuts

Add more buttons to devcard-shortcuts


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject io.nervous/hildebrand "0.2.1"
  :description "High-level, asynchronous AWS client library"
  :url "https://github.com/nervous-systems/hildebrand"
  :License {:name "Unlicense" :url "http://unlicense.org/UNLICENSE"}
  :scm {:name "git" :url "https://github.com/nervous-systems/hildebrand"}
  :deploy-repositories [["clojars" {:creds :gpg}]]
  :signing {:gpg-key "moe@nervous.io"}
  :global-vars {*warn-on-reflection* true}
  :source-paths ["src" "test"]
  :plugins [[codox "0.8.11"]]
  :codox {:include [hildebrand]
          :defaults {:doc/format :markdown}}
  :dependencies
  [[org.clojure/clojure    "1.6.0"]
   [org.clojure/core.async "0.1.346.0-17112a-alpha"]
   [io.nervous/eulalie     "0.1.1-SNAPSHOT"]
   [io.nervous/glossop     "0.1.0-SNAPSHOT"]
   [prismatic/plumbing     "0.4.1"]]
  :exclusions [[org.clojure/clojure]])

(defproject io.nervous/hildebrand "0.2.1"
  :description "High-level, asynchronous AWS client library"
  :url "https://github.com/nervous-systems/hildebrand"
  :license {:name "Unlicense" :url "http://unlicense.org/UNLICENSE"}
  :scm {:name "git" :url "https://github.com/nervous-systems/hildebrand"}
  :deploy-repositories [["clojars" {:creds :gpg}]]
  :signing {:gpg-key "moe@nervous.io"}
  :global-vars {*warn-on-reflection* true}
  :source-paths ["src" "test"]
  :plugins [[codox "0.8.11"]]
  :codox {:include [hildebrand]
          :defaults {:doc/format :markdown}}
  :dependencies
  [[org.clojure/clojure    "1.6.0"]
   [org.clojure/core.async "0.1.346.0-17112a-alpha"]
   [io.nervous/eulalie     "0.1.1"]
   [io.nervous/glossop     "0.1.0"]
   [prismatic/plumbing     "0.4.1"]]
  :exclusions [[org.clojure/clojure]])

Remove snapshots from dependencies, fix :license key


(def scenes [{:subject  "Frankie"
              :action   "say"
              :object   "relax"}

             {:subject  "Lucy"
              :action   "❤s"
              :object   "Clojure"}

             {:subject  "Rich"
              :action   "tries"
              :object   "a new conditioner"}])

(println "People:" (->> scenes
                        (map :subject)
                        (interpose ", ")
                        (reduce str)))

;;=> People: Frankie, Lucy, Rich

;; Let's define some data using list / map
;; literals:

(def scenes [{:subject  "Frankie"
              :action   "say"
              :object   "relax"}

             {:subject  "Lucy"
              :action   "❤s"
              :object   "Clojure"}

             {:subject  "Rich"
              :action   "tries"
              :object   "a new conditioner"}])

;; Who's in our scenes?

(println "People:" (->> scenes
                        (map :subject)
                        (interpose ", ")
                        (reduce str)))

;;=> People: Frankie, Lucy, Rich

Update intro page clojure example

Update intro page clojure example


(ns clj-git.test.core-test
  (:require [clojure.java.io :as io]
            [clojure.test :refer :all])
  (:require [clj-git.core :as git] :reload-all))

(def es-src-dir (-> "clj_git"
                    io/resource
                    io/file
                    .getParent
                    (io/file "elasticsearch-src")
                    .getCanonicalPath))

(defn maybe-prep-repo [dir]
  (if (.exists (io/file dir ".git"))
    (do
      (print "Elasticsearch source already cloned.  Pulling...")
      (flush)
      (git/git-pull (git/load-repo dir)))
    (do
      (print "Elasticsearch source missing.  Cloning...")
      (flush)
      (git/git-clone
       dir
       "https://github.com/elastic/elasticsearch.git")))
  (println "  Done."))

(deftest parse-commit
  (maybe-prep-repo es-src-dir)
  (time
   (testing "the first thousand commits can parse"
     (is (= 1000 (->> es-src-dir
                      git/load-repo
                      git/git-log
                      (take 1000)
                      count))))))

(ns clj-git.test.core-test
  (:require [clojure.java.io :as io]
            [clojure.test :refer :all]
            [environ.core :as environ])
  (:require [clj-git.core :as git] :reload-all))

(defn abspath [path]
  (-> path
      io/file
      .getCanonicalPath))

(def es-src-dir
  (abspath
   (or (environ/env :elasticsearch-src)
       (-> "clj_git"
           io/resource
           io/file
           .getParent
           (io/file "elasticsearch-src")))))

(defn maybe-prep-repo [dir]
  (if (.exists (io/file dir ".git"))
    (do
      (printf "Elasticsearch source already cloned in %s.  Pulling..." dir)
      (flush)
      (git/git-pull (git/load-repo dir)))
    (do
      (printf "Elasticsearch source missing in %s.  Cloning..." dir)
      (flush)
      (git/git-clone
       dir
       "https://github.com/elastic/elasticsearch.git")))
  (println "  Done."))

(deftest parse-commit
  (maybe-prep-repo es-src-dir)
  (time
   (testing "the first thousand commits can parse"
     (is (= 1000 (->> es-src-dir
                      git/load-repo
                      git/git-log
                      (take 1000)
                      count))))))

Make ES src dir configurable

Make ES src dir configurable


(defproject debugging "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://github.com/funcool/catacumba"
  :license {:name "BSD (2-Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :dependencies [[org.clojure/clojure "1.7.0-RC1"]
                 [funcool/catacumba "0.1.0-alpha2"]
                 [prone "0.8.1"]]
  :main ^:skip-aot debugging.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

(defproject debugging "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://github.com/funcool/catacumba"
  :license {:name "BSD (2-Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :dependencies [[org.clojure/clojure "1.7.0-RC1"]
                 [funcool/catacumba "0.2.0"]
                 [prone "0.8.1"]]
  :main ^:skip-aot debugging.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

Update catacumba version on debugging example.


(ns hyphen-keeper.db
  "Persistence for the hyphenation dictionary"
  (:require [yesql.core :refer [defqueries]]))

(def ^:private db "jdbc:mysql://localhost:3306/hyphenation?user=hyphenation&serverTimezone=UTC")

(defqueries "hyphen_keeper/queries.sql" {:connection db})

(defn read-words
  "Return a coll of words for given `spelling`"
  [spelling]
  (-> {:spelling spelling} words))

(defn read-words-paginated
  "Return a coll of words for given `spelling` using `max-rows` and `offset` for pagination"
  [spelling offset max-rows]
  (-> {:spelling spelling :max_rows max-rows :offset offset}
      words-paginated))

(defn search-words
  "Return a coll of words for given `spelling` and given `search` term"
  [spelling search]
  (-> {:spelling spelling :search search}
      words-search))

(defn save-word!
  "Persist `word` with given `hyphenation` and `spelling`"
  [word hyphenation spelling]
  (-> {:word word :hyphenation hyphenation :spelling spelling}
      save-word-internal!))

(defn remove-word! [word spelling]
  (-> {:word word :spelling spelling}
      remove-word-internal!))

(ns hyphen-keeper.db
  "Persistence for the hyphenation dictionary"
  (:require [yesql.core :refer [defqueries]]))

(def ^:private db {:name "java:jboss/datasources/old-productions"})

(defqueries "hyphen_keeper/queries.sql" {:connection db})

(defn read-words
  "Return a coll of words for given `spelling`"
  [spelling]
  (-> {:spelling spelling} words))

(defn read-words-paginated
  "Return a coll of words for given `spelling` using `max-rows` and `offset` for pagination"
  [spelling offset max-rows]
  (-> {:spelling spelling :max_rows max-rows :offset offset}
      words-paginated))

(defn search-words
  "Return a coll of words for given `spelling` and given `search` term"
  [spelling search]
  (-> {:spelling spelling :search search}
      words-search))

(defn save-word!
  "Persist `word` with given `hyphenation` and `spelling`"
  [word hyphenation spelling]
  (-> {:word word :hyphenation hyphenation :spelling spelling}
      save-word-internal!))

(defn remove-word! [word spelling]
  (-> {:word word :spelling spelling}
      remove-word-internal!))

Use JNDI to find the data source

Use JNDI to find the data source


(ns madouc.db
  (:require [mount.core :refer [defstate]]
            [conman.core :as conman]
            [madouc.config :refer [env]]))

(defn- make-pool-spec
  [host db user pass]
  {:jdbc-url (format "jdbc:postgresql://%s/%s" host db)
   :username user
   :password pass})

(defstate con
  :start (conman/connect! (make-pool-spec
                           (env :db-host)
                           (env :db-name)
                           (env :db-user)
                           (env :db-password)))
  :stop (conman/disconnect! con))

(conman/bind-connection con "sql/queries.sql")

Add queries to database layer

Add queries to database layer


(ns themis.extended-protos
  (:require [themis.protocols :as protocols]))

(extend-protocol protocols/Navigable

  clojure.lang.PersistentVector
  (-navigate [t coordinate-vec]
    (get-in t coordinate-vec))

 clojure.lang.IPersistentMap
 (-navigate [t coordinate-vec]
   (get-in t coordinate-vec)))

(ns themis.extended-protos
  (:require [themis.protocols :as protocols]))

(extend-protocol protocols/Navigable

  clojure.lang.PersistentVector
  (-navigate [t coordinate-vec]
    (get-in t coordinate-vec))

 clojure.lang.IPersistentMap
 (-navigate [t coordinate-vec]
   (get-in t coordinate-vec))

  java.lang.String
  (-navigate [t coordinate-vec]
    (get-in t coordinate-vec)))

Allow navigating strings as a base data structure


(ns ^{:doc "Functions dealing with making various forms of
            Midje output be ergonomically colorful."}
  midje.emission.colorize
  (:require [colorize.core :as color]
            [clojure.string :as str]
            [midje.config :as config])
  (:use [midje.util.ecosystem :only [getenv on-windows?]]))

(defn colorize-setting []
  (config/choice :colorize))

(defn- colorize-config-as-str []
  (let [setting-as-str (str (colorize-setting))]
    (when-not (str/blank? setting-as-str) setting-as-str)))

(defn- colorize-choice []
  (str/upper-case (or (getenv "MIDJE_COLORIZE")
                      (colorize-config-as-str)
                      (str (not (on-windows?))))))

(defn init! []
  (case (colorize-choice)
    "TRUE" (do
             (def fail color/red)
             (def pass color/green)
             (def note color/cyan))

    ("REVERSE" ":REVERSE") (do
                (def fail color/red-bg)
                (def pass color/green-bg)
                (def note color/cyan-bg))

    (do
      (def fail str)
      (def pass str)
      (def note str))))

(ns ^{:doc "Functions dealing with making various forms of
            Midje output be ergonomically colorful."}
  midje.emission.colorize
  (:require [colorize.core :as color]
            [clojure.string :as str]
            [midje.config :as config])
  (:use [midje.util.ecosystem :only [getenv on-windows?]]))

(defn colorize-setting []
  (config/choice :colorize))

(defn- colorize-config-as-str []
  (let [setting (colorize-setting)
        setting (if (keyword? setting) (name setting) setting)
        setting-as-str (str setting)]
    (when-not (str/blank? setting-as-str) setting-as-str)))

(defn- colorize-choice []
  (str/upper-case (or (getenv "MIDJE_COLORIZE")
                      (colorize-config-as-str)
                      (str (not (on-windows?))))))

(defn init! []
  (case (colorize-choice)
    "TRUE" (do
             (def fail color/red)
             (def pass color/green)
             (def note color/cyan))

    "REVERSE" (do
                (def fail color/red-bg)
                (def pass color/green-bg)
                (def note color/cyan-bg))

    (do
      (def fail str)
      (def pass str)
      (def note str))))

Convert keyword to a string name

Refactor: Convert keyword to a string name


(ns devsetup
  (:require [demo :as site]
            [runtests]
            [reagent.core :as r]
            [figwheel.client :as fw]))

(defn test-results []
  [runtests/test-output-mini])

(defn start! []
  (demo/start! {:test-results test-results})
  (runtests/run-tests))

(when r/is-client
  (fw/start
   {:websocket-url "ws://localhost:3449/figwheel-ws"
    :jsload-callback #(start!)
    :heads-up-display true
    :load-warninged-code false}))

(start!)

(ns ^:figwheel-always devsetup
    (:require [demo :as site]
              [runtests]
              [reagent.core :as r]
              [figwheel.client :as fw]))

(when r/is-client
  (fw/start
   {:websocket-url "ws://localhost:3449/figwheel-ws"}))

(defn test-results []
  [runtests/test-output-mini])

(defn start! []
  (demo/start! {:test-results test-results})
  (runtests/run-tests))

(start!)

Make tests only run once when figwheel reloads


;; https://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.md
{:provided
 {:dependencies
  [[djblue/portal "0.21.2"]]}
 :user
 {:plugins
  [[cider/cider-nrepl "0.27.4"]
   [lein-ancient "1.0.0-RC3"]
   [lein-check-namespace-decls "1.0.4"]
   [lein-cljfmt "0.8.0"]
   [lein-nsorg "0.3.0"]
   [nrepl "0.9.0"]
   [refactor-nrepl "3.1.0"]]}
  :dependencies
   [#_[alembic "0.3.2"]
    [antq "RELEASE"]
    [clj-kondo "RELEASE"]]
  :aliases {"clj-kondo" ["run" "-m" "clj-kondo.main"]
            "outdated"  ["run" "-m" "antq.core"]}}

;; https://github.com/technomancy/leiningen/blob/stable/doc/PROFILES.md
{:provided
 {:dependencies
  [[djblue/portal "0.21.2"]
   [fipp "0.6.24"]]}
 :user
 {:plugins
  [[cider/cider-nrepl "0.27.4"]
   [lein-ancient "1.0.0-RC3"]
   [lein-check-namespace-decls "1.0.4"]
   [lein-cljfmt "0.8.0"]
   [lein-nsorg "0.3.0"]
   [nrepl "0.9.0"]
   [refactor-nrepl "3.1.0"]]}
  :dependencies
   [#_[alembic "0.3.2"]
    [antq "RELEASE"]
    [clj-kondo "RELEASE"]]
  :aliases {"clj-kondo" ["run" "-m" "clj-kondo.main"]
            "outdated"  ["run" "-m" "antq.core"]}}

Move portal to :provided section

Move portal to :provided section


(ns quil.helpers.applet-listener
  (:gen-class
    :name quil.helpers.AppletListener
    :main false
    :init init
    :state listeners
    :constructors {[java.util.Map] []}
    :methods [["dispose" [] java.lang.Void]]))

(defn safe-call [fn]
  (when fn (fn)))

(defn -init [listeners]
  [[] listeners])

(defn -dispose [this]
  (safe-call (:on-dispose (.listeners this))))

(ns quil.helpers.applet-listener
  (:gen-class
    :name quil.helpers.AppletListener
    :main false
    :init init
    :state listeners
    :constructors {[java.util.Map] []}
    :methods [["dispose" [] java.lang.Object]]))

(defn safe-call [fn]
  (when fn (fn)))

(defn -init [listeners]
  [[] listeners])

(defn -dispose [this]
  (safe-call (:on-dispose (.listeners this))))

Fix on-close handler so it can return any type, not only nil.


; vi: ft=clojure

(set-env!
  :resource-paths #{"src"}
  :dependencies '[[org.clojure/clojure "1.8.0"]
                  [incanter "1.9.0"]])

(task-options!
    aot {:all true}
    pom {:project 'analyze-data
         :version "0.0.0"}
    jar {:main 'analyze-data.core})

(deftask build []
  (comp (aot) (pom) (uber) (jar) (target)))

; vi: ft=clojure

(set-env!
  :resource-paths #{"src", "test"}
  :dependencies '[[org.clojure/clojure "1.8.0"]
                  [org.clojure/data.csv "0.1.3"]
                  [incanter "1.9.0"]
                  [adzerk/boot-test "1.2.0" :scope "test"]])

(require '[adzerk.boot-test :refer [test]])

(task-options!
    aot {:all true}
    pom {:project 'analyze-data
         :version "0.0.0"}
    jar {:main 'analyze-data.core})

(deftask build []
  (comp (aot) (pom) (uber) (jar) (target)))

Add data.csv, boot-test, and set up for testing.