(ns sicp.chapter3.5-1)

;;;; 3.5  Streams

;;; 3.5.1  Streams Are Delayed Lists

;; Exercise 3.50
(defn stream-map [proc & argstreams]
  (lazy-seq
   (if (empty? (first argstreams))
     nil
     (cons
      (apply proc (map first argstreams))
      (apply stream-map
             (cons proc (map rest argstreams)))))))

;; Exercise 3.51
(defn show [x]
  (println x)
  x)

(def x (map show (range 0 (inc 10))))
#_(nth x 5)
#_(nth x 7)

;; Exercise 3.52
(defn display-stream [s]
  (run! println s))

(def sum (atom 0))
#_@sum
(defn accum [x]
  (swap! sum + x))
#_@sum
(def seq' (map accum (range 1 (inc 20))))
#_@sum
(def y (filter even? seq'))
#_@sum
(def z (filter #(zero? (rem % 5)) seq'))
#_@sum
#_(nth y 7)
#_@sum
#_(display-stream z)
#_@sum

(ns sicp.chapter3.5-1)

;;;; 3.5  Streams

;;; 3.5.1  Streams Are Delayed Lists

;; Exercise 3.50
(defn stream-map [proc & argstreams]
  (lazy-seq
   (if (empty? (first argstreams))
     nil
     (cons
      (apply proc (map first argstreams))
      (apply stream-map
             (cons proc (map rest argstreams)))))))

(defn stream-map' [proc & argstreams]
  (lazy-seq
   (when (seq (first argstreams))
     (cons (apply proc (map first argstreams))
           (apply stream-map' proc (map rest argstreams))))))

;; Exercise 3.51
(defn show [x]
  (println x)
  x)

(def x (map show (range 0 (inc 10))))
#_(nth x 5)
#_(nth x 7)

;; Exercise 3.52
(defn display-stream [s]
  (run! println s))

(def sum (atom 0))
#_@sum
(defn accum [x]
  (swap! sum + x))
#_@sum
(def seq' (map accum (range 1 (inc 20))))
#_@sum
(def y (filter even? seq'))
#_@sum
(def z (filter #(zero? (rem % 5)) seq'))
#_@sum
#_(nth y 7)
#_@sum
#_(display-stream z)
#_@sum

Add another implementation to Exercise 3.50


(ns less4clj.webjars
  (:import [java.io File]
           [org.webjars WebJarAssetLocator]))

(def ^:private webjars-pattern
  #"META-INF/resources/webjars/([^/]+)/([^/]+)/(.*)")

(defn- asset-path [resource]
  (let [[_ name version path] (re-matches webjars-pattern resource)]
    (str name File/separator path)))

(defn asset-map
  "Create map of asset path to classpath resource url. Asset path is
  the resource url without webjars part."
  []
  (->> (.listAssets (WebJarAssetLocator.) "")
       (map (juxt asset-path identity))
       (into {})))

(comment
  (time (asset-map)))

(ns less4clj.webjars
  (:import [java.io File]
           [org.webjars WebJarAssetLocator]))

(def ^:private webjars-pattern
  #"META-INF/resources/webjars/([^/]+)/([^/]+)/(.*)")

(defn- asset-path [resource]
  (let [[_ name version path] (re-matches webjars-pattern resource)]
    (str name File/separator path)))

(defn asset-map
  "Create map of asset path to classpath resource url. Asset path is
  the resource url without webjars part."
  []
  (->> (vals (.getFullPathIndex (WebJarAssetLocator.)))
       (map (juxt asset-path identity))
       (into {})))

(comment
  (time (asset-map)))

Use getFullPathIndex to list wejars assets

listAssets calls getFullPathIndex and filters the values. Calling
getFullPathIndex directly avoids filtering.


(ns whitman.core
  (:require [whitman.config :as config]
            [whitman.crawler :as crawler]
            [whitman.db :as db]
            [whitman.writer :as writer])
  (:gen-class))

(defn exit [code msg]
  (binding [*out* *err*]
    (do (println msg)
        (System/exit code))))

(defn do-crawl [cfg writer]
  (let [users (crawler/records cfg)
        docs (map #(crawler/sample-docs cfg %) users)]
    (doseq [d docs] (writer/write writer cfg (:query d) (:insert d)))))

(defn -main [& args]
  (if (< (count args) 1)
    (exit 1 "No configuration file specified")
    (do-crawl (config/read-config (last args)) :db)))

(ns whitman.core
  (:require [whitman.config :as config]
            [whitman.crawler :as crawler]
            [whitman.db :as db]
            [whitman.writer :as writer])
  (:gen-class))

(defn exit [code msg]
  (binding [*out* *err*]
    (do (println msg)
        (System/exit code))))

(defn do-crawl [cfg writer]
  (let [users (crawler/records cfg)
        docs (map #(crawler/sample-docs cfg %) users)]
    (doseq [d docs] (writer/write writer cfg (:query d) (:insert d)))))

(defn writer [args]
  :db)

(defn -main [& args]
  (if (< (count args) 1)
    (exit 1 "No configuration file specified")
    (do-crawl (config/read-config (last args)) (writer args))))

Read writer type from arguments

Read writer type from arguments


(defproject uxbox-backend "0.1.0-SNAPSHOT"
  :description "UXBox backend + api"
  :url "http://uxbox.github.io"
  :license {:name "" :url ""}
  :source-paths ["src"]
  :javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
  :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
  :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
                 [org.slf4j/slf4j-simple "1.7.16"]
                 [bouncer "1.0.0"]
                 [mount "0.1.9"]
                 [environ "1.0.2"]
                 [com.github.spullara.mustache.java/compiler "0.9.1"]
                 [niwinz/migrante "0.1.0-SNAPSHOT"]
                 [funcool/suricatta "0.8.1"]
                 [funcool/promesa "0.8.1"]
                 [hikari-cp "1.5.0"]
                 [funcool/catacumba "0.11.2-SNAPSHOT"]]
  :main ^:skip-aot uxbox.main
  :plugins [[lein-ancient "0.6.7"]])

(defproject uxbox-backend "0.1.0-SNAPSHOT"
  :description "UXBox backend."
  :url "http://uxbox.github.io"
  :license {:name "" :url ""}
  :source-paths ["src"]
  :javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
  :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
  :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
                 [org.slf4j/slf4j-simple "1.7.16"]
                 [bouncer "1.0.0"]
                 [mount "0.1.9"]
                 [environ "1.0.2"]
                 [buddy/buddy-sign "0.9.0"]
                 [buddy/buddy-hashers "0.11.0"]
                 [com.github.spullara.mustache.java/compiler "0.9.1"]
                 [niwinz/migrante "0.1.0-SNAPSHOT"]
                 [funcool/suricatta "0.8.1"]
                 [funcool/promesa "0.8.1"]
                 [hikari-cp "1.5.0"]
                 [funcool/catacumba "0.11.2-SNAPSHOT"]]
  :main ^:skip-aot uxbox.main
  :plugins [[lein-ancient "0.6.7"]])

Add buddy-sign and buddy-hashers dependencies.


(ns silly-image-store.store
  (:require [clojure.java.io :as io]))

(def exists? #(and % (.exists %)))
(def file? #(.isFile %))
(def filename #(.getName %))

(defn load-image [& paths]
  (let [file (apply io/file paths)]
    (if (exists? file) file)))

(defn list-images [& paths]
  (let [image-directory (apply load-image paths)]
    (if (exists? image-directory)
      (->> image-directory
       .listFiles
       (filter file?)
       (map filename)))))

(defn list-image-dirs [& paths]
  (let [image-directory (apply load-image paths)]
    (if (exists? image-directory)
      (->> image-directory
       .listFiles
       (filter (complement file?))
       (map filename)))))

(defn random-image [basedir]
  (let [random-image-name (rand-nth (list-images basedir))]
    (load-image basedir random-image-name)))

(ns silly-image-store.store
  (:require [clojure.java.io :as io]))

(def exists? #(and % (.exists %)))
(def file? #(.isFile %))
(def filename #(.getName %))

(defn load-image [& paths]
  (let [file (apply io/file paths)]
    (if (exists? file) file)))

(defn- filtered-file-names [filter-fn paths]
  (let [image-directory (apply load-image paths)]
    (if (exists? image-directory)
      (->> image-directory
       .listFiles
       (filter filter-fn)
       (map filename)))))

(defn list-images [& paths]
  (filtered-file-names file? paths))

(defn list-image-dirs [& paths]
  (filtered-file-names (complement file?) paths))

(defn random-image [basedir]
  (let [random-image-name (rand-nth (list-images basedir))]
    (load-image basedir random-image-name)))

Remove duplication of listing files

Remove duplication of listing files


(ns quotes.routes
  (:gen-class)
  (:use [quotes.api :only [api-routes]])
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [common-utils.core :as utils]
            [common-utils.middleware :refer [correlation-id-middleware]]
            [clojure.tools.logging :as log]
            [ring.adapter.jetty :as jetty]))

(defroutes app-routes
  (context "/api" []
           (api-routes)))

(def app
  (-> app-routes
      correlation-id-middleware))

(defn -main []
  (let [port (Integer/parseInt (utils/config "APP_PORT" 8080))]
    (log/info "Running quotes on port" port)
    (future (jetty/run-jetty (var app) {:host "0.0.0.0"
                                        :port port}))))

(ns quotes.routes
  (:gen-class)
  (:use [quotes.api :only [api-routes]])
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [common-utils.core :as utils]
            [common-utils.middleware :refer [correlation-id-middleware]]
            [clojure.tools.logging :as log]
            [ring.adapter.jetty :as jetty]))

(defroutes app-routes
  (context "/api" []
           (api-routes)))

(def app
  (-> app-routes
      correlation-id-middleware))

(defn -main []
  (let [port (Integer/parseInt (utils/config "APP_PORT" "8080"))]
    (log/info "Running quotes on port" port)
    (future (jetty/run-jetty (var app) {:host "0.0.0.0"
                                        :port port}))))

Make default port work in quotes app

Make default port work in quotes app


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

(deftest transcribes-guanine-to-cytosine
  (is (= "G" (rna-transcription/to-rna "C"))))

(deftest transcribes-cytosine-to-guanine
  (is (= "C" (rna-transcription/to-rna "G"))))

(deftest transcribes-uracil-to-adenine
  (is (= "U" (rna-transcription/to-rna "A"))))

(deftest it-transcribes-thymine-to-uracil
  (is (= "A" (rna-transcription/to-rna "T"))))

(deftest it-transcribes-all-nucleotides
  (is (= "UGCACCAGAAUU" (rna-transcription/to-rna "ACGTGGTCTTAA"))))

(deftest it-validates-dna-strands
  (is (thrown? AssertionError (rna-transcription/to-rna "XCGFGGTDTTAA"))))

(run-tests)

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

(deftest transcribes-cytosine-to-guanine
  (is (= "G" (rna-transcription/to-rna "C"))))

(deftest transcribes-guanine-to-cytosine
  (is (= "C" (rna-transcription/to-rna "G"))))

(deftest transcribes-adenine-to-uracil
  (is (= "U" (rna-transcription/to-rna "A"))))

(deftest it-transcribes-thymine-to-adenine
  (is (= "A" (rna-transcription/to-rna "T"))))

(deftest it-transcribes-all-nucleotides
  (is (= "UGCACCAGAAUU" (rna-transcription/to-rna "ACGTGGTCTTAA"))))

(deftest it-validates-dna-strands
  (is (thrown? AssertionError (rna-transcription/to-rna "XCGFGGTDTTAA"))))

(run-tests)

Make test names match assertions

Make test names match assertions

First it looked like each test name was backwards. Giving the function "C" and transcribing to "G" was named `transcribes-guanine-to-cytosine` rather than `transcribes-cytosine-to-guanine`.

Second, the assertion for "T" -> "A" appeared to be in the right order but it mentioned the wrong nucleotide.


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

(def trailing-slash (middleware/wrap-ignore-trailing-slash (fn [x] (get x :uri))))

(deftest trailing-slash-doesnt-modify-root
  (is (= "/" (trailing-slash {:uri "/"}))))

(deftest trailing-slash-doesnt-modify-sub-routes
  (is (= "/artifact/project") (trailing-slash {:uri "/artifact/project"})))

(deftest trailing-slash-removes-trailing-slash
  (is (= "/artifact/project") (trailing-slash {:uri "/artifact/project/"})))

(deftest trailing-slash-doesnt-remove-redundant-trailing-slash
  (is (= "/artifact/project/") (trailing-slash {:uri "/artifact/project//"})))

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

(def trailing-slash (middleware/wrap-ignore-trailing-slash (fn [x] (get x :uri))))

(deftest trailing-slash-doesnt-modify-root
  (is (= "/" (trailing-slash {:uri "/"}))))

(deftest trailing-slash-doesnt-modify-sub-routes
  (is (= "/artifact/project" (trailing-slash {:uri "/artifact/project"}))))

(deftest trailing-slash-removes-trailing-slash
  (is (= "/artifact/project" (trailing-slash {:uri "/artifact/project/"}))))

(deftest trailing-slash-doesnt-remove-redundant-trailing-slash
  (is (= "/artifact/project/" (trailing-slash {:uri "/artifact/project//"}))))

Fix these tests to actually test

Fix these tests to actually test


(ns {{name}}.core
    (:require-macros [rum.core :refer [defc]])
    (:require [re-natal.support :as support]
              [rum.core :as rum]
              [cljs-exponent.components :refer [text view image touchable-highlight] :as rn]))

(def logo-img (js/require "./assets/images/cljs.png"))

(defn alert [title]
  (.alert rn/alert title))

(defonce app-state (atom {:greeting "Hello Clojure in iOS and Android!"}))

(defc AppRoot < rum/reactive [state]
  (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
        (text {:style {:fontSize 30 :fontWeight "100" :marginBottom 20 :textAlign "center"}} (:greeting @state))
        (image {:source logo-img
                :style  {:width 80 :height 80 :marginBottom 30}})
        (touchable-highlight {:style   {:backgroundColor "#999" :padding 10 :borderRadius 5}
                              :onPress #(alert "HELLO!")}
                             (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))

(defonce root-component-factory (support/make-root-component-factory))

(defn mount-app [] (support/mount (AppRoot app-state)))

(defn init []
  (mount-app)
  (.registerComponent rn/app-registry "main" (fn [] root-component-factory)))

(ns {{name}}.core
    (:require-macros [rum.core :refer [defc]])
    (:require [re-natal.support :as support]
              [rum.core :as rum]
              [cljs-exponent.components :refer [text view image touchable-highlight] :as rn]))

(def logo-img (js/require "./assets/images/cljs.png"))

(defn alert [title]
  (.alert rn/alert title))

(defonce app-state (atom {:greeting "Hello Clojure in iOS and Android!"}))

(defc AppRoot < rum/reactive [state]
  (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
        (text {:style {:fontSize 30 :fontWeight "100" :marginBottom 20 :textAlign "center"}} (:greeting (rum/react state)))
        (image {:source logo-img
                :style  {:width 80 :height 80 :marginBottom 30}})
        (touchable-highlight {:style   {:backgroundColor "#999" :padding 10 :borderRadius 5}
                              :onPress #(alert "HELLO!")}
                             (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))

(defonce root-component-factory (support/make-root-component-factory))

(defn mount-app [] (support/mount (AppRoot app-state)))

(defn init []
  (mount-app)
  (.registerComponent rn/app-registry "main" (fn [] root-component-factory)))

Use rum/react to access atom

Use rum/react to access atom

This wasn't working for me, the view wasn't updating when the atom changed, until I derefed the atom using `rum/react`. I believe this is the way to do [Reactive Components](https://github.com/tonsky/rum#reactive-components) in Rum?


(ns uxbox.shapes
  (:require [sablono.core :refer-macros [html]]))

(defmulti render
  (fn [shape & params]
    (:type shape)))

(defmethod render :builtin/icon
  [shape & [{:keys [width height] :or {width "500" height "500"}}]]
  (let [content (:svg shape)]
    (html
     [:svg {:width width :height height} content])))

(ns uxbox.shapes
  (:require [sablono.core :refer-macros [html]]))

(defmulti render
  (fn [shape & params]
    (:type shape)))

(defmethod render :builtin/icon
  [{:keys [data width height view-box]} & [attrs]]
  (let [attrs (merge
               (when width {:width width})
               (when height {:height height})
               (when view-box {:viewBox (apply str (interpose " " view-box))})
               attrs)]

    (html
     [:svg attrs data])))

Improve render function for builtin icons.


(defproject processing-core/processing.core "0.1.0-SNAPSHOT"
  :description "A wrapper for Processing in Clojure."
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojars.processing-core/org.processing.core "1.5.1"]
                 [org.clojars.processing-core/org.processing.gluegen-rt "1.5.1"]
                 [org.clojars.processing-core/org.processing.jogl "1.5.1"]
                 [org.clojars.processing-core/org.processing.opengl "1.5.1"]])

(defproject processing-core/processing.core "1.0.0-SNAPSHOT"
  :description "A wrapper for Processing in Clojure."
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojars.processing-core/org.processing.core "1.5.1"]
                 [org.clojars.processing-core/org.processing.gluegen-rt "1.5.1"]
                 [org.clojars.processing-core/org.processing.jogl "1.5.1"]
                 [org.clojars.processing-core/org.processing.opengl "1.5.1"]
                 [org.clojars.processing-core/org.processing.itext "1.5.1"]
                 [org.clojars.processing-core/org.processing.pdf "1.5.1"]])

Add deps required for PDF support

Add deps required for PDF support


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

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

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


(ns faceboard.css.tabs
  (:use [faceboard.lib.constants])
  (:require [faceboard.lib.helpers :refer [>> mv px]]
            [garden.color :as color]))

(def styles
  [(>> tab-area
     (>> [> *]
       [:display :inline-block])
     (>> tab
       [:padding (px 0 4)
        :font-weight :bold
        :margin (px 2)
        :margin-left (px 8)
        :margin-bottom (px 0)
        :min-width (px 60)
        :cursor :pointer
        :position :relative
        :border-top-right-radius (px 2)
        :border-top-left-radius (px 2)
        :top (px 1)
        :text-align :center
        :background (color/darken signature-color 10)
        :color "#fff"]
       (>> &.selected
         [:color "#000"
          :background selected-tab-color
          :border-bottom (str "1px solid " selected-tab-color)])))
   (>> tab-contents
     [:position :relative
      :z-index 0
      :height "100%"]
     (>> tab-view
       [:height "100%"]
       (>> [> *]
         [:height "100%"])
       (>> &.dual-mode
         (>> [> *]
           [:width "50%"
            :display :inline-block])
         (>> left-side
           [:float :left])
         (>> right-side
           [:float :right]))))])

(ns faceboard.css.tabs
  (:use [faceboard.lib.constants])
  (:require [faceboard.lib.helpers :refer [>> mv px]]
            [garden.color :as color]))

(def styles
  [(>> tab-area
     (>> [> *]
       [:display :inline-block])
     (>> tab
       [:padding (px 0 4)
        :font-weight :bold
        :margin (px 2)
        :margin-left (px 8)
        :margin-bottom (px 0)
        :min-width (px 60)
        :cursor :pointer
        :position :relative
        :border-top-right-radius (px 2)
        :border-top-left-radius (px 2)
        :top (px 1)
        :text-align :center
        :background (color/darken signature-color 10)
        :color "#fff"]
       (>> &.selected
         [:color "#000"
          :background selected-tab-color])))
   (>> tab-contents
     [:position :relative
      :z-index 0
      :height "100%"]
     (>> tab-view
       [:height "100%"]
       (>> [> *]
         [:height "100%"])
       (>> &.dual-mode
         (>> [> *]
           [:width "50%"
            :display :inline-block])
         (>> left-side
           [:float :left])
         (>> right-side
           [:float :right]))))])

Remove border on selected tab

Remove border on selected tab


;; This is the default test configuration file.  If you would like to override
;; some of the settings herein, simply make a copy of this file and name it
;; `local.clj`.  It will be loaded instead of this one.  (`local.clj` is
;; included in the `.gitignore` file, so you don't have to worry about
;; accidentally committing your local changes.)

(defn test-db-config
  "Return a map of connection attrs for the test database"
  []
  {:classname   "org.hsqldb.jdbcDriver"
   :subprotocol "hsqldb"
   :subname     (str "mem:"
                  (java.util.UUID/randomUUID)
                  ";shutdown=true;hsqldb.tx=mvcc;sql.syntax_pgs=true")})

;; here is a sample test-db-config function for use with postgres
;(defn test-db-config
;  "Return a map of connection attrs for the test database"
;  []
;  {:classname   "org.postgresql.Driver"
;   :subprotocol "postgresql"
;   :subname     "//localhost:5432/puppetdb_test"
;   :user        "puppetdb"
;   :password    "puppet"
;   })

;; This is the default test configuration file.  If you would like to override
;; some of the settings herein, simply make a copy of this file and name it
;; `local.clj`.  It will be loaded instead of this one.  (`local.clj` is
;; included in the `.gitignore` file, so you don't have to worry about
;; accidentally committing your local changes.)

(defn test-db-config
  "Return a map of connection attrs for the test database"
  []
  (let [dbtype     (System/getenv "PUPPETDB_DBTYPE")
        dbsubname  (System/getenv "PUPPETDB_DBSUBNAME")
        dbuser     (System/getenv "PUPPETDB_DBUSER")
        dbpassword (System/getenv "PUPPETDB_DBPASSWORD")]
    (if (= dbtype "postgres")
      (if (some nil? [dbsubname dbuser dbpassword])
        (do
          (println "Ensure environment variables PUPPETDB_DBSUBNAME, PUPPETDB_DBUSER and PUPPETDB_DBPASSWORD are set")
          (System/exit 1))
        {:classname   "org.postgresql.Driver"
         :subprotocol "postgresql"
         :subname     dbsubname
         :user        dbuser
         :password    dbpassword})
      {:classname   "org.hsqldb.jdbcDriver"
       :subprotocol "hsqldb"
       :subname     (str "mem:"
                      (java.util.UUID/randomUUID)
                      ";shutdown=true;hsqldb.tx=mvcc;sql.syntax_pgs=true")})))

;; here is a sample test-db-config function for use with postgres
;(defn test-db-config
;  "Return a map of connection attrs for the test database"
;  []
;  {:classname   "org.postgresql.Driver"
;   :subprotocol "postgresql"
;   :subname     "//localhost:5432/puppetdb_test"
;   :user        "puppetdb"
;   :password    "puppet"
;   })

Define postgres settings using environment vars

In the past we were copying a magic from from tb-driver: local.clj that
contained all the information needed to connect to our test Postgres
database. tb-driver is being decommissioned, and its felt we need a better
way to manage this going forward.

This patch allows us to parameterize database tests, in particular the postgres
specific settings using environment variables. This way we can pass the
settings in from Jenkins using its special 'passwords as environment vars'
feature.

The default HSQLDB behaviour is kept if DBTEST_TYPE is not set, and local.clj
support is kept.

Signed-off-by: Ken Barber <470bc578162732ac7f9d387d34c4af4ca6e1b6f7@bob.sh>


(ns overtunes.songs.at-all
  (:use
    [overtone.live :exclude [scale octave sharp flat sixth unison play]]
    [overtone.inst.sampled-piano :only [sampled-piano]]))

(def scale 66)
(defn ground [note] (+ scale note))

(def note# (comp sampled-piano ground))
(defn chord# [chord] (doseq [note (vals chord)] (note# note)))

(def ionian {:i 0, :ii 2, :iii 4, :iv 5, :v 7, :vi 9, :vii 11, :viii 12})
(def i (select-keys ionian [:i :iii :v]))
(def ii (select-keys ionian [:ii :iv :vi]))

(chord# ii)

(ns overtunes.songs.at-all
  (:use
    [overtone.live :only [at now]]
    [overtone.inst.sampled-piano :only [sampled-piano]]))

(defn bpm [beats-per-minute]
  (let [start (now)
        ms-per-minute (* 60 1000)
        ms-per-beat (/ ms-per-minute beats-per-minute)]
    #(+ start (* ms-per-beat %))))

(defn from [timing offset] #(timing (+ offset %)))

(def scale 56)
(defn ground [note] (+ scale note))

(def note# (comp sampled-piano ground))
(defn chord# [chord] (doseq [note (vals chord)] (note# note)))

(def ionian {:i 0, :ii 2, :iii 4, :iv 5, :v 7, :vi 9, :vii 11, :viii 12})
(def I (select-keys ionian [:i :iii :v]))
(def II (select-keys ionian [:ii :iv :vi]))
(def V (select-keys ionian [:v :vii :ii]))

(def progression [I {} II {} II V I V])

(defn rythm-n-bass# [timing chords]
  (do
    (at (timing 0) (chord# (first chords)))
    (rythm-n-bass# (from timing 4) (rest chords))))

; (rythm-n-bass# (bpm 130) (cycle progression))

Set up a chord loop.

Set up a chord loop.


(defproject com.palletops/hyde-pallet "0.1.0-SNAPSHOT"
  :description "Parent for hyde-pallet"
  :url "https://github.com/paleltops/hyde-pallet"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[com.palletops/hyde-pallet "0.1.0-SNAPSHOT"]]
  :plugins [[lein-modules "0.3.1"]]
  :aliases {"install" ["modules" "install"]
            "deploy" ["modules" "deploy"]
            "clean" ["modules" "clean"]}
  :profiles {:travis {:module {:subprocess "lein2"}}})

(defproject com.palletops/hyde-pallet "0.1.0-SNAPSHOT"
  :description "Parent for hyde-pallet"
  :url "https://github.com/paleltops/hyde-pallet"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[com.palletops/hyde-pallet "0.1.0-SNAPSHOT"]]
  :plugins [[lein-modules "0.3.1"]]
  :aliases {"install" ["modules" "install"]
            "deploy" ["modules" "deploy"]
            "clean" ["modules" "clean"]}
  :profiles {:travis {:modules {:subprocess "lein2"}}})

Fix modules config in travis profile

Fix modules config in travis profile


;(defproject cli4clj "0.2.0"
(defproject cli4clj "0.2.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.7.0"]
                 [clj-assorted-utils "1.9.1"]
                 [jline/jline "2.13"]]
  :main cli4clj.example)

(defproject cli4clj "0.3.0"
;(defproject cli4clj "0.2.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.7.0"]
                 [clj-assorted-utils "1.9.1"]
                 [jline/jline "2.13"]]
  :main cli4clj.example)

Update version info and push to clojars.


(defproject io.aviso/twixt "0.1.13-SNAPSHOT"
  :description "An extensible asset pipeline for Clojure web applications"
  :url "https://github.com/AvisoNovate/twixt"
  :license {:name "Apache Sofware Licencse 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [io.aviso/pretty "0.1.10"]
                 [io.aviso/tracker "0.1.0"]
                 [ring/ring-core "1.2.2"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.5.3"]
                 [de.neuland-bfi/jade4j "0.4.0"]
                 [hiccup "1.0.4"]]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/twixt/blob/master/"
          :src-linenum-anchor-prefix "L"
          :defaults                  {:doc/format :markdown}}
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

(defproject io.aviso/twixt "0.1.13-SNAPSHOT"
  :description "An extensible asset pipeline for Clojure web applications"
  :url "https://github.com/AvisoNovate/twixt"
  :license {:name "Apache Sofware Licencse 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [io.aviso/pretty "0.1.11"]
                 [io.aviso/tracker "0.1.0"]
                 [ring/ring-core "1.2.2"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.5.3"]
                 [de.neuland-bfi/jade4j "0.4.0"]
                 [hiccup "1.0.4"]]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/twixt/blob/master/"
          :src-linenum-anchor-prefix "L"
          :defaults                  {:doc/format :markdown}}
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

Update dependency to latest io.aviso:pretty, which includes stack frame filtering


(defproject clojurewerkz/statistiker "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.apache.commons/commons-math3 "3.2"]
                 [net.mikera/core.matrix "0.20.0"]]
  :source-paths       ["src/clj"]
  :java-source-paths  ["src/java"]
  :test-paths         ["test/clj"])

(defproject clojurewerkz/statistiker "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/math.combinatorics "0.0.7"]
                 [org.apache.commons/commons-math3 "3.2"]
                 [net.mikera/core.matrix "0.20.0"]
                 [org.jblas/jblas "1.2.3"]]
  :source-paths       ["src/clj"]
  :java-source-paths  ["src/java"]
  :test-paths         ["test/clj"])

Add combinatorics and matrix libs

Add combinatorics and matrix libs


(defproject funcool/cats "0.5.0"
  :description "Category Theory abstractions for Clojure"
  :url "https://github.com/funcool/cats"
  :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 "0.0-3308" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo"]
  :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]]
                   :codeina {:sources ["src"]
                             :reader :clojure
                             :target "doc/dist/latest/api"
                             :src-uri "http://github.com/funcool/cats/blob/master/"
                             :src-uri-prefix "#L"}
                   :plugins [[funcool/codeina "0.2.0"]]}
             :bench [:dev {:dependencies [[criterium "0.4.3"]]
                           :main ^:skip-aot benchmarks
                           :jvm-opts ^:replace []
                           :source-paths ["dev"]}]})

(defproject funcool/cats "0.5.0"
  :description "Category Theory abstractions for Clojure"
  :url "https://github.com/funcool/cats"
  :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.28" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo"]
  :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]]
                   :codeina {:sources ["src"]
                             :reader :clojure
                             :target "doc/dist/latest/api"
                             :src-uri "http://github.com/funcool/cats/blob/master/"
                             :src-uri-prefix "#L"}
                   :plugins [[funcool/codeina "0.2.0"]]}
             :bench [:dev {:dependencies [[criterium "0.4.3"]]
                           :main ^:skip-aot benchmarks
                           :jvm-opts ^:replace []
                           :source-paths ["dev"]}]})

Set clojurescript compiler version to 1.7.28.


(defproject lein-difftest "1.3.4"
  :description "Run tests, display better test results."
  :dependencies [[org.clojure/clojure "1.2.1"]
                 [difform "1.1.1"]
                 [clj-stacktrace "0.2.3"]
                 [clansi "1.0.0"]]
  :eval-in-leiningen true
  :hooks [leiningen.hooks.difftest])

(defproject lein-difftest "1.3.5"
  :description "Run tests, display better test results."
  :dependencies [[org.clojure/clojure "1.2.1"]
                 [difform "1.1.2"]
                 [clj-stacktrace "0.2.3"]
                 [clansi "1.0.0"]]
  :eval-in-leiningen true
  :hooks [leiningen.hooks.difftest])

Update difform version to remove dependency on contrib.


(defproject statuses "0.1.0-SNAPSHOT"
            :description "Statuses app for innoQ"
            :namespaces [statuses]
            :dependencies [
                           [org.clojure/clojure "1.4.0"]
                           [compojure "1.1.3"]
                           [clj-time "0.4.4"]
                           [ring "1.1.6"]
                           [org.clojure/data.json "0.2.0"]
                           ]
            :plugins [[lein-ring "0.7.5"]]
            :ring {:handler statuses.views.main/app-routes}
            :main statuses.server
            :profiles
            {:dev {:dependencies [[ring-mock "0.1.3"]]}})

(defproject statuses "0.1.0-SNAPSHOT"
            :description "Statuses app for innoQ"
            :namespaces [statuses]
            :dependencies [
                           [org.clojure/clojure "1.6.0"]
                           [compojure "1.2.1"]
                           [clj-time "0.8.0"]
                           [ring "1.3.1"]
                           [org.clojure/data.json "0.2.5"]
                           ]
            :plugins [[lein-ring "0.8.13"]]
            :ring {:handler statuses.views.main/app-routes}
            :main statuses.server
            :profiles
            {:dev {:dependencies [[ring-mock "0.1.5"]]}})

Update dependencies to latest stable versions.


(defproject tokyocabinet "1.24.1"
  :description "native tokyo cabinet libraries"
  :dependencies [[clojure "1.3.0"]])

(defproject tokyocabinet "1.24.2"
  :description "native tokyo cabinet libraries"
  :dependencies [[clojure "1.3.0"]])

Increase version number so I can test stuff


(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.1"]
                 [compojure "1.2.1"]
                 [clj-time "0.8.0"]
                 [org.clojure/data.json "0.2.5"]]
  :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.2.1"]
                 [clj-time "0.8.0"]
                 [org.clojure/data.json "0.2.5"]]
  :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]})

Upgrade ring from 1.3.1 to 1.3.2.

Upgrade ring from 1.3.1 to 1.3.2.

Fixes #135.


(def version (clojure.string/trim-newline (slurp "VERSION")))

(defproject io.framed/overseer version
  :description "A Clojure framework for defining and running expressive data pipelines"
  :url "https://github.com/framed-data/overseer"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :scm {:name "git"
        :url "https://github.com/framed-data/overseer"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [circleci/clj-yaml "0.5.3"]
                 [org.clojure/data.fressian "0.2.0"]
                 [clj-json "0.5.3"]
                 [org.clojure/tools.cli "0.3.1"]
                 [com.taoensso/timbre "4.0.2"]
                 [com.datomic/datomic-free "0.9.5130" :exclusions [joda-time]]
                 [clj-http "1.1.2"]
                 [raven-clj "1.1.0"]
                 [io.framed/std "0.1.2"]]
  :aot [overseer.runner]
  :plugins [[codox "0.8.13"]]
  :codox {:output-dir "doc/api"})

(def version (clojure.string/trim-newline (slurp "VERSION")))

(defproject io.framed/overseer version
  :description "A Clojure framework for defining and running expressive data pipelines"
  :url "https://github.com/framed-data/overseer"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :scm {:name "git"
        :url "https://github.com/framed-data/overseer"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [circleci/clj-yaml "0.5.3"]
                 [org.clojure/data.fressian "0.2.0"]
                 [clj-json "0.5.3"]
                 [org.clojure/tools.cli "0.3.1"]
                 [com.taoensso/timbre "4.0.2"]
                 [com.datomic/datomic-free "0.9.5130" :exclusions [joda-time]]
                 [clj-http "1.1.2"]
                 [raven-clj "1.1.0"]
                 [io.framed/std "0.1.2"]
                 [aysylu/loom "1.0.0"]
                 [org.clojure/java.jdbc "0.7.0-alpha3"]
                 [com.h2database/h2 "1.4.195"]]
  :aot [overseer.runner]
  :plugins [[codox "0.8.13"]]
  :codox {:output-dir "doc/api"})

Add dependencies on loom, JDBC and H2

Add dependencies on loom, JDBC and H2


(defproject comic-reader "0.1.0-SNAPSHOT"
  :description "An app for reading comics/manga on or offline"
  :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"]]
  :main ^:skip-aot comic-reader.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

(defproject comic-reader "0.1.0-SNAPSHOT"
  :description "An app for reading comics/manga on or offline"
  :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"]
                 [org.clojure/clojurescript "0.0-2371"]
                 [ring "1.3.1"]
                 [compojure "1.2.1"]
                 [fogus/ring-edn "0.2.0"]
                 [cljs-ajax "0.3.3"]]

  :plugins      [[lein-ring "0.8.13"]
                 [lein-cljsbuild "1.0.3"]]

  :hooks [leiningen.cljsbuild]
  :ring  {:handler comic-reader.core/app}
  :cljsbuild {:builds [{:source-paths ["src/cljs"]
                        :compiler {:output-dir "resources/public/js"
                                   :output-to "resources/public/js/main.js"
                                   :source-map "resources/public/js/main.js.map"
                                   :optimizations :whitespace
                                   :pretty-print true}}]}

  :main ^:skip-aot comic-reader.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

Add ring/cljs etc. dependencies and configuration


(defproject org.onyxplatform/onyx-metrics "0.8.1.0-SNAPSHOT"
  :description "Instrument Onyx workflows"
  :url "https://github.com/MichaelDrogalis/onyx"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [interval-metrics "1.0.0"]
                 [stylefruits/gniazdo "0.4.0"]]
  :java-opts ^:replace ["-server" "-Xmx3g"]
  :global-vars  {*warn-on-reflection* true
                 *assert* false
                 *unchecked-math* :warn-on-boxed}
  :profiles {:dev {:dependencies [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                                  [org.onyxplatform/onyx "0.8.1-alpha8"]
                                  [riemann-clojure-client "0.4.1"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}})

(defproject org.onyxplatform/onyx-metrics "0.8.1.0-SNAPSHOT"
  :description "Instrument Onyx workflows"
  :url "https://github.com/MichaelDrogalis/onyx"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :dependencies [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.1-alpha6"]
                 [org.clojure/clojure "1.7.0"]
                 [interval-metrics "1.0.0"]
                 [stylefruits/gniazdo "0.4.0"]]
  :java-opts ^:replace ["-server" "-Xmx3g"]
  :global-vars  {*warn-on-reflection* true
                 *assert* false
                 *unchecked-math* :warn-on-boxed}
  :profiles {:dev {:dependencies [[riemann-clojure-client "0.4.1"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}})

Move onyx dep out of dev depedencies

Move onyx dep out of dev depedencies


(defproject neko "3.2.0-preview3"
  :description "Neko is a toolkit designed to make Android development using Clojure easier and more fun."
  :url "https://github.com/clojure-android/neko"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure-android/clojure "1.7.0-alpha4"]]
  :source-paths ["src" "src/clojure"]
  :java-source-paths ["src/java" "gen"]

  :profiles {:default [:android-common]}
  :plugins [[lein-droid "0.3.0"]]

  :android {:library true
            :target-version 18})

(defproject neko "3.2.0-preview3"
  :description "Neko is a toolkit designed to make Android development using Clojure easier and more fun."
  :url "https://github.com/clojure-android/neko"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure-android/clojure "1.7.0-alpha6"]]
  :source-paths ["src" "src/clojure"]
  :java-source-paths ["src/java" "gen"]

  :profiles {:default [:android-common]}
  :plugins [[lein-droid "0.3.0"]]

  :android {:library true
            :target-version 18})

Update Clojure dependency to alpha6

Update Clojure dependency to alpha6


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

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

Advance version number to 0.1.3

Advance version number to 0.1.3


(defproject clum "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"}
  :plugins [[lein-cljsbuild "1.1.5"]
            [lein-auto      "0.1.3"]]
  :cljsbuild {:builds [{:source-paths ["src/clum/app"]
                        :compiler     {:output-to "public/js/app.js"
                                       :optimizations :whitespace
                                       :pretty-print  true}}]}
  :auto {:default {:file-pattern #"\.(clj)$"}}
  :source-paths ["src/clum/server"]
  :dependencies [;; server-side
                 [org.clojure/clojure "1.8.0"]
                 [http-kit            "2.2.0"]
                 [com.taoensso/timbre "4.8.0"]
                 [com.cognitect/transit-clj "0.8.297"]
                 [ring-transit              "0.1.6"]

                 ;; client-side
                 [reagent                    "0.6.0"]
                 [com.cognitect/transit-cljs "0.8.239"]])

(defproject clum "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"}
  :plugins [[lein-cljsbuild "1.1.5"]
            [lein-auto      "0.1.3"]]
  :cljsbuild {:builds [{:source-paths ["src/clum/app"]
                        :compiler     {:output-to "public/js/app.js"
                                       :optimizations :whitespace
                                       :pretty-print  true}}]}
  :auto {:default {:file-pattern #"\.(clj)$"}}
  :source-paths ["src/clum/server"]
  :dependencies [;; server-side
                 [org.clojure/clojure       "1.8.0"]
                 [http-kit                  "2.2.0"]
                 [com.taoensso/timbre       "4.8.0"]
                 [com.cognitect/transit-clj "0.8.297"]
                 [ring-transit              "0.1.6"]
                 [overtone                  "0.10.1"]

                 ;; client-side
                 [reagent                    "0.6.0"]
                 [com.cognitect/transit-cljs "0.8.239"]])

Add overtone dependency for midi library.


(defproject cascade "0.2-SNAPSHOT"
  :description "Simple, fast, easy web applications in idiomatic Clojure"
  :url "http://github.com/hlship/cascade"
  :main main
  :warn-on-reflection true
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/algo.monads "0.1.0"]
                 [compojure "0.6.5"]]
  :dev-dependencies [[ring/ring-jetty-adapter "0.3.11"]
                     [swank-clojure "1.3.1"]
                     [midje "1.1.1"]
                     [lein-ring "0.4.6"]]
  :ring {:handler main/app})

(defproject cascade "0.2-SNAPSHOT"
  :description "Simple, fast, easy web applications in idiomatic Clojure"
  :url "http://github.com/hlship/cascade"
  :main main
  :warn-on-reflection true
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/algo.monads "0.1.0"]
                 [clj-json "0.4.3"]
                 [compojure "0.6.5"]]
  :dev-dependencies [[ring/ring-jetty-adapter "0.3.11"]
                     [swank-clojure "1.3.1"]
                     [midje "1.1.1"]
                     [lein-ring "0.4.6"]]
  :ring {:handler main/app})

Add support for rendering JSON

Add support for rendering JSON


(defproject org.onyxplatform/onyx-datomic "0.7.3-beta8"
  :description "Onyx plugin for Datomic"
  :url "https://github.com/MichaelDrogalis/onyx-datomic"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.7.3-20150902_134205-g8bdc527"]]
  :profiles {:dev {:dependencies [[midje "1.7.0"]
                                  [com.datomic/datomic-free "0.9.5153"]]
                   :plugins [[lein-midje "3.1.3"]
                             [lein-set-version "0.4.1"]
                             [lein-pprint "1.1.1"]]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

(defproject org.onyxplatform/onyx-datomic "0.7.3-SNAPSHOT"
  :description "Onyx plugin for Datomic"
  :url "https://github.com/MichaelDrogalis/onyx-datomic"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.7.3-20150902_134205-g8bdc527"]]
  :profiles {:dev {:dependencies [[midje "1.7.0"]
                                  [com.datomic/datomic-free "0.9.5153"]]
                   :plugins [[lein-midje "3.1.3"]
                             [lein-set-version "0.4.1"]
                             [lein-pprint "1.1.1"]]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

Prepare for next release cycle.

Prepare for next release cycle.


;; The only requirement of the project.clj file is that it includes a
;; defproject form. It can have other code in it as well, including
;; loading other task definitions.

(defproject leiningen "1.2.0-SNAPSHOT"
  :description "A build tool designed not to set your hair on fire."
  :url "http://github.com/technomancy/leiningen"
  :dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"]
                 [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
                 [ant/ant "1.6.5"]
                 [ant/ant-launcher "1.6.5"]
                 [jline "0.9.94"]
                 [org.apache.maven/maven-ant-tasks "2.0.10"]]
  :dev-dependencies [[leiningen/lein-swank "1.1.0"]
                     [autodoc "0.7.0"]]
  :main leiningen.core)

;; The only requirement of the project.clj file is that it includes a
;; defproject form. It can have other code in it as well, including
;; loading other task definitions.

(defproject leiningen "1.2.0-SNAPSHOT"
  :description "A build tool designed not to set your hair on fire."
  :url "http://github.com/technomancy/leiningen"
  :dependencies [[org.clojure/clojure "1.1.0"]
                 [org.clojure/clojure-contrib "1.1.0"]
                 [ant/ant "1.6.5"]
                 [ant/ant-launcher "1.6.5"]
                 [jline "0.9.94"]
                 [org.apache.maven/maven-ant-tasks "2.0.10"]]
  :dev-dependencies [[leiningen/lein-swank "1.1.0"]
                     [autodoc "0.7.0"]]
  :main leiningen.core)

Drop back to Clojure 1.1.0 until issues with 1.2.0 are resolved.


(ns user
  (:require [schema.core :as s])
  (:use [figwheel-sidecar.repl-api :as ra]))

(s/set-fn-validation! true)

(defn start [] (ra/start-figwheel!))

(defn stop [] (ra/stop-figwheel!))

(defn cljs [] (ra/cljs-repl "dev"))

(comment
  (let [codes [27 91 49 74]]
    #_(map #(format "%x" %) codes)
    (String. (int-array codes) 0 (count codes)))
)

Add helpers to dev ns

Add helpers to dev ns


(ns braid.core.client.invites.views.invite-page-styles
  (:require
   [braid.core.client.ui.styles.mixins :as mixins]
   [braid.core.client.ui.styles.vars :as vars]
   [garden.units :refer [rem em px]]))

(def invite-page
  [:>.page.invite
   [:>.content
    mixins/flex
    {:flex-direction "column"
     :align-items "center"}
    [:>.invite
     {:background-color "white"
      :border-radius (px 10)
      :padding (rem 1)
      :font-size (rem 0.9)
      :width "50%"}
     [:button (mixins/settings-button)]
     [:.invite-link
      [:>input
       {:width "100%"}]]]]])

(ns braid.core.client.invites.views.invite-page-styles
  (:require
   [braid.core.client.ui.styles.mixins :as mixins]
   [braid.core.client.ui.styles.vars :as vars]
   [garden.units :refer [rem em px]]))

(def invite-page
  [:>.page.invite
   [:>.content
    (mixins/settings-container-style)
    [:>.invite
     (mixins/settings-item-style)]]])

Use newly-factored mixins to share styles to invite page


(ns com.hypirion.primes
  (:import [com.hypirion.primes Primes])
  (:refer-clojure :exclude [take get]))

(defn prime? [n]
  (Primes/isPrime n))

(defn take [n]
  (Primes/take n))

(defn get [n]
  (Primes/get n))

(defn take-below [n]
  (Primes/takeUnder n))

(ns com.hypirion.primes
  (:import [com.hypirion.primes Primes])
  (:refer-clojure :exclude [take get]))

(defn prime? [^long n]
  (Primes/isPrime n))

(defn take [n]
  (Primes/take n))

(defn get [n]
  (Primes/get n))

(defn take-below [n]
  (Primes/takeUnder n))

Add type hint on prime?

Add type hint on prime?


(defproject org.onyxplatform/onyx-bookkeeper "0.8.1.0-alpha8"
  :description "Onyx plugin for BookKeeper"
  :url "https://github.com/onyx-platform/onyx-bookkeeper"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.1-alpha8"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

(defproject org.onyxplatform/onyx-bookkeeper "0.8.1.0-SNAPSHOT"
  :description "Onyx plugin for BookKeeper"
  :url "https://github.com/onyx-platform/onyx-bookkeeper"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 ^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
                 [org.onyxplatform/onyx "0.8.1-alpha8"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}
             :circle-ci {:jvm-opts ["-Xmx4g"]}})

Prepare for next release cycle.

Prepare for next release cycle.


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

(defproject onyx-app/lein-template "0.9.8.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.


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

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

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

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

Bump sjacket for character fix, and bump nREPL RC


(defproject funcool/promesa "1.8.1"
  :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.8.0" :scope "provided"]
                 [org.clojure/clojurescript "1.9.293" :scope "provided"]
                 [org.clojure/core.async "0.2.391" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src" "assets"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]

  :profiles
  {:dev
   {:dependencies [[com.cognitect/transit-cljs "0.8.239"]]
    :source-paths ["dev/src"]
    :codeina {:sources ["src"]
              :reader :clojure
              :target "doc/dist/latest/api"}
    :plugins [[funcool/codeina "0.5.0"]
              [lein-ancient "0.6.10" :exclusions [org.clojure/tools.reader]]]}})

(defproject funcool/promesa "1.8.1"
  :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.8.0" :scope "provided"]
                 [org.clojure/clojurescript "1.9.293" :scope "provided"]
                 [org.clojure/core.async "0.3.442" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src" "assets"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]

  :profiles
  {:dev
   {:dependencies [[com.cognitect/transit-cljs "0.8.239"]]
    :source-paths ["dev/src"]
    :codeina {:sources ["src"]
              :reader :clojure
              :target "doc/dist/latest/api"}
    :plugins [[funcool/codeina "0.5.0"]
              [lein-ancient "0.6.10" :exclusions [org.clojure/tools.reader]]]}})

Bump core.async version to unbreak build with Clojure 1.9.0-alpha15


(defproject tetris "0.1.0-SNAPSHOT"
  :description "Tetris implementation in ClojureScript."
  :url "http://tetris.temochka.com/"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/clojurescript "0.0-2342"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]]
  :plugins [[lein-cljsbuild "1.0.3"]
            [com.cemerick/austin "0.1.5"]]
  :cljsbuild {:builds [{:id "dev"
                        :source-paths ["src"]
                        :compiler {:output-to "resources/public/tetris.js"
                                   :optimizations :none
                                   :source-map true}}
                       {:id "prod"
                        :source-paths ["src/tetris"]
                        :compiler {:output-to "resources/public/tetris.min.js"
                                   :optimizations :advanced
                                   :pretty-print false}}]})

(defproject tetris "0.1.0-SNAPSHOT"
  :description "Tetris implementation in ClojureScript."
  :url "http://tetris.temochka.com/"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/clojurescript "0.0-2342"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]]
  :plugins [[lein-cljsbuild "1.0.3"]
            [com.cemerick/austin "0.1.5"]]
  :cljsbuild {:builds [{:id "dev"
                        :source-paths ["src"]
                        :compiler {:output-to "resources/public/tetris.js"
                                   :output-dir "resources/public/out"
                                   :optimizations :none
                                   :source-map true}}
                       {:id "prod"
                        :source-paths ["src/tetris"]
                        :compiler {:output-to "resources/public/tetris.min.js"
                                   :optimizations :advanced
                                   :pretty-print false}}]})

Add :output-dir build property for dev builds.


(ns {{app-name}}.launcher.aeron-media-driver
  (:gen-class)
  (:require [clojure.core.async :refer [chan <!!]])
  (:import [uk.co.real_logic.aeron Aeron$Context]
           [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context ThreadingMode]))

(defn -main [& args]
  (let [ctx (doto (MediaDriver$Context.) )
        media-driver (MediaDriver/launch ctx)]
    (println "Launched the Media Driver. Blocking forever...")
    (<!! (chan))))

(ns {{app-name}}.launcher.aeron-media-driver
  (:gen-class)
  (:require [clojure.core.async :refer [chan <!!]])
  (:import [uk.co.real_logic.aeron Aeron$Context]
           [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context ThreadingMode]))

(defn -main [& [threading-mode]]
  (let [threading-mode (cond (or (nil? threading-mode)
                                 (= threading-mode "dedicated"))
                                 ThreadingMode/DEDICATED
                                 (= threading-mode "shared")
                                 ThreadingMode/SHARED
                                 (= threading-mode "shared-network")
                                 ThreadingMode/SHARED_NETWORK)
        _ (println "Starting media driver with threading mode: " threading-mode)
        ctx (-> (MediaDriver$Context.)
                (.threadingMode threading-mode))
        media-driver (MediaDriver/launch ctx)]
    (println "Launched the Media Driver. Blocking forever...")
    (<!! (chan))))

Allow driver mode to be supplied via command line


(ns cavm.query.functions
  (:use clojure.core.matrix)
  (:use clojure.core.matrix.operators)
  (:refer-clojure :exclude  [* - + == /])
  (:gen-class))

(set-current-implementation :vectorz)

(defn meannan1d [m]
  (let [NaN Double/NaN
        [sum n] (ereduce
                  (fn [[acc cnt] x] (if (Double/isNaN x) [acc cnt] [(+ acc x) (inc cnt)]))
                  [0 0]
                  m)]
    (if (= 0 n) NaN (/ sum n))))

; XXX this handling of dim is wrong for dim > 1
; XXX do we need to fill nan values, like we do in python?
(defn meannan [m dim]
    (let [new-shape (assoc (vec (shape m)) (long dim) 1)]
      (reshape (matrix (map meannan1d (slices m (- 1 dim)))) new-shape)))

(def functions
  {'+ +
   '/ /
   '* emul
   '- -
   'mean meannan
   'apply apply})

(ns cavm.query.functions
  (:use clojure.core.matrix)
  (:use clojure.core.matrix.operators)
  (:refer-clojure :exclude  [* - + == /])
  (:gen-class))

(set-current-implementation :vectorz)

(defn meannan1d [m]
  (let [NaN Double/NaN
        [sum n] (ereduce
                  (fn [[acc cnt] x] (if (Double/isNaN x) [acc cnt] [(+ acc x) (inc cnt)]))
                  [0 0]
                  m)]
    (if (= 0 n) NaN (/ sum n))))

; XXX this handling of dim is wrong for dim > 1
; XXX do we need to fill nan values, like we do in python?
(defn meannan [m dim]
    (let [new-shape (assoc (vec (shape m)) (long dim) 1)]
      (reshape (matrix (map meannan1d (slices m (- 1 dim)))) new-shape)))

(def functions
  {'+ +
   '/ /
   '* emul
   '> >
   '< <
   '>= >=
   '<= <=
   '- -
   '= ==
   'mean meannan
   'apply apply}) ; XXX is this a security hole? Can the user pass in clojure symbols?

Add boolean operators. Still need to extend these for matrices.


(ns lexemic.core
  (:require [cljs.nodejs :as node]
            [lexemic.sentiment.simple :as sentiment]))

(def ^:private fs
  (node/require "fs"))

(def ^:private usage-banner "Usage: lexemic [command] [implementation] [target...]")
(def ^:private supported-commands #{"help" "sentiment"})

(defn- help []
  (str usage-banner))

(defn- run [cmd impl text]
  (condp = cmd
    "sentiment" (sentiment/analyse text)))

(defn -main [& args]
  (let [command (first args)
        impl (when (.match (second args) #"^-{1,2}")
               (second args))
        targets (if impl
                  (drop 2 args)
                  (drop 1 args))
        file? (fn [path]
                (.existsSync fs path))
        get-string (fn [x]
                     (if (file? x)
                       (.readFileSync fs x "utf8")
                       (identity x)))
        contents (map get-string targets)
        input (print-str contents)]
    (if-let [cmd (supported-commands command)]
      (println (run cmd impl input))
      (println (help)))))

(set! *main-cli-fn* -main)

(ns lexemic.core
  (:require [cljs.nodejs :as node]
            [lexemic.sentiment.simple :as sentiment]))

(def ^:private version
  (.-version (node/require "./package.json")))
(def ^:private fs
  (node/require "fs"))

(def ^:private spacer "")
(def ^:private version (str "Lexemic v" version))
(def ^:private usage-banner "Usage: lexemic [command] [implementation] [target...]")
(def ^:private supported-commands #{"help" "sentiment"})

(defn- show-help []
  (do
    (println version)
    (println spacer)
    (println usage-banner)))

(defn- run [cmd impl text]
  (condp = cmd
    "sentiment" (prn (sentiment/analyse text))
    (show-help)))

(defn -main [& args]
  (let [command (first args)
        impl (let [impl* (second args)]
               (when (and impl* (.match impl* #"^-{1,2}"))
                 impl*))
        targets (if impl
                  (drop 2 args)
                  (drop 1 args))
        file? (fn [path]
                (.existsSync fs path))
        get-string (fn [x]
                     (if (file? x)
                       (.readFileSync fs x "utf8")
                       (identity x)))
        contents (map get-string targets)
        input (print-str contents)]
    (if-let [cmd (supported-commands command)]
      (run cmd impl input)
      (show-help))))

(set! *main-cli-fn* -main)

Make cmd line command handling more robust.


(ns circle.backend.build.test-inference
  (:use midje.sweet)
  (:use circle.backend.build.inference)
  (:require [circle.backend.build.test-utils :as test]))

(fact "repositories containing php files are assumed to be php apps"
      (let [php-repo (test/test-repo "simple_php")]
        (infer-repo-type php-repo) => :php))

(fact "repositories that aren't php are assumed to be rails"
      (let [some-repo (test/test-repo "empty")]
        (infer-repo-type some-repo) => :rails))

(fact "inferred actions have source :inferred"
  (let [example-repo (test/test-repo "database_yml_1")
        actions (infer-actions example-repo)]
    (every? :source actions) => true
    (->> actions
         (map :source)
         (into #{})
         (#(contains? % :inferred)))  => true))

(ns circle.backend.build.test-inference
  (:use midje.sweet)
  (:use circle.backend.build.inference)
  (:require [circle.backend.build.test-utils :as test]))

(fact "inferred actions have source :inferred"
  (let [example-repo (test/test-repo "database_yml_1")
        actions (infer-actions example-repo)]
    (every? :source actions) => true
    (->> actions
         (map :source)
         (into #{})
         (#(contains? % :inferred)))  => true))

Remove tests that refer to no longer existing fns


(defproject checkin "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"]
                           [ring "1.3.2"]
                           [compojure "1.3.1"]
                           [ring/ring-defaults "0.1.2"]
                           [clj-oauth2 "0.2.0"]
                           [cheshire "5.4.0"]
                           ]
            :plugins [[lein-ring "0.9.1"]]
            :ring {:handler checkin.handler/app
                   :uberwar-name "loneworkercheckin.war"})

(defproject checkin "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"]
                           [ring "1.3.2"]
                           [compojure "1.3.1"]
                           [ring/ring-defaults "0.1.2"]
                           [clj-oauth2 "0.2.0"]
                           [cheshire "5.4.0"]
                           ]

            :profiles {:proxied
                       {:jvm-opts ["-Dhttp.proxyHost=127.0.0.1" "-Dhttp.proxyPort=8888" "-Dhttps.proxyHost=127.0.0.1" "-Dhttps.proxyPort=8888"]}}
            :plugins [[lein-ring "0.9.1"]]
            :ring {:handler checkin.handler/app
                   :uberwar-name "loneworkercheckin.war"}
            :aliases {"run-proxied" ["with-profile" "proxied" "ring" "server"]})

Add option to run in proxied mode

Add option to run in proxied mode


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject rill "0.1.0"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
                 [org.clojure/tools.logging "0.2.6"]
                 [prismatic/schema "0.2.2"]
                 [slingshot "0.10.3"]
                 [environ "0.5.0"]
                 [cheshire "5.3.1"]
                 [clj-http "0.9.1"]
                 [com.velisco/tagged "0.3.4"]
                 [me.raynes/conch "0.7.0"]
                 [identifiers "1.1.0"]
                 [org.clojure/java.jdbc "0.3.4"]
                 [postgresql "9.1-901.jdbc4"]
                 [com.taoensso/nippy "2.6.3"]
                 [com.mchange/c3p0 "0.9.2.1"]]
  :aot [rill.cli])

(defproject rill "0.1.1"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/core.async "0.1.338.0-5c5012-alpha"]
                 [org.clojure/tools.logging "0.2.6"]
                 [prismatic/schema "0.2.2"]
                 [slingshot "0.10.3"]
                 [environ "0.5.0"]
                 [cheshire "5.3.1"]
                 [clj-http "0.9.1"]
                 [com.velisco/tagged "0.3.4"]
                 [me.raynes/conch "0.7.0"]
                 [identifiers "1.1.0"]
                 [org.clojure/java.jdbc "0.3.4"]
                 [postgresql "9.1-901.jdbc4"]
                 [com.taoensso/nippy "2.6.3"]
                 [com.mchange/c3p0 "0.9.2.1"]]
  :aot [rill.cli])

Mark changes in rill version number

Mark changes in rill version number


(defproject onyx-plugin/lein-template "0.8.2.4"
  :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.2.5-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.


(defproject useful "0.7.5-alpha1"
  :description "A collection of generally-useful Clojure utility functions"
  :dependencies [[clojure "1.2.0"]
                 [org.clojure/tools.macro "0.1.1"]])

(defproject useful "0.7.5-alpha2"
  :description "A collection of generally-useful Clojure utility functions"
  :dependencies [[clojure "1.2.0"]
                 [org.clojure/tools.macro "0.1.1"]])

Bump version so I can use new io package


(defproject cheshire "2.2.1-SNAPSHOT"
  :description "JSON and JSON SMILE encoding, fast."
  :url "https://github.com/dakrone/cheshire"
  :warn-on-reflection false
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.codehaus.jackson/jackson-core-asl "1.9.4"]
                 [org.codehaus.jackson/jackson-smile "1.9.4"]]
  :dev-dependencies [[lein-marginalia "0.6.0"]
                     [lein-multi "1.1.0"]]
  :multi-deps {"1.2.1" [[org.clojure/clojure "1.2.1"]
                        [org.codehaus.jackson/jackson-core-asl "1.9.4"]
                        [org.codehaus.jackson/jackson-smile "1.9.4"]]
               "1.4.0" [[org.clojure/clojure "1.4.0-beta1"]
                        [org.codehaus.jackson/jackson-core-asl "1.9.4"]
                        [org.codehaus.jackson/jackson-smile "1.9.4"]]})

(defproject cheshire "2.2.1-SNAPSHOT"
  :description "JSON and JSON SMILE encoding, fast."
  :url "https://github.com/dakrone/cheshire"
  :warn-on-reflection false
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.codehaus.jackson/jackson-core-asl "1.9.5"]
                 [org.codehaus.jackson/jackson-smile "1.9.5"]]
  :dev-dependencies [[lein-marginalia "0.6.0"]
                     [lein-multi "1.1.0"]]
  :multi-deps {"1.2.1" [[org.clojure/clojure "1.2.1"]
                        [org.codehaus.jackson/jackson-core-asl "1.9.5"]
                        [org.codehaus.jackson/jackson-smile "1.9.5"]]
               "1.4.0" [[org.clojure/clojure "1.4.0-beta3"]
                        [org.codehaus.jackson/jackson-core-asl "1.9.5"]
                        [org.codehaus.jackson/jackson-smile "1.9.5"]]})

Bump jackson deps, use latest 1.4 beta for multi-test


(defproject incise "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 [[speclj "2.1.2"]
                 [org.clojure/clojure "1.5.1"]
                 [hiccup "1.0.2"]
                 [compojure "1.1.5"]
                 [http-kit "2.1.1"]
                 [dieter "0.4.1"]]
  :plugins [[speclj "2.1.2"]]
  :test-paths ["spec/"])

(defproject incise "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"]
                 [speclj "2.1.2"]
                 [ring "1.2.0"]
                 [hiccup "1.0.2"]
                 [compojure "1.1.5"]
                 [http-kit "2.1.1"]
                 [dieter "0.4.1"]]
  :plugins [[speclj "2.1.2"]]
  :test-paths ["spec/"])

Add ring 1.2.0 dependency to get middlewares.


(defproject neko "3.0.2-SNAPSHOT"
  :description "Neko is a toolkit designed to make Android development using Clojure easier and more fun."
  :url "https://github.com/alexander-yakushev/neko"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure-android/clojure "1.5.1-jb"]]
  :source-paths ["src" "src/clojure"]
  :java-source-paths ["src/java" "gen"]

  :android {:library true
            :target-sdk :ics})

(defproject neko "3.0.2-SNAPSHOT"
  :description "Neko is a toolkit designed to make Android development using Clojure easier and more fun."
  :url "https://github.com/clojure-android/neko"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure-android/clojure "1.5.1-jb"]]
  :source-paths ["src" "src/clojure"]
  :java-source-paths ["src/java" "gen"]

  :android {:library true
            :target-sdk :ics})

Update GitHub path to clojure-android

Update GitHub path to clojure-android


(ns re-frame.interop
  (:require [goog.async.nextTick]
            [reagent.core]
            [reagent.ratom]))

(def next-tick goog.async.nextTick)

(def empty-queue #queue [])

(def after-render reagent.core/after-render)

;; make sure the Google Closure compiler see this as a boolean constatnt
;; https://developers.google.com/closure/compiler/docs/js-for-compiler
(def ^:boolean debug-enabled? "@const  @define {boolean}" js/goog.DEBUG)

(defn ratom [x]
  (reagent.core/atom x))

(defn ratom? [x]
  (satisfies? reagent.ratom/IReactiveAtom x))

(defn deref? [x]
  (satisfies? IDeref x))

(defn make-reaction [f]
  (reagent.ratom/make-reaction f))

(defn add-on-dispose! [a-ratom f]
  (reagent.ratom/add-on-dispose! a-ratom f))

(defn set-timeout! [f ms]
  (js/setTimeout f ms))

(ns re-frame.interop
  (:require [goog.async.nextTick]
            [reagent.core]
            [reagent.ratom]))

(def next-tick goog.async.nextTick)

(def empty-queue #queue [])

(def after-render reagent.core/after-render)

;; Make sure the Google Closure compiler sees this as a boolean constatnt,
;; otherwise Dead Code Elimination won't happen in `:advanced` builds.
;; Type hints have been liberally sprinkled.
;; https://developers.google.com/closure/compiler/docs/js-for-compiler
(def ^boolean DEBUG? "@define {boolean}" ^boolean js/goog.DEBUG)

(defn ratom [x]
  (reagent.core/atom x))

(defn ratom? [x]
  (satisfies? reagent.ratom/IReactiveAtom x))

(defn deref? [x]
  (satisfies? IDeref x))

(defn make-reaction [f]
  (reagent.ratom/make-reaction f))

(defn add-on-dispose! [a-ratom f]
  (reagent.ratom/add-on-dispose! a-ratom f))

(defn set-timeout! [f ms]
  (js/setTimeout f ms))

Put in the right magic around `:advanced` Dead Code Elimination


(ns user
  (:require [{{project-ns}}.server]
            [ring.middleware.reload :refer [wrap-reload]]
            [figwheel-sidecar.repl-api :as figwheel]{{#less?}}
            [clojure.java.shell]{{/less?}}{{#sass?}}
            [clojure.java.shell]{{/sass?}}))

{{#less?}}
(defn start-less []
  (future
    (println "Starting less.")
    (clojure.java.shell/sh "lein" "less" "auto")))
{{/less?}}{{#sass?}}
(defn start-sass []
  (future
    (println "Starting sass.")
    (clojure.java.shell/sh "lein" "auto" "sassc" "once")))
{{/sass?}}

(def http-handler
  (wrap-reload {{project-ns}}.server/http-handler))

(defn run []
  (figwheel/start-figwheel!){{less-sass-start}})

(def browser-repl figwheel/cljs-repl)

(ns user
  (:require [{{project-ns}}.server]
            [ring.middleware.reload :refer [wrap-reload]]
            [figwheel-sidecar.repl-api :as figwheel]{{#less?}}
            [clojure.java.shell]{{/less?}}{{#sass?}}
            [clojure.java.shell]{{/sass?}}))

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

{{#less?}}
(defn start-less []
  (future
    (println "Starting less.")
    (clojure.java.shell/sh "lein" "less" "auto")))
{{/less?}}{{#sass?}}
(defn start-sass []
  (future
    (println "Starting sass.")
    (clojure.java.shell/sh "lein" "auto" "sassc" "once")))
{{/sass?}}

(def http-handler
  (wrap-reload {{project-ns}}.server/http-handler))

(defn run []
  (figwheel/start-figwheel!){{less-sass-start}})

(def browser-repl figwheel/cljs-repl)

Enable warnings for reflections and unboxed math

These are good defaults to have so you know when to add type annotations.


(ns todo-repl-webapp.handler
  (:require [compojure.core :refer :all]
            [compojure.handler :as handler]
            [compojure.route :as route]
            [cemerick.friend :as friend]
            (cemerick.friend [workflows :as workflows]
                             [credentials :as credentials])
            [todo-repl-webapp.views :as views]
            [todo-repl-webapp.eval :as e]
            [todo-repl-webapp.users :as u]
            [todo-repl-webapp.web-repl :as web-repl]))

(defroutes app-routes
  (GET "/" [] "Hello World")
  (GET "/home" [] (views/home (web-repl/tasks)))
  (POST "/eval" [evalInput]
    (let [eval-result (e/evaluate evalInput)]
      (println "/eval " evalInput " evals to: " eval-result)
      (views/display eval-result)))
  (route/resources "/")
  (route/not-found "Not Found"))

(def app
  (handler/site app-routes))

(def secured-app
  (-> app
    (friend/authenticate {:credential-fn
                            (partial credentials/bcrypt-credential-fn u/users)
                          :workflows [(workflows/interactive-form)]})))

(ns todo-repl-webapp.handler
  (:require [compojure.core :refer :all]
            [compojure.handler :as handler]
            [compojure.route :as route]
            [cemerick.friend :as friend]
            (cemerick.friend [workflows :as workflows]
                             [credentials :as credentials])
            [todo-repl-webapp.views :as views]
            [todo-repl-webapp.eval :as e]
            [todo-repl-webapp.users :as u]
            [todo-repl-webapp.web-repl :as web-repl]))

(defroutes app-routes
  (GET "/" [] "Hello World")
  (GET "/home" [] (views/home (web-repl/tasks)))
  (POST "/eval" [evalInput]
    (let [eval-result (e/evaluate evalInput)]
      (println "/eval " evalInput " evals to: " eval-result)
      (views/display eval-result)))
  (GET "/admin" request (friend/authorize #{::admin}
                                          "Admin page"))
  (GET "/login" [] "This is a login page")
  (route/resources "/")
  (route/not-found "Not Found"))

(def app
  (handler/site app-routes))

(def secured-app
  (-> app
    (friend/authenticate {:credential-fn
                            (partial credentials/bcrypt-credential-fn u/users)
                          :workflows [(workflows/interactive-form)]})))

Add secured route to admin page and a login page


(ns patavi.worker.main
  (:gen-class)
  (:require [patavi.worker.task :as tasks :only [initialize]]
            [patavi.worker.pirate.core :as pirate]
            [clojure.tools.cli :refer [cli]]
            [clojure.string :refer [split trim capitalize]]
            [clojure.tools.logging :as log]))

(defn -main
  [& args]
  (let [[options args banner]
        (cli args
             ["-h" "--help" "Show help" :default false :flag true]
             ["-r" "--rserve" "Start RServe from application" :default false :flag true]
             ["-n" "--nworkers" "Amount of worker threads to start"
              :default (.availableProcessors (Runtime/getRuntime))
              :parse-fn #(Integer. %)]
             ["-m" "--method" "R method name" :default "echo"]
             ["-p" "--packages" "Comma seperated list of additional R packages to load"
              :parse-fn #(split % #",\s?")]
             ["-f" "--file" "R file to execute" :default "resources/pirate/echo.R"])
        method (:method options)
        file (:file options)]
    (when (:help options)
      (println banner)
      (System/exit 0))
    (pirate/initialize (:file options) (:packages options) (:rserve options))
    (tasks/initialize method (:nworkers options) pirate/execute)
    (while true (Thread/sleep 100))))

(ns patavi.worker.main
  (:gen-class)
  (:require [patavi.worker.task :as tasks :only [initialize]]
            [patavi.worker.pirate.core :as pirate]
            [clojure.tools.cli :refer [cli]]
            [clojure.string :refer [split trim capitalize]]
            [clojure.tools.logging :as log]))

(defn -main
  [& args]
  (let [[options args banner]
        (cli args
             ["-h" "--help" "Show help" :default false :flag true]
             ["-r" "--rserve" "Start RServe from application" :default false :flag true]
             ["-n" "--nworkers" "Amount of worker threads to start"
              :default (.availableProcessors (Runtime/getRuntime))
              :parse-fn #(Integer. %)]
             ["-m" "--method" "R method name" :default "echo"]
             ["-p" "--packages" "Comma seperated list of additional R packages to load"
              :parse-fn #(split % #",\s?")]
             ["-f" "--file" "R file to execute" :default "resources-dev/pirate/echo.R"])
        method (:method options)
        file (:file options)]
    (when (:help options)
      (println banner)
      (System/exit 0))
    (pirate/initialize (:file options) (:packages options) (:rserve options))
    (tasks/initialize method (:nworkers options) pirate/execute)
    (while true (Thread/sleep 100))))

Update location of echo script

Update location of echo script


;; Contains database-access code

(ns holston.repository
  (:use [clojure.java.jdbc :as jdbc]))

;; If DATABASE_URL environment variable is not set, use
;; local PostgreSQL database on port 5432 named holston
(def db (or (System/getenv "DATABASE_URL")
              "postgresql://localhost:5432/holston"))

(defn add-tasting [tasting]
  (println tasting)
  (jdbc/insert! db :tasting tasting))

(defn get-brewery [name]
  (first (jdbc/query db ["SELECT id, name FROM brewery WHERE name = ?" name])))

(defn add-brewery [name]
  (jdbc/insert! db :brewery {:name name}))

(defn get-beer [name]
  (first (jdbc/query db ["SELECT id, name FROM beer WHERE name = ?" name])))

(defn add-beer [name]
  (jdbc/insert! db :beer {:name name}))

;; Contains database-access code

(ns holston.repository
  (:use [clojure.java.jdbc :as jdbc]))

;; If DATABASE_URL environment variable is not set, use
;; local PostgreSQL database on port 5432 named holston
(def db (or (System/getenv "DATABASE_URL")
              "postgresql://localhost:5432/holston"))

(defn add-tasting [tasting]
  (jdbc/insert! db :tasting tasting))

(defn get-brewery [name]
  (first (jdbc/query db ["SELECT id, name FROM brewery WHERE name = ?" name])))

(defn add-brewery [name]
  (jdbc/insert! db :brewery {:name name}))

(defn get-beer [name]
  (first (jdbc/query db ["SELECT id, name FROM beer WHERE name = ?" name])))

(defn add-beer [name]
  (jdbc/insert! db :beer {:name name}))

(defn db-sanity-check []
  (str "Static query from DB value: " (:?column? (first (jdbc/query db
           ["select 'foobar'"])))))

Remove println and add sanity-check

Remove println and add sanity-check


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

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

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

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

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

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

Test request spec with embedded empty request spec