(defproject uruk "0.3.7"
  :description "Clojure wrapper of MarkLogic XML Content Connector For Java (XCC/J)"
  :url "https://github.com/daveliepmann/uruk"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [com.marklogic/marklogic-xcc "9.0.20170113"]
                 ;; required but not included by MarkLogic (e.g. for ContentFactory):
                 [com.fasterxml.jackson.core/jackson-databind "2.6.3"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/data.xml "0.1.0-beta2"]
                 [slingshot "0.12.2"]]
  :checksum :warn ;; TODO remove this workaround -- MarkLogic's Maven repo doesn't have checksums?
  :repositories [["MarkLogic-releases" "http://developer.marklogic.com/maven2"]])

(defproject uruk "0.3.7"
  :description "Clojure wrapper of MarkLogic XML Content Connector For Java (XCC/J)"
  :url "https://github.com/daveliepmann/uruk"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [com.marklogic/marklogic-xcc "9.0.1"]
                 ;; required but not included by MarkLogic (e.g. for ContentFactory):
                 [com.fasterxml.jackson.core/jackson-databind "2.6.3"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/data.xml "0.1.0-beta2"]
                 [slingshot "0.12.2"]]
  :checksum :warn ;; TODO remove this workaround -- MarkLogic's Maven repo doesn't have checksums?
  :repositories [["MarkLogic-releases" "http://developer.marklogic.com/maven2"]])

Bump to public release of XCC for ML 9

Bump to public release of XCC for ML 9


(defproject io.replikativ/konserve "0.3.0-beta1"
  :description "Durable cross-platform key-value store protocol with core.async."
  :url "http://github.com/replikativ/konserve"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :source-paths ["src"]
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.48"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                 [io.replikativ/incognito "0.1.1"]]

  :plugins [[lein-cljsbuild "1.0.6"]]

  :profiles {:dev {:plugins [[com.cemerick/austin "0.1.6"]]}}

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

(defproject io.replikativ/konserve "0.3.0-beta2"
  :description "Durable cross-platform key-value store protocol with core.async."
  :url "http://github.com/replikativ/konserve"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :source-paths ["src"]
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.48"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                 [io.replikativ/incognito "0.1.2"]]

  :plugins [[lein-cljsbuild "1.0.6"]]

  :profiles {:dev {:plugins [[com.cemerick/austin "0.1.6"]]}}

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

Use safe incognito set reader.

Use safe incognito set reader.


(defproject funcool/promesa "1.2.0"
  :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.8.51" :scope "provided"]
                 [funcool/cats "1.2.1" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src" "assets"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]
  :codeina {:sources ["src"]
            :reader :clojure
            :target "doc/dist/latest/api"}
  :plugins [[funcool/codeina "0.3.0"]
            [lein-ancient "0.6.7" :exclusions [org.clojure/tools.reader]]])

(defproject funcool/promesa "1.2.0"
  :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.36" :scope "provided"]]
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}
  :source-paths ["src" "assets"]
  :test-paths ["test"]
  :jar-exclusions [#"\.swp|\.swo|user.clj"]
  :codeina {:sources ["src"]
            :reader :clojure
            :target "doc/dist/latest/api"}
  :plugins [[funcool/codeina "0.3.0"]
            [lein-ancient "0.6.7" :exclusions [org.clojure/tools.reader]]])

Update cljs compiler to 1.9.36

Update cljs compiler to 1.9.36


(ns clj-spotify.test-utils
  (:require
            [clojure.data.json :as json]
            [clojure.data :as data]
            [clj-http.client :as client]
            [clojure.data.codec.base64 :as b64]
            ))

(def enc-auth-string
  (str "Basic "
  (->
    (str (System/getenv "SPOTIFY_CLIENT_ID") ":" (System/getenv "SPOTIFY_SECRET_TOKEN"))
    (.getBytes)
    (b64/encode)
    (String. "UTF-8"))))

(defonce spotify-oauth-token (->
                           "https://accounts.spotify.com/api/token"
                           (client/post {:form-params {:grant_type "client_credentials"} :headers {:Authorization enc-auth-string}})
                           :body
                           (json/read-str :key-fn keyword)
                           :access_token))

(defn reset-volatile-vals
  "Function to reset values that change over time such as amount of followers or popularity ranking."
  [k v]
  (condp
    :followers {:href nil, :total 0}
    :popularity 0
    :total 0
    :snapshot_id "123456"
    (and (string? v) (.contains v "scdn.co")) "https://scdn.co/preview/ref"
    :else v))

 (defn test-json-string-to-map [s]
  "Read string and transform to json but ignore certain keys."
  (json/read-str s :value-fn reset-volatile-vals :key-fn keyword))

(ns clj-spotify.test-utils
  (:require
            [clojure.data.json :as json]
            [clj-http.client :as client]
            ))

(defonce spotify-oauth-token
  (-> "https://accounts.spotify.com/api/token"
      (client/post {:form-params {:grant_type "client_credentials"}
                    :basic-auth [(System/getenv "SPOTIFY_CLIENT_ID")
                                 (System/getenv "SPOTIFY_SECRET_TOKEN")]
                    :as :json})
      :body
      :access_token))

(defn reset-volatile-vals
  "Function to reset values that change over time such as amount of followers or popularity ranking."
  [k v]
  (condp
    :followers {:href nil, :total 0}
    :popularity 0
    :total 0
    :snapshot_id "123456"
    (and (string? v) (.contains v "scdn.co")) "https://scdn.co/preview/ref"
    :else v))

 (defn test-json-string-to-map [s]
  "Read string and transform to json but ignore certain keys."
  (json/read-str s :value-fn reset-volatile-vals :key-fn keyword))

Simplify Basic auth and json parsing in test-utils/spotify-oauth-token


(ns comic-reader.comic-repository)

(defprotocol ComicRepository
  (list-sites         [this] "List all the comic sites available from this repository.")
  (list-comics        [this site] "List all the comics available on this site.")
  (previous-locations [this site comic-id location n] "Get up-to n locations that precede `location' in a comic.")
  (next-locations     [this site comic-id location n] "Get up-to n locations that follow `location' in a comic.")
  (image-tag          [this site location] "Get the hiccup image tag for this comic location."))

(defprotocol WritableComicRepository
  (store-sites [this sites] "Store a seq of site records.")
  (store-comics [this site-id comics] "Store a seq of comic records.")
  (store-locations [this site-id comic-id locations] "Store a seq of location records."))

(ns comic-reader.comic-repository)

(defprotocol ComicRepository
  (list-sites         [this] "List all the comic sites available from this repository.")
  (list-comics        [this site-id] "List all the comics available on this site.")
  (previous-locations [this site-id comic-id location n] "Get up-to n locations that precede `location' in a comic.")
  (next-locations     [this site-id comic-id location n] "Get up-to n locations that follow `location' in a comic.")
  (image-tag          [this site-id location] "Get the hiccup image tag for this comic location."))

(defprotocol WritableComicRepository
  (store-sites [this sites] "Store a seq of site records.")
  (store-comics [this site-id comics] "Store a seq of comic records.")
  (store-locations [this site-id comic-id locations] "Store a seq of location records."))

Use site-id in ComicRepository protocol method arguments


(ns user
  (:use
    speclj.config
    io.aviso.tracker
    io.aviso.repl
    clojure.pprint
    [io.aviso.twixt :only [get-asset-uris default-options]]
    io.aviso.twixt.startup
    ring.adapter.jetty)
  (:require
    ;; See https://github.com/slagyr/speclj/issues/79
    speclj.run.standard))

(install-pretty-exceptions)

(alter-var-root #'default-config assoc :color true :reporters ["documentation"])

(defn handler
  [request]
  (track "Invoking handler (that throws exceptions)"
         (if (= (:uri request) "/fail")
           ;; This will fail at some depth:
           (doall
             (get-asset-uris (:twixt request) "invalid-coffeescript.coffee")))))

(defn app
  []
  (wrap-with-twixt handler default-options true))

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

(ns user
  (:use speclj.config
        io.aviso.tracker
        io.aviso.repl
        clojure.pprint
        [io.aviso.twixt :only [get-asset-uris default-options]]
        io.aviso.exception
        io.aviso.twixt.startup
        ring.adapter.jetty)
  ;; See https://github.com/slagyr/speclj/issues/79
  (:require speclj.run.standard))

(install-pretty-exceptions)

(alter-var-root #'*default-frame-filter*
                (fn [default-frame-filter]
                  (fn [frame]
                    (if (= (:package frame) "speclj")
                      :terminate
                      (default-frame-filter frame)))))

(alter-var-root #'default-config assoc :color true :reporters ["documentation"])

(defn handler
  [request]
  (track "Invoking handler (that throws exceptions)"
         (if (= (:uri request) "/fail")
           ;; This will fail at some depth:
           (doall
             (get-asset-uris (:twixt request) "invalid-coffeescript.coffee")))))

(defn app
  []
  (wrap-with-twixt handler default-options true))

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

Terminate stack traces at any "speclj" namespace


(set-env!
  :dependencies '[[org.clojure/clojure "1.6.0"]
                  [boot-jruby "0.2.0"]]
  :source-paths #{"resources"})

(require
  '[clojure.java.io :as io]
  '[boot.jruby :refer [jruby make-jruby]])

(deftask haml
  "convert haml to html"
  []
  (let [jrb (make-jruby)]
    (with-pre-wrap fileset
      (jrb fileset
           ;; installs the haml gem, unless it's already installed
           :gem [["haml" "4.0.5"]]
           ;; sets data from clojure in the ruby runtime, as globals
           :set-var {"$haml_files" (->> fileset input-files (by-ext [".haml"]) (mapv #(.getAbsolutePath (tmpfile %))))
                     "$data"       {:what_the "nuts"}}
           ;; evaluates resources/render_haml.rb, that does the actual work
           :eval-file [(-> "render_haml.rb" io/resource io/file .getAbsolutePath)]))))

(deftask show-files
  "A debug task to println any files with :ext in the fileset"
  [e ext PATH [str] "extensions to show"]
  (with-pre-wrap fileset
    (doseq [:let [out-f (output-files fileset)]
            f (if (seq ext) (by-ext ext out-f) out-f)]
      (println (str "\n" (tmppath f) ":\n\n")
        (slurp (tmpfile f))))
    fileset))

(set-env!
  :dependencies '[[org.clojure/clojure "1.6.0"]
                  [boot-jruby "0.2.0"]]
  :source-paths #{"resources"})

(require
  '[clojure.java.io :as io]
  '[boot.jruby :refer [jruby make-jruby]])

(deftask haml
  "convert haml to html"
  []
  (let [jrb (make-jruby)]
    (with-pre-wrap fileset
      (jrb fileset
           ;; installs the haml gem, unless it's already installed
           :gem [["haml" "4.0.5"]]
           ;; sets data from clojure in the ruby runtime, as globals
           :set-var {"$haml_files" (->> fileset input-files (by-ext [".haml"]) (mapv #(.getAbsolutePath (tmpfile %))))
                     "$data"       {:what_the "nuts"}}
           ;; evaluates resources/render_haml.rb, that does the actual work
           :eval-file [(-> "render_haml.rb" io/resource io/file .getAbsolutePath)]))))

(deftask show-files
  "A debug task to println any files with :ext in the fileset"
  [e ext PATH [str] "extensions to show"]
  (with-pre-wrap fileset
    (doseq [:let [out-f (->> [user-files input-files output-files]
                          (mapcat #(% fileset))
                          set)]
            f (if (seq ext) (by-ext ext out-f) out-f)]
      (println (str "\n" (tmppath f) ":\n\n")
        (slurp (tmpfile f))))
    fileset))

Update show-files task to show input and user files as well.


(ns toucan.util
  "Utility functions used by other Toucan modules."
  (:require [clojure.string :as s])
  (:import java.util.Locale))

(defn keyword->qualified-name
  "Return keyword K as a string, including its namespace, if any (unlike `name`).

     (keyword->qualified-name :type/FK) -> \"type/FK\""
  [k]
  (when k
    (s/replace (str k) #"^:" "")))

(defn lower-case
  "Locale-agnostic version of `clojure.string/lower-case`.
  `clojure.string/lower-case` uses the default locale in conversions, turning
  `ID` into `ıd`, in the Turkish locale. This function always uses the
  `Locale/US` locale."
  [s]
  (.. s toString (toLowerCase (Locale/US))))

(ns toucan.util
  "Utility functions used by other Toucan modules."
  (:require [clojure.string :as s])
  (:import java.util.Locale))

(defn keyword->qualified-name
  "Return keyword K as a string, including its namespace, if any (unlike `name`).

     (keyword->qualified-name :type/FK) -> \"type/FK\""
  [k]
  (when k
    (s/replace (str k) #"^:" "")))

(defn lower-case
  "Locale-agnostic version of `clojure.string/lower-case`.
  `clojure.string/lower-case` uses the default locale in conversions, turning
  `ID` into `ıd`, in the Turkish locale. This function always uses the
  `Locale/US` locale."
  [^CharSequence s]
  (.. s toString (toLowerCase (Locale/US))))

Tag parameter `s` as `CharSequence`

Tag parameter `s` as `CharSequence`


(ns funnel-front.actions.app-actions

  (:use [funnel-front.lib.helpers :only [clog!]]
        [funnel-front.stores.main-store :only [app-state]]))

(defn update-app-state [event]
  (let [data (.parse js/JSON (.-data event))
        queries (.-query_ids data)
        body (.parse js/JSON (.-body data))]
    (.log js/console data)
    (swap! app-state
           update-in
           [:queries (keyword (first queries)) :items]
           conj {:body body})))

(ns funnel-front.actions.app-actions

  (:use [funnel-front.lib.helpers :only [clog!]]
        [funnel-front.stores.main-store :only [app-state]]))

(defn update-app-state [event]
  (let [data (.parse js/JSON (.-data event))
        queries (.-queries data)
        body (.parse js/JSON (.-body data))]
    (.log js/console data)
    (.log js/console "first match :" (.-id (first queries)))
    (swap! app-state
           update-in
           [:queries (keyword (.-id (first queries))) :items]
           conj {:body (js->clj body)})
    (.log js/console @app-state)
    ))

Use new data format for sse data and translate them to clojure data


(ns comic-reader.system
  (:require [clojure.tools.namespace.repl :refer [refresh]]
            [comic-reader.server :as server]
            [comic-reader.sites :as sites]
            [com.stuartsierra.component :as component]
            [environ.core :refer [env]]))

(defn comic-reader-system [config-options]
  (let [{:keys [app port]} config-options]
    (component/system-map
     :site-scraper (sites/new-site-scraper)
     :server       (component/using
                    (server/new-server app port)
                    [:site-scraper]))))

(def system nil)

(defn init [config-options]
  (alter-var-root #'system
    (constantly (comic-reader-system config-options))))

(defn start []
  (alter-var-root #'system component/start))

(defn stop []
  (alter-var-root #'system
    (fn [s] (when s (component/stop s)))))

(defn go [config-options]
  (init config-options)
  (start))

(defn reset []
  (stop)
  (refresh :after 'comic-reader.system/-main))

(defn -main [& [port]]
  (let [port (Integer. (or port (env :port) 10555))]
    (go {:app server/app
         :port port})))

(ns comic-reader.system
  (:require [clojure.tools.namespace.repl :refer [refresh]]
            [comic-reader.server :as server]
            [comic-reader.sites :as sites]
            [com.stuartsierra.component :as component]
            [environ.core :refer [env]]))

(defn comic-reader-system [config-options]
  (let [{:keys [app port]} config-options]
    (component/system-map
     :site-scraper (sites/new-site-scraper)
     :server       (component/using
                    (server/new-server app port)
                    [:site-scraper]))))

(def system nil)

(defn init [config-options]
  (alter-var-root #'system
    (constantly (comic-reader-system config-options))))

(defn start []
  (alter-var-root #'system component/start))

(defn stop []
  (alter-var-root #'system
    (fn [s] (when s (component/stop s)))))

(defn go [& [port]]
  (let [port (Integer. (or port (env :port) 10555))]
    (init {:app server/app
           :port port})
    (start)))

(defn reset []
  (stop)
  (refresh :after 'comic-reader.system/go))

(defn -main [& args]
  (apply go args))

Move default port calculation to `go` fn


(ns nth-prime)

(defn sqrt
  "Wrapper around java's sqrt method."
  [number]
  (int (Math/ceil (Math/sqrt number))))

(defn divides?
  "Helper function to decide if a number is evenly divided by divisor."
  [number divisor]
  (zero? (mod number divisor)))

(defn- prime-by-trial-division?
  "Simple trial division prime check."
  [number]
  (empty? (for [n (range 3 (inc (sqrt number)) 2) :when (divides? number n)] n)))

(defn prime? [number]
  (cond
    (= 2 number) true
    (even? number) false
    :else (prime-by-trial-division? number)))

(defn next-prime [start]
  (loop [n (inc start)]
    (if (prime? n)
      n
      (recur (inc n)))))

(defn nth-prime [index]
  (when (not (pos? index))
    (throw (IllegalArgumentException. "nth-prime expects a positive integer for an argument")))
  (loop [cur-prime 2
         num-times 1]
    (if (= num-times index)
      cur-prime
      (recur (next-prime cur-prime) (inc num-times)))))

(ns nth-prime)

(defn sqrt
  "Wrapper around java's sqrt method."
  [number]
  (int (Math/ceil (Math/sqrt number))))

(defn divides?
  "Helper function to decide if a number is evenly divided by divisor."
  [number divisor]
  (zero? (mod number divisor)))

(defn- prime-by-trial-division?
  "Simple trial division prime check."
  [number]
  (empty? (for [n (range 3 (inc (sqrt number)) 2) :when (divides? number n)] n)))

(defn prime? [number]
  (cond
    (= 2 number) true
    (even? number) false
    :else (prime-by-trial-division? number)))

(defn next-prime [start]
  (loop [n (inc start)]
    (if (prime? n)
      n
      (recur (inc n)))))

(def primes (iterate next-prime 1))

(defn nth-prime [index]
  (when (not (pos? index))
    (throw (IllegalArgumentException. "nth-prime expects a positive integer for an argument")))
  (nth primes index))

Replace loop-recur with iterate in nth-prime

In order to make a simple lazy seq, this commit wraps next-prime in an
interate call. Then nth-prime is as simple as calling nth on the primes
var.


(ns com.wsscode.pathom.diplomat.http.clj-http
  (:require [clj-http.client :as client]
            [com.wsscode.pathom.diplomat.http :as http]
            [clojure.spec.alpha :as s]))

(defn request [req]
  (s/assert ::http/request req)
  (client/request req))

(s/fdef request
  :args (s/cat :request ::http/request)
  :ret ::http/response)

(ns com.wsscode.pathom.diplomat.http.clj-http
  (:require [clj-http.client :as client]
            [com.wsscode.pathom.diplomat.http :as http]
            [clojure.spec.alpha :as s]))

; TODO not working at this point, will be implemented later

(defn request [req]
  (s/assert ::http/request req)
  (client/request req))

(s/fdef request
  :args (s/cat :request ::http/request)
  :ret ::http/response)

Add note about clj http implementation of http


(ns adzerk.boot-cljs.util
  (:require [clojure.java.io :as io]
            [clojure.string :as string]))

(defn path->js
  "Given a path to a CLJS namespace source file, returns the corresponding
  Google Closure namespace name for goog.provide() or goog.require()."
  [path]
  (-> path
      (string/replace #"\.clj[s|c]$" "")
      (string/replace #"[/\\]" ".")))

(defn path->ns
  "Given a path to a CLJS namespace source file, returns the corresponding
  CLJS namespace name."
  [path]
  (-> (path->js path) (string/replace #"_" "-")))

(defn get-name
  [path-or-file]
  (-> path-or-file io/file .getName))

(defn path [& parts]
  (.getPath (apply io/file parts)))

(ns adzerk.boot-cljs.util
  (:require [clojure.java.io :as io]
            [clojure.string :as string]))

(defn path->js
  "Given a path to a CLJS namespace source file, returns the corresponding
  Google Closure namespace name for goog.provide() or goog.require()."
  [path]
  (-> path
      (string/replace #"\.clj([s|c])?$" "")
      (string/replace #"[/\\]" ".")))

(defn path->ns
  "Given a path to a CLJS namespace source file, returns the corresponding
  CLJS namespace name."
  [path]
  (-> (path->js path) (string/replace #"_" "-")))

(defn get-name
  [path-or-file]
  (-> path-or-file io/file .getName))

(defn path [& parts]
  (.getPath (apply io/file parts)))

Add clj support for path->ns

Add clj support for path->ns


(defproject dropwizard-clojure/dropwizard-clojure "0.1.1"
  :description "Dropwizard for Clojure"
  :url "https://github.com/stevensurgnier/dropwizard-clojure"
  :license {:name "Apache License 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.3.1"]
                 [io.dropwizard/dropwizard-core "0.7.1"]]
  :source-paths ["src/main/clojure"]
  :test-paths ["src/test/clojure"]
  :profiles {:uberjar {:aot :all}}
  :global-vars {*warn-on-reflection* true})

(defproject dropwizard-clojure/dropwizard-clojure "0.2.0"
  :description "Dropwizard for Clojure"
  :url "https://github.com/stevensurgnier/dropwizard-clojure"
  :license {:name "Apache License 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.3.1"]
                 [io.dropwizard/dropwizard-core "0.8.2"]]
  :source-paths ["src/main/clojure"]
  :test-paths ["src/test/clojure"]
  :profiles {:uberjar {:aot :all}}
  :global-vars {*warn-on-reflection* true})

Update dropwizard to v0.8.2, bump minor version


(meditations
  "There is a wide range of ways to generate a sequence"
  (= __ (range 1 5))

  "The range starts at the beginning by default"
  (= __ (range 5))

  "It's important to only take what you need from a big sequence"
  (= [0 1 2 3 4 5 6 7 8 9]
     (take __ (range 100)))

  "You can also limit results by dropping what you don't need"
  (= [95 96 97 98 99]
     (drop __ (range 100)))

  "Iteration provides an infinite lazy sequence"
  (= __ (take 20 (iterate inc 0)))

  "Repetition is key"
  (= [:a :a :a :a :a :a :a :a :a :a ]
     (repeat 10 __))

  "Iteration can be used for repetition"
  (= (repeat 100 :foo)
     (take 100 (iterate ___ :foo))))

(meditations
  "There is a wide range of ways to generate a sequence"
  (= '(1 2 3 4) (range 1 5))

  "The range starts at the beginning by default"
  (= '(0 1 2 3 4) (range 5))

  "It's important to only take what you need from a big sequence"
  (= [0 1 2 3 4 5 6 7 8 9]
     (take 10 (range 100)))

  "You can also limit results by dropping what you don't need"
  (= [95 96 97 98 99]
     (drop 95 (range 100)))

  "Iteration provides an infinite lazy sequence"
  (= (range 0 20) (take 20 (iterate inc 0)))

  "Repetition is key"
  (= [:a :a :a :a :a :a :a :a :a :a ]
     (repeat 10 :a))

  "Iteration can be used for repetition"
  (= (repeat 100 :foo)
     (take 100 (iterate identity :foo))))

Complete lazy sequences koans test

Complete lazy sequences koans test


{:dev
 {:aliases {"test-all" ["with-profile" "dev,1.7:dev" "test"]}
  :dependencies [[com.nimbusds/nimbus-jose-jwt "4.13.1"]]
  :codeina {:sources ["src"]
            :reader :clojure
            :target "doc/dist/latest/api"
            :src-uri "http://github.com/funcool/buddy-core/blob/master/"
            :src-uri-prefix "#L"}
  :plugins [[funcool/codeina "0.4.0"]
            [lein-ancient "0.6.10"]]}
 :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}

{:dev
 {:aliases {"test-all" ["with-profile" "dev,1.7:dev,1.8:dev" "test"]}
  :dependencies [[com.nimbusds/nimbus-jose-jwt "4.13.1"]]
  :codeina {:sources ["src"]
            :reader :clojure
            :target "doc/dist/latest/api"
            :src-uri "http://github.com/funcool/buddy-core/blob/master/"
            :src-uri-prefix "#L"}
  :plugins [[funcool/codeina "0.4.0"]
            [lein-ancient "0.6.10"]]}
 :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
 :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}

Add clojure 1.8 to the test suite.

Add clojure 1.8 to the test suite.


(ns clj-center.core
  (:require [clojure.java.io :as io]
            [clojure.tools.logging :as log]
            [clojure.tools.nrepl.server :refer [start-server]])
  (:gen-class))

(def ^:dynamic *nrepl-file*
  (io/file (System/getProperty "user.home") ".clj-center-nrepl-port"))

(defn -main []
  (let [nrepl-file (io/file *nrepl-file*)
        nrepl-file-str (str *nrepl-file*)
        _ (when (.exists nrepl-file)
            (throw (RuntimeException. (str "file already exists: "
                                           nrepl-file-str))))
        server (start-server)]
    (log/debug server)
    (spit nrepl-file (:port server))
    (log/info "write nrepl port info to file: " nrepl-file-str)
    (.deleteOnExit nrepl-file)))

(ns clj-center.core
  (:require [clojure.java.io :as io]
            [clojure.tools.logging :as log]
            [clojure.tools.nrepl.server :refer [start-server]])
  (:import (java.nio.file Files attribute.PosixFilePermission))
  (:gen-class))

(def ^:dynamic *nrepl-file*
  (io/file (System/getProperty "user.home") ".clj-center-nrepl-port"))

(defn -main []
  (let [nrepl-file (io/file *nrepl-file*)
        nrepl-file-str (str *nrepl-file*)
        _ (when (.exists nrepl-file)
            (throw (RuntimeException. (str "file already exists: "
                                           nrepl-file-str))))
        server (start-server)]
    (log/debug server)
    (spit nrepl-file (:port server))
    (try
      (Files/setPosixFilePermissions (.toPath nrepl-file)
                                     #{PosixFilePermission/OWNER_READ
                                       PosixFilePermission/OWNER_WRITE})
      (catch UnsupportedOperationException _))
    (log/info "write nrepl port info to file: " nrepl-file-str)
    (.deleteOnExit nrepl-file)))

Change permission of nrepl port file

Change permission of nrepl port file


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

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

Use the 0.1.0 of guten-tag

Use the 0.1.0 of guten-tag


(defproject trotter "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [com.palletops/pallet "0.8.0-RC.9"]
                 [com.palletops/pallet-jclouds "1.7.3"]
                 [org.apache.jclouds.provider/rackspace-cloudservers-us "1.8.0"]]
  :profiles {:dev {:plugins [[com.palletops/pallet-lein "0.8.0-alpha.1"]]}})

(defproject trotter "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [com.palletops/pallet "0.8.0-RC.9"]
                 [com.palletops/pallet-jclouds "1.7.3"]
                 [org.apache.jclouds.provider/rackspace-cloudservers-us "1.8.0"]
                 [compojure "1.1.8"]
                 [ring/ring-core "1.3.0"]
                 [ring/ring-jetty-adapter "1.3.0"]
                 [ring/ring-json "0.3.1"]]
  :profiles {:dev {:plugins [[com.palletops/pallet-lein "0.8.0-alpha.1"]]}})

Add some compojure and ring for good measure


(defproject fault "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"}
  :profiles {:dev {:dependencies [[junit/junit "4.11"]
                                  [org.mockito/mockito-core "1.10.8"]]
                   :junit ["test/java"]
                   :java-source-paths ["src/java" "test/java"]
                   :plugins [[lein-junit "1.1.3"]]
                   :junit-formatter "brief"}}
  :javac-target "1.7"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [criterium "0.4.3"]]
  :java-source-paths ["src/java"])

(defproject fault "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"}
  :profiles {:dev {:dependencies [[junit/junit "4.11"]
                                  [org.mockito/mockito-core "1.10.8"]]
                   :junit ["test/java"]
                   :java-source-paths ["src/java" "test/java"]
                   :plugins [[lein-junit "1.1.3"]]
                   :junit-formatter "brief"}}
  :javac-target "1.7"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [criterium "0.4.3"]]
  :source-paths ["src/clojure"]
  :java-source-paths ["src/java"])

Make sure that the clojure source is included


(defproject lein-difftest "1.3.2-SNAPSHOT"
  :description "Run tests, display better test results."
  :dependencies [[org.clojars.brenton/difform "1.1.0"]
                 [clj-stacktrace "0.2.0" :exclusions [org.clojure/clojure]]
                 [clansi "1.0.0"]]
  :hooks [leiningen.hooks.difftest]
  :test-path "test-fail")

(defproject lein-difftest "1.3.2-SNAPSHOT"
  :description "Run tests, display better test results."
  :dependencies [[org.clojars.brenton/difform "1.1.1"]
                 [clj-stacktrace "0.2.0" :exclusions [org.clojure/clojure]]
                 [clansi "1.0.0" :exclusions [org.clojure/clojure]]]
  :dev-dependencies [[org.clojure/clojure "1.2.0"]
                     [org.clojure/clojure-contrib "1.2.0"]]
  :hooks [leiningen.hooks.difftest]
  :test-path "test-fail")

Update to latest difform. Add clojure 1.2 as a dev dependency.


(defproject org.onyxplatform/onyx-metrics "0.8.0.3"
  :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.0"]
                                  [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.0.4-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.0"]
                                  [riemann-clojure-client "0.4.1"]]
                   :plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}})

Prepare for next release cycle.

Prepare for next release cycle.


(defproject overtone "0.7.0-SNAPSHOT"
  :description "Programmable Music."
  :url "http://project-overtone.org"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/core.incubator "0.1.0"]
                 [org.clojure/data.json "0.1.2"]
                 [overtone/scsynth-jna "0.1.2-SNAPSHOT"]
                 [overtone/at-at "0.2.1"]
                 [overtone/osc-clj "0.7.1"]
                 [overtone/byte-spec "0.3.1"]
                 [overtone/midi-clj "0.2.1"]
                 [clj-glob "1.0.0"]
                 [org.clojure/core.match "0.2.0-alpha6"]
                 [seesaw "1.3.1-SNAPSHOT"]]
  :jvm-opts ["-Xms256m" "-Xmx1g" "-XX:+UseConcMarkSweepGC"])

(defproject overtone "0.7.0-SNAPSHOT"
  :description "Programmable Music."
  :url "http://project-overtone.org"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/core.incubator "0.1.0"]
                 [org.clojure/data.json "0.1.2"]
                 [overtone/scsynth-jna "0.1.2-SNAPSHOT"]
                 [overtone/at-at "0.2.1"]
                 [overtone/osc-clj "0.7.1"]
                 [overtone/byte-spec "0.3.1"]
                 [overtone/midi-clj "0.2.1"]
                 [clj-glob "1.0.0"]
                 [org.clojure/core.match "0.2.0-alpha6"]
                 [seesaw "1.4.0"]]
  :jvm-opts ["-Xms256m" "-Xmx1g" "-XX:+UseConcMarkSweepGC"])

Use Seesaw 1.4.0. No more SNAPSHOT for the time being.


(defproject me.arrdem/oxcart (slurp "VERSION")
  :description "An experimental optimizing compiler for Clojure code"
  :url "http://github.com/arrdem/oxcart"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [
                 [org.clojure/clojure            "1.5.1"]
                 [org.clojure/tools.analyzer     "0.2.2"]
                 [org.clojure/tools.analyzer.jvm "0.2.2"]
                 [org.clojure/tools.emitter.jvm  "0.0.1-SNAPSHOT"]
                 [org.clojure/tools.reader       "0.8.5"]
                 [com.taoensso/timbre            "3.2.1"]
                 ]
  :injections [(set! *print-length* 10)
               (set! *print-level*  10)])

(defproject me.arrdem/oxcart (slurp "VERSION")
  :description "An experimental optimizing compiler for Clojure code"
  :url "http://github.com/arrdem/oxcart"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [
                 [org.clojure/clojure            "1.5.1"]
                 [org.clojure/tools.analyzer     "0.2.3"]
                 [org.clojure/tools.analyzer.jvm "0.2.2"]
                 [org.clojure/tools.emitter.jvm  "0.0.1-SNAPSHOT"]
                 [org.clojure/tools.reader       "0.8.5"]
                 [com.taoensso/timbre            "3.2.1"]
                 ]
  :whitelist #"oxcart"
  :injections [(set! *print-length* 10)
               (set! *print-level*  10)])

Fix my radagast pattern & bump dep versions


(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"]
                 [robert/hooke "1.3.0"]
                 [me.raynes/cegdown "0.1.0"]
                 [org.clojure/java.classpath "0.2.0"]
                 [org.clojure/tools.namespace "0.2.4"]
                 [org.clojure/tools.cli "0.2.4"]
                 [clj-time "0.5.1"]
                 [com.taoensso/timbre "2.6.1"]
                 [com.ryanmcg/stefon "0.5.1"]]
  :profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
  :plugins [[speclj "2.5.0"]]
  :test-paths ["spec/"]
  :main incise.core)

(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.10"]
                 [robert/hooke "1.3.0"]
                 [me.raynes/cegdown "0.1.0"]
                 [org.clojure/java.classpath "0.2.0"]
                 [org.clojure/tools.namespace "0.2.4"]
                 [org.clojure/tools.cli "0.2.4"]
                 [clj-time "0.5.1"]
                 [com.taoensso/timbre "2.6.1"]
                 [com.ryanmcg/stefon "0.5.0"]]
  :profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
  :plugins [[speclj "2.5.0"]]
  :test-paths ["spec/"]
  :main incise.core)

Adjust stefon and http-kit versions.

Adjust stefon and http-kit versions.


(ns {{namespace}}
  (:require [play-clj.core :refer :all]
            [play-clj.ui :refer :all]))

(defscreen main-screen
  :on-show
  (fn [screen entities]
    (update! screen :renderer (stage))
    (label "Hello world!" (color :white)))
  :on-render
  (fn [screen entities]
    (clear!)
    (render! screen entities)))

(defgame {{app-name}}
  :on-create
  (fn [this]
    (set-screen! this main-screen)))

Add line between defscreen functions

Add line between defscreen functions


;; Copyright 2008-2011 Red Hat, Inc, and individual contributors.
;;
;; This is free software; you can redistribute it and/or modify it
;; under the terms of the GNU Lesser General Public License as
;; published by the Free Software Foundation; either version 2.1 of
;; the License, or (at your option) any later version.
;;
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU Lesser General Public
;; License along with this software; if not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.

(ns immutant.registry
  (:import (org.jboss.msc.service ServiceName)))

(def registry nil)

(defn set-registry [v]
  (def registry v))

(defn service [name]
  (if registry
    (let [key (ServiceName/parse name)
          value (.getService registry key)]
      (and value (.getValue value)))))

;; Copyright 2008-2011 Red Hat, Inc, and individual contributors.
;;
;; This is free software; you can redistribute it and/or modify it
;; under the terms of the GNU Lesser General Public License as
;; published by the Free Software Foundation; either version 2.1 of
;; the License, or (at your option) any later version.
;;
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU Lesser General Public
;; License along with this software; if not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.

(ns immutant.registry
  (:import (org.jboss.msc.service ServiceName)))

(def registry nil)

(defn set-registry [v]
  (def registry v))

(defn service [name]
  (if registry
    (let [key (if (string? name) (ServiceName/parse name) name)
          value (.getService registry key)]
      (and value (.getValue value)))))

Allow lookup by ServiceName or String

Allow lookup by ServiceName or String


(ns clojurewerkz.cassaforte.debug-utils
  (:use clojure.stacktrace))

(defmacro output-debug
  "Prints debugging statements out."
  [q]
  `(do
     (println "Built query: " ~q)
     ~q))

(defmacro catch-exceptions
  "Catches driver exceptions and outputs stacktrace."
  [& forms]
  `(try
     (do ~@forms)
     (catch com.datastax.driver.core.exceptions.DriverException ire#
       (println (print-stack-trace ire# 5))
       (println "Error came from server:" (.getMessage ire#)))))

(ns clojurewerkz.cassaforte.debug-utils
  (:use clojure.stacktrace))

(defmacro output-debug
  "Prints debugging statements out."
  [q]
  `(do
     (println "Built query: " ~q)
     ~q))

(defmacro catch-exceptions
  "Catches driver exceptions and outputs stacktrace."
  [& forms]
  `(try
     (do ~@forms)
     (catch com.datastax.driver.core.exceptions.DriverException ire#
       (println (.getMessage ire#))
       (print-cause-trace ire#))))

Improve debug utils as per @michaelklishin ocmment


(defproject {{app-name}} "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[com.badlogicgames.gdx/gdx "0.9.9-SNAPSHOT"]
                 [com.badlogicgames.gdx/gdx-backend-robovm "0.9.9-SNAPSHOT"]]
  :repositories [["sonatype"
                  "https://oss.sonatype.org/content/repositories/snapshots/"]]
  :java-source-paths ["src" "../desktop/src-common"]
  :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
  :ios {:robovm-opts ["-libs" "libs/libObjectAL.a:libs/libgdx.a"
                      "-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation"
                      "-resources" "../desktop/resources/**"]}
  :aot :all
  :main {{ios-namespace}})

(defproject {{app-name}} "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[com.badlogicgames.gdx/gdx "0.9.9-SNAPSHOT"]
                 [com.badlogicgames.gdx/gdx-backend-robovm "0.9.9-SNAPSHOT"]]
  :repositories [["sonatype"
                  "https://oss.sonatype.org/content/repositories/snapshots/"]]
  :java-source-paths ["src" "../desktop/src-common"]
  :javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
  :java-only true
  :ios {:robovm-opts ["-libs" "libs/libObjectAL.a:libs/libgdx.a"
                      "-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation"
                      "-resources" "../desktop/resources/**"]}
  :aot :all
  :main {{ios-namespace}})

Add :java-only to Java game template

Add :java-only to Java game template


(ns clstreams.core
  (:gen-class)
  (:require [clojure.tools.logging :as log]
            [com.stuartsierra.component :as component]
            [signal.handler :as signal]
            [clstreams.pipelines]))

(defn run-system
  [system]
  (let [system-state (atom system)
        stop? (promise)]

    (signal/with-handler :int
      (log/info "Received SIGINT")
      (deliver stop? true))

    (swap! system-state component/start)
    (log/info "Topology initialized successfully")

    @stop?

    (log/info "Stopping topology")
    (swap! system-state component/stop)
    (log/info "Topology stopped")
    (System/exit 0)))

(defn -main
  [func-name]
  (let [system (eval (symbol func-name))]
    (run-system system)))

(ns clstreams.core
  (:gen-class)
  (:require [clojure.tools.logging :as log]
            [com.stuartsierra.component :as component]
            [signal.handler :as signal]
            [clstreams.pipelines]))

(defn run-system
  [system-state-var]
  (let [next-step (promise)
        orig-handlers
        (->
         {}
         (into (for [sgn [:term :int]]
                 [sgn
                  (signal/with-handler sgn
                    (log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
                    (deliver next-step :end))]))
         (into (for [sgn [:hup]]
                 [sgn
                  (signal/with-handler sgn
                    (log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
                    (deliver next-step :restart))])))]

    (log/info "Starting topology")
    (alter-var-root system-state-var component/start)

    (let [ns @next-step]

      (doseq [[sgn orig-handler] orig-handlers]
        (sun.misc.Signal/handle (signal/->signal :int) orig-handler))

      (log/info "Stopping topology")
      (alter-var-root system-state-var component/stop)

      (case ns
        :end (System/exit 0)
        :restart (recur system-state-var)))))

(defn -main
  [func-name]
  (def system-state (eval (symbol func-name)))
  (run-system #'system-state))

Make SIGHUP restart the system and SIGTERM stop it

SIGINT still works to stop the system. The code is now much cleaner
and uses a var in the core namespace to store the system state, so
that it remains globally accessible.


(ns catalog.core
  (:require [catalog.layout
             [dtbook :as layout.dtbook]
             [fop :as layout.fop]]
            [catalog.vubis :as vubis]
            [clojure.java.io :as io]))

(defn neu-im-sortiment [in out]
  (-> in
   vubis/read-file
   vubis/order-and-group
   (layout.fop/document :all-formats)
   (layout.fop/generate-pdf! out)))

(defn neue-grossdruckbücher [in out]
  (-> in
   vubis/read-file
   vubis/order-and-group
   (layout.fop/document :grossdruck)
   (layout.fop/generate-pdf! out)))

(defn neue-hörbücher [in out]
  (-> in
   vubis/read-file
   vubis/order-and-group
   (layout.fop/document :hörbuch)
   (layout.fop/generate-pdf! out)))

(defn neue-braillebücher [in out]
  (->> in
   vubis/read-file
   vubis/order-and-group
   :braille
   layout.dtbook/dtbook
   (spit (io/file out))))

(ns catalog.core
  (:require [catalog.layout
             [dtbook :as layout.dtbook]
             [fop :as layout.fop]]
            [catalog.vubis :as vubis]
            [clojure.java.io :as io]))

(defn neu-im-sortiment [in out]
  (-> in
   vubis/read-file
   vubis/order-and-group
   (layout.fop/document :all-formats)
   (layout.fop/generate-pdf! out)))

(defn neu-in-grossdruck [in out]
  (-> in
   vubis/read-file
   vubis/order-and-group
   (layout.fop/document :grossdruck)
   (layout.fop/generate-pdf! out)))

(defn neu-als-hörbuch [in out]
  (-> in
   vubis/read-file
   vubis/order-and-group
   (layout.fop/document :hörbuch)
   (layout.fop/generate-pdf! out)))

(defn neu-in-braille [in out]
  (->> in
   vubis/read-file
   vubis/order-and-group
   :braille
   layout.dtbook/dtbook
   (spit (io/file out))))

Rename functions to how the catalogs are named


(ns desdemona.launcher.aeron-media-driver
  (:gen-class)
  (:require [clojure.core.async :refer [chan <!!]]
            [clojure.tools.cli :refer [parse-opts]])
  (:import [uk.co.real_logic.aeron Aeron$Context]
           [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context]))

(def cli-options
   ["-h" "--help"]])
  [["-d" "--delete-dirs"
    "Delete the media drivers directory on startup"
    :default false]

(defn -main [& args]
  (let [opts (parse-opts args cli-options)
        {:keys [help delete-dirs]} (:options opts)
        ctx (cond-> (MediaDriver$Context.)
              delete-dirs (.dirsDeleteOnStart delete-dirs))
        media-driver (try (MediaDriver/launch ctx)
                          (catch IllegalStateException ise
                            (throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
    (when help
      (run! (fn [opt]
              (println (clojure.string/join " " (take 3 opt))))
            cli-options)
      (System/exit 0))
    (println "Launched the Media Driver. Blocking forever...")
    (<!! (chan))))

(ns desdemona.launcher.aeron-media-driver
  (:gen-class)
  (:require [clojure.core.async :refer [chan <!!]]
            [clojure.tools.cli :refer [parse-opts]])
  (:import [uk.co.real_logic.aeron Aeron$Context]
           [uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context]))

(def cli-options
  [["-d" "--delete-dirs"
    "Delete the media drivers directory on startup"
    :default false]
   ["-h" "--help"
    "Display a help message"]])

(defn -main [& args]
  (let [opts (parse-opts args cli-options)
        {:keys [help delete-dirs]} (:options opts)
        ctx (cond-> (MediaDriver$Context.)
              delete-dirs (.dirsDeleteOnStart delete-dirs))
        media-driver (try (MediaDriver/launch ctx)
                          (catch IllegalStateException ise
                            (throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
    (when help
      (run! (fn [opt]
              (println (clojure.string/join " " (take 3 opt))))
            cli-options)
      (System/exit 0))
    (println "Launched the Media Driver. Blocking forever...")
    (<!! (chan))))

Add a help message for --help

Add a help message for --help


(ns scrape-trs.core
  (:require [scrape-trs.cascade-climbers.core :as cc]))

(comment
  "TODO:
   - add SPScrapeTripReport
   - upgrade get-trip-reports to return [errors, trip-reports]
     based on try-slurp that returns [error, contents]
   - add docs and tests for get-trip-reports
   - implement save-trip-reports!
   - make scrape-wa-trs project that
       retrieves cc.com tr list pages for each region in WA (POST)
       retrieves sp.com tr list page for WA
       get-trip-reports on each page and concat all together
       save to csv"

  (def cascade-climbers-washington-regions
    #{"Alpine Lakes"
      "Central/Eastern  Washington"
      "Columbia River Gorge"
      "Ice Climbing Forum"
      "Mount Rainier NP"
      "North Cascades"
      "Olympic Peninsula"
      "Rock Climbing Forum"
      "Southern WA Cascades"
      "the *freshiezone*"}))

(defn get-implementation
  [url]
  (let [base-url (re-find #"https?://.*?/" url)]
    (condp = base-url
      cc/base-url (cc/->CCScrapeTripReport))))

(defn get-trip-reports
  ""
  [implementation list-page]
  (let [pager-urls (.extract-pager-urls implementation list-page)
        list-pages (if pager-urls (map slurp pager-urls) [list-page])
        trip-report-urls (mapcat #(.extract-trip-report-urls implementation %)
                                 list-pages)
        trip-reports (map #(.extract-trip-report implementation %1 %2)
                          trip-report-urls
                          (map slurp trip-report-urls))]
    trip-reports))

(defn save-trip-reports!
  ""
  [f trip-reports])

(ns scrape-trs.core
  (:require [scrape-trs.cascade-climbers.core :as cc]
            [scrape-trs.summitpost.core :as sp]))

(defn get-implementation
  [url]
  (let [base-url (re-find #"https?://.*?/" url)]
    (condp = base-url
      cc/base-url (cc/->CCScrapeTripReport)
      sp/base-url (sp/->SPScrapeTripReport))))

(defn get-trip-reports
  ""
  [implementation list-page]
  (let [pager-urls (.extract-pager-urls implementation list-page)
        list-pages (if pager-urls (map slurp pager-urls) [list-page])
        trip-report-urls (mapcat #(.extract-trip-report-urls implementation %)
                                 list-pages)
        trip-reports (map #(.extract-trip-report implementation %1 %2)
                          trip-report-urls
                          (map slurp trip-report-urls))]
    trip-reports))

(defn save-trip-reports!
  ""
  [f trip-reports])

Remove comment and add SPScrapeTripReport to get-implementation.


(ns leiningen.droid.compatibility
  "Contains utilities for letting lein-droid to cooperate with
  ant/Eclipse build tools."
  (:require [clojure.java.io :as io])
  (:use [leiningen.core
         [main :only [info]]
         [classpath :only [resolve-dependencies]]]
        [leiningen.droid.utils :only [ensure-paths]]))

(defn gather-dependencies
  "Compatibility task. Copies the dependency libraries into the libs/ folder."
  [{:keys [root] :as project} & {dir ":dir", :or {dir "libs"} :as other}]
  (println (class (first (keys other))))
  (info "Copying dependency libraries into" (str dir "..."))
  (let [destination-dir (io/file root dir)
        dependencies (resolve-dependencies :dependencies project)]
    (.mkdirs destination-dir)
    (doseq [dep dependencies]
      (io/copy dep
               (io/file destination-dir (.getName ^java.io.File dep))))))

(defn create-repl-port-file
  "Creates a file named `repl-port` in target directory with port
  number inside, so fireplace.vim can connect to the REPL."
  [{{:keys [repl-local-port]} :android, target-path :target-path :as project}]
  (ensure-paths target-path)
  (spit (io/file target-path "repl-port") repl-local-port))

(ns leiningen.droid.compatibility
  "Contains utilities for letting lein-droid to cooperate with
  ant/Eclipse build tools."
  (:require [clojure.java.io :as io])
  (:use [leiningen.core
         [main :only [info]]
         [classpath :only [resolve-dependencies]]]
        [leiningen.droid.utils :only [ensure-paths]]))

(defn gather-dependencies
  "Compatibility task. Copies the dependency libraries into the libs/ folder."
  [{:keys [root] :as project} & {dir ":dir", :or {dir "libs"} :as other}]
  (println (class (first (keys other))))
  (info "Copying dependency libraries into" (str dir "..."))
  (let [destination-dir (io/file root dir)
        dependencies (resolve-dependencies :dependencies project)]
    (.mkdirs destination-dir)
    (doseq [dep dependencies]
      (io/copy dep
               (io/file destination-dir (.getName ^java.io.File dep))))))

(defn create-repl-port-file
  "Creates a file named `.nrepl-port` in project directory with port
  number inside, so that fireplace.vim can connect to the REPL."
  [{{:keys [repl-local-port]} :android, root :root}]
  (spit (io/file root ".nrepl-port") repl-local-port))

Create ".nrepl-port" file instead of "repl-port"


(ns cadence.views.landing
  (:require [cadence.views.common :as common]
            [noir.response :as response]
            [noir.cookies :as cook])
  (:use noir.core
        hiccup.core
        hiccup.page-helpers))

(defpage root "/" []
  (common/layout
    [:h1 "Cadence"]
    [:p "Welcome to cadence"]))

(defpage login "/login" []
  (common/layout
    [:h1 "Login"]
    [:p "WELCOME TO THE LOGIN PAGE!"]
    [:form [:post "/login"]
     [:input "Username"]
     [:input "Password"]
     [:input "Login"]]))

(defpage login-check [:post "/login"] []
  (response/empty {:hello "world"}))

(defpage signup "/signup" []
  (common/layout
    [:h1 "Login"]
    [:p "WELCOME TO THE LOGIN PAGE!"]))

(defpage about "/about" []
  (common/layout
    [:h1 "About"]
    [:p "derpderpderp"]))

(ns cadence.views.landing
  (:require [cadence.views.common :as common]
            [noir.response :as response]
            [noir.cookies :as cook])
  (:use noir.core
        hiccup.core
        hiccup.page-helpers
        hiccup.form-helpers))

(defpage root "/" []
  (common/layout
    [:h1 "Cadence"]
    [:p "Welcome to cadence"]))

(defn alabel [name] (label name name))

(defpartial form-with-labels
  "Returns labels and text fields for each name in the given collection."
  [coll]
  (for [field coll]
    (alabel field)
    ((if ((.toLower field) == "password") password-field text-field) field)))

(defpage login "/login" []
  (common/layout
    [:h1 "Login"]
    [:p "WELCOME TO THE LOGIN PAGE!"]
    (with-group "login"
                (form-to [:post "/login"]
                         (form-with-labels ["Username" "Password"])
                         (submit-button "Login")))))

(defpage login-check [:post "/login"] []
  (response/empty {:hello "world"}))

(defpage signup "/signup" []
  (common/layout
    [:h1 "Login"]
    [:p "WELCOME TO THE LOGIN PAGE!"]))

(defpage about "/about" []
  (common/layout
    [:h1 "About"]
    [:p "derpderpderp"]))

Use form helpers to create login form.

Use form helpers to create login form.


{:user {:signing {:gpg-key "8ED1CE42"}

        :dependencies [[alembic "0.2.1"]
                       [clj-stacktrace "0.2.7"]
                       [criterium "0.4.2"]
                       [org.clojure/tools.namespace "0.2.4"]
                       [slamhound "1.5.3"]
                       [spyscope "0.1.4"]]

        :plugins [[cider/cider-nrepl "0.7.0-SNAPSHOT"]
                  [codox "0.6.6"]
                  [jonase/eastwood "0.1.4"]
                  [lein-ancient "0.5.5" :exclusions [commons-codec]]
                  [lein-cljsbuild "1.0.3"]
                  [lein-clojars "0.9.1"]
                  [lein-cloverage "1.0.2"]
                  [lein-difftest "2.0.0"]
                  [lein-kibit "0.0.8"]
                  [lein-marginalia "0.7.1"]
                  [lein-pprint "1.1.1"]
                  [lein-swank "1.4.4"]]

        :injections [(require
                      '[alembic.still :refer [distill]]
                      '[clojure.repl :refer [source]]
                      '[clojure.tools.namespace.repl :as repl]
                      '[criterium.core :refer [bench quick-bench]]
                      'spyscope.core)]

        :aliases {"slamhound" ["run" "-m" "slam.hound"]}
        :search-page-size 50}}

{:user {:signing {:gpg-key "8ED1CE42"}

        :dependencies [[alembic "0.2.1"]
                       [clj-stacktrace "0.2.7"]
                       [criterium "0.4.2"]
                       [org.clojure/tools.namespace "0.2.4"]
                       [slamhound "1.5.3"]
                       [spyscope "0.1.4"]]

        :plugins [[cider/cider-nrepl "0.7.0"]
                  [codox "0.6.6"]
                  [jonase/eastwood "0.1.4"]
                  [lein-ancient "0.5.5" :exclusions [commons-codec]]
                  [lein-cljsbuild "1.0.3"]
                  [lein-clojars "0.9.1"]
                  [lein-cloverage "1.0.2"]
                  [lein-difftest "2.0.0"]
                  [lein-kibit "0.0.8"]
                  [lein-marginalia "0.7.1"]
                  [lein-pprint "1.1.1"]
                  [lein-swank "1.4.4"]]

        :injections [(require
                      '[alembic.still :refer [distill]]
                      '[clojure.repl :refer [source]]
                      '[clojure.tools.namespace.repl :as repl]
                      '[criterium.core :refer [bench quick-bench]]
                      'spyscope.core)]

        :aliases {"slamhound" ["run" "-m" "slam.hound"]}
        :search-page-size 50}}

Move from SNAPSHOT to cider-nrepl 0.7.0

Move from SNAPSHOT to cider-nrepl 0.7.0


(ns gigrig.components.pedal-search
  (:require [redux.core :refer [dispatch!]]
            [gigrig.actions :as a]))

(defn- search-field [{:keys [handle-change]}]
  [:input {:type "text"
           :placeholder "Search for a pedal"
           :on-change #(handle-change (.. % -target -value))}])

(defn- suggestion [i props]
  ^{:key i} [:li
             [:strong (:model props)]
             (:brand props)])

(defn dropdown [props]
  [:ul
   (map-indexed suggestion (:suggestions props))])

(defn component [props]
  [:div
   [search-field {:handle-change (fn [val] (dispatch! a/searchfield-key-pressed val))}]
   [dropdown (select-keys props [:suggestions])]])

(ns gigrig.components.pedal-search
  (:require [redux.core :refer [dispatch!]]
            [reagent.core :as reagent]
            [gigrig.actions :as a]))

(defn- search-field [{:keys [on-focus on-blur handle-change]}]
  [:input {:type "text"
           :placeholder "Search for a pedal"
           :on-focus on-focus
           :on-blur on-blur
           :on-change #(handle-change (.. % -target -value))}])

(defn- suggestion [i props]
  ^{:key i} [:li
             [:strong (:model props)]
             (:brand props)])

(defn dropdown [props]
  [:ul
   (map-indexed suggestion (:suggestions props))])

(defn component []
  (let [dropdown-visible (reagent/atom false)]
    (fn [props]
      [:div
       [search-field {:on-focus #(do (reset! dropdown-visible true) nil)
                      :on-blur #(do (reset! dropdown-visible false) nil)
                      :handle-change (fn [val] (dispatch! a/searchfield-key-pressed val))}]
       (if @dropdown-visible
         [dropdown (select-keys props [:suggestions])])])))

Hide dropdown when no focus

Hide dropdown when no focus


(ns clojars.unit.certs-test
  (:require [clojure.test :refer [deftest is]]))

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

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

(deftest fail-when-tls-cert-is-about-to-expire
  (let [expire-date #inst "2020-06-17T00:00:00.000-00:00"]
    (is (< (System/currentTimeMillis)
          (- (.getTime expire-date) sixty-days))
      (format "clojars.org TLS cert expires on %s.\nBe sure to give lein a copy of the new one: %s"
        expire-date "https://github.com/technomancy/leiningen/blob/master/leiningen-core/resources/clojars.pem"))))

Remove unneeded TLS cert expiration test

The certs are now managed automatically by AWS.


(ns mikron.runtime.util
  "Generic utility functions."
  (:require [mikron.compiler.util :as compiler.util])
  #?(:cljs (:require-macros [mikron.runtime.util])))

#?(:cljs
   (defn node-env?
     "Returns `true` if compiled for Node.js, `false` otherwise."
     []
     (= "nodejs" cljs.core/*target*)))

(defmacro safe
  "Evaluates each expression of `body` and returns `ex-value` if an exception occured.
  Otherwise returns the value of the last expression in `body`."
  [ex-value & body]
  `(try
     (do ~@body)
     (catch ~(if (compiler.util/cljs?) `js/Object `Throwable) e#
       ~ex-value)))

(ns mikron.runtime.util
  "Generic utility functions."
  (:require [mikron.compiler.util :as compiler.util])
  #?(:cljs (:require-macros [mikron.runtime.util])))

#?(:cljs
   (defn node-env?
     "Returns `true` if compiled for Node.js, `false` otherwise."
     []
     (= "nodejs" cljs.core/*target*)))

(defmacro safe
  "Evaluates each expression of `body` and returns `ex-value` if an exception occured.
  Otherwise returns the value of the last expression in `body`."
  [ex-value & body]
  `(try
     (do ~@body)
     (catch ~(if (compiler.util/cljs?) :default `Throwable) e#
       ~ex-value)))

Change caught js exception type to :default


(ns discuss.utils.extensions
  "Extending JS types to be better accessible in CLJS.")

(def types [js/NodeList
            js/HTMLCollection
            js/HTMLDocument
            js/HTMLDivElement
            js/HTMLParagraphElement
            js/HTMLSpanElement])

(defn extend-type-fn
  "Given a type t, apply extensions."
  [t]
  (extend-type t
    ISeqable
    (-seq [array] (array-seq array 0))
    ICounted
    (-count [a] (alength a))
    IIndexed
    (-nth
      ([array n]
       (if (< n (alength array)) (aget array n)))
      ([array n not-found]
       (if (< n (alength array)) (aget array n)
                                 not-found)))
    ILookup
    (-lookup
      ([array k]
       (aget array k))
      ([array k not-found]
       (-nth array k not-found)))
    IReduce
    (-reduce
      ([array f]
       (ci-reduce array f))
      ([array f start]
       (ci-reduce array f start)))))

(doall (map extend-type-fn types))

(ns discuss.utils.extensions
  "Extending JS types to be better accessible in CLJS.")

(def types [js/NodeList
            js/HTMLCollection
            js/HTMLDocument
            js/HTMLDivElement
            js/HTMLParagraphElement
            js/HTMLSpanElement])

(defn extend-type-fn
  "Given a type t, apply extensions."
  [t]
  (extend-type t
    ISeqable
    (-seq [array] (array-seq array 0))
    ICounted
    (-count [a] (alength a))
    IIndexed
    (-nth
      ([array n]
       (if (< n (alength array)) (aget array n)))
      ([array n not-found]
       (if (< n (alength array)) (aget array n)
                                 not-found)))
    ILookup
    (-lookup
      ([array k]
       (aget array k))
      ([array k not-found]
       (-nth array k not-found)))
    IReduce
    (-reduce
      ([array f]
       (ci-reduce array f))
      ([array f start]
       (ci-reduce array f start)))))

(run! extend-type-fn types)

Replace fn with idiomatic function

Replace fn with idiomatic function


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

;;; --------- Utils Tests ------------

(expect 2
        (+ 1 1))

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

;;; --------- Utils Tests ------------

;; round-double tests
; Four Digits or less
(expect 0.1000
        (round-double 0.1000))
(expect 0.9999
        (round-double 0.9999))

; Over four digits
(expect 0.1
        (round-double 0.100001))
(expect 1.0
        (round-double 0.99999))

;; rand-double tests
(expect true
        (<= 0.0 (rand-double 0 1) 1))
(expect true
        (<= 0.5 (rand-double 0.5 12) 12))
(expect true
        (<= -1.0 (rand-double -1.0 1.0) 1.0))
(expect 0.0
        (rand-double 0 0))

Write tests for util functions

Write tests for util functions


(ns jugsclojure.server
  (:require [clojure.java.io :as io]
            [compojure.core :refer [ANY GET PUT POST DELETE defroutes]]
            [compojure.route :refer [resources]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.gzip :refer [wrap-gzip]]
            [ring.middleware.logger :refer [wrap-with-logger]]
            [environ.core :refer [env]]
            [ring.adapter.jetty :refer [run-jetty]])
  (:gen-class))

(defroutes routes
  (GET "/" _
    {:status 200
     :headers {"Content-Type" "text/html; charset=utf-8"}
     :body (io/input-stream (io/resource "public/index.html"))})
  (resources "/"))

(def http-handler
  (-> routes
      (wrap-defaults api-defaults)
      wrap-with-logger
      wrap-gzip))

(defonce server (atom nil))

(defn restart-server [& [port]]
  (swap! server (fn [value]
                  (when value (.stop value))
                  (run-jetty #'http-handler {:port (or port 10555) :join? false}))))

(defn -main [& [port]]
  (let [port (Integer. (or port (env :port)))]
    (restart-server port)))

(ns jugsclojure.server
  (:require [clojure.java.io :as io]
            [compojure.core :refer [ANY GET PUT POST DELETE defroutes]]
            [compojure.route :refer [resources]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults]]
            [ring.middleware.gzip :refer [wrap-gzip]]
            [ring.middleware.logger :refer [wrap-with-logger]]
            [environ.core :refer [env]]
            [ring.adapter.jetty :refer [run-jetty]])
  (:gen-class))

(defroutes routes
  (GET "/" _
    {:status 200
     :headers {"Content-Type" "text/html; charset=utf-8"}
     :body (io/input-stream (io/resource "public/index.html"))})
  (resources "/"))

(def http-handler
  (-> routes
      (wrap-defaults api-defaults)
      wrap-with-logger
      wrap-gzip))

(defonce server (atom nil))

(defn restart-server [& [port]]
  (swap! server (fn [value]
                  (when value (.stop value))
                  (run-jetty #'http-handler {:port (or port 10555) :join? false}))))

(defn -main [& [port]]
  (let [port (some-> (or port (env :port)) (Integer.))]
    (restart-server port)))

Fix command line port handling

Fix command line port handling


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

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

Update cats dependency to 0.5.0

Update cats dependency to 0.5.0


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject bolt "0.1.0-SNAPSHOT"
  :description "FIXME: write this!"
  :url "http://example.com/FIXME"

  :dependencies [[org.clojure/clojure "1.6.0" :scope "provided"]
                 [org.clojure/clojurescript "0.0-3149" :scope "provided"]
                 [rum "0.2.6"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                 [secretary "1.2.2"]]

  :plugins [[lein-cljsbuild "1.0.5"]]

  :cljsbuild {
              :builds [{:id "dev"
                        :source-paths ["src"]
                        :compiler {:main "bolt.core"
                                   :output-to "resources/public/js/bolt.js"
                                   :output-dir "resources/public/js/out"
                                   :optimizations :none
                                   :source-map true
                                   :warnings {:single-segment-namespace false}
                                   :asset-path "js/out"}}
                       {:id "prod"
                        :source-paths ["src"]
                        :notify-command ["say"]
                        :compiler {:output-to "resources/public/js/bolt.js"
                                   :output-dir "resources/public/js/prod-out"
                                   :optimizations :advanced
                                   :source-map "resources/public/js/bolt.js.map"
                                   :pretty-print false
                                   :asset-path "js/prod-out"
                                   :warnings {:single-segment-namespace false}
                                   :externs ["resources/externs/w3c_speech.js"]}}]})

(defproject bolt "0.1.0-SNAPSHOT"
  :description "FIXME: write this!"
  :url "http://example.com/FIXME"

  :dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
                 [org.clojure/clojurescript "1.7.228" :scope "provided"]
                 [rum "0.2.6"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                 [secretary "1.2.2"]]

  :plugins [[lein-cljsbuild "1.1.2"]]

  :cljsbuild {
              :builds [{:id "dev"
                        :source-paths ["src"]
                        :compiler {:main "bolt.core"
                                   :output-to "resources/public/js/bolt.js"
                                   :output-dir "resources/public/js/out"
                                   :optimizations :none
                                   :source-map true
                                   :warnings {:single-segment-namespace false}
                                   :asset-path "js/out"}}
                       {:id "prod"
                        :source-paths ["src"]
                        :notify-command ["say"]
                        :compiler {:output-to "resources/public/js/bolt.js"
                                   :output-dir "resources/public/js/prod-out"
                                   :optimizations :advanced
                                   :source-map "resources/public/js/bolt.js.map"
                                   :pretty-print false
                                   :asset-path "js/prod-out"
                                   :warnings {:single-segment-namespace false}
                                   :externs ["resources/externs/w3c_speech.js"]}}]})

Use modern clj + cljs versions

Use modern clj + cljs versions


(defproject cljam "0.1.3-SNAPSHOT"
  :description "A DNA Sequence Alignment/Map (SAM) library for Clojure"
  :url "https://chrovis.github.io/cljam"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.2.6"]
                 [org.clojure/tools.cli "0.3.1"]
                 [me.raynes/fs "1.4.5"]
                 [pandect "0.3.2"]
                 [clj-sub-command "0.2.0"]
                 [bgzf4j "0.1.0"]]
  :plugins [[lein-midje "3.1.3"]
            [lein-bin "0.3.4"]
            [lein-marginalia "0.7.1"]]
  :profiles {:dev {:dependencies [[midje "1.6.3"]
                                  [criterium "0.4.3"]
                                  [cavia "0.1.2"]
                                  [primitive-math "0.1.3"]]
                   :global-vars {*warn-on-reflection* true}}}
  :main cljam.main
  :aot [cljam.main]
  :bin {:name "cljam"}
  :repl-options {:init-ns user})

(defproject cljam "0.1.3-SNAPSHOT"
  :description "A DNA Sequence Alignment/Map (SAM) library for Clojure"
  :url "https://chrovis.github.io/cljam"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [org.clojure/tools.logging "0.2.6"]
                 [org.clojure/tools.cli "0.3.1"]
                 [me.raynes/fs "1.4.5"]
                 [pandect "0.3.2"]
                 [clj-sub-command "0.2.0"]
                 [bgzf4j "0.1.0"]]
  :plugins [[lein-midje "3.1.3"]
            [lein-bin "0.3.4"]
            [lein-marginalia "0.7.1"]]
  :profiles {:dev {:dependencies [[midje "1.6.3"]
                                  [criterium "0.4.3"]
                                  [cavia "0.1.3"]
                                  [primitive-math "0.1.3"]]
                   :global-vars {*warn-on-reflection* true}}}
  :main cljam.main
  :aot [cljam.main]
  :bin {:name "cljam"}
  :repl-options {:init-ns user})

Bump cavia version up to 0.1.3

Bump cavia version up to 0.1.3


(defproject twitter-collector "0.1.0-SNAPSHOT"
  :description "A Twitter collector with a Datomic stream."
  :url "https://github.com/replikativ/twitter-collector"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]

                 [io.replikativ/gezwitscher "0.2.0-SNAPSHOT"]
                 [io.replikativ/replikativ "0.2.1"]
                 [employeerepublic/slf4j-timbre "0.4.2"]
                 [com.datomic/datomic-free "0.9.5554"
                  :exclusions [commons-codec]]
                 [incanter "1.5.7"]]

  :main twitter-collector.core)

(defproject twitter-collector "0.1.0-SNAPSHOT"
  :description "A Twitter collector with a Datomic stream."
  :url "https://github.com/replikativ/twitter-collector"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]

                 [io.replikativ/gezwitscher "0.2.0-SNAPSHOT"]
                 [io.replikativ/kabel "0.2.1-SNAPSHOT"]
                 [io.replikativ/replikativ "0.2.1"]
                 [employeerepublic/slf4j-timbre "0.4.2"]
                 [com.datomic/datomic-free "0.9.5554"
                  :exclusions [commons-codec]]
                 [incanter "1.5.7"]]

  :main twitter-collector.core)

Use a kabel version with bigger incoming buffer.


(ns lt.objs.notifos
  (:require [lt.object :as object]
            [lt.objs.statusbar :as statusbar]
            [lt.objs.command :as cmd]
            [lt.util.js :refer [wait]]
            [crate.binding :refer [map-bound bound deref?]])
  (:require-macros [lt.macros :refer [behavior defui]]))

(def standard-timeout 10000)

(defn working [msg]
  (when msg
    (set-msg! msg))
  (statusbar/loader-inc))

(defn done-working
  ([]
   (statusbar/loader-dec))
  ([msg]
   (set-msg! msg)
   (statusbar/loader-dec)))

(defn msg* [m & [opts]]
  (let [m (if (string? m)
            m
            (pr-str m))]
    (object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts))))

(defn set-msg! [msg opts]
  (msg* msg opts)
  (js/clearTimeout cur-timeout)
  (set! cur-timeout (wait standard-timeout #(msg* ""))))

(cmd/command {:command :reset-working
              :desc "Statusbar: Reset working indicator"
              :exec (fn []
                      (statusbar/loader-set 0)
                      )})

(ns lt.objs.notifos
  (:require [lt.object :as object]
            [lt.objs.statusbar :as statusbar]
            [lt.objs.command :as cmd]
            [lt.util.js :refer [wait]]
            [crate.binding :refer [map-bound bound deref?]])
  (:require-macros [lt.macros :refer [behavior defui]]))

(def standard-timeout 10000)

(defn working [msg]
  (when msg
    (set-msg! msg))
  (statusbar/loader-inc))

(defn done-working
  ([]
   (statusbar/loader-dec))
  ([msg]
   (set-msg! msg)
   (statusbar/loader-dec)))

(defn msg* [m & [opts]]
  (let [m (if (string? m)
            m
            (pr-str m))]
    (object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts))))

(defn set-msg!
  ([msg]
   (msg* msg)
   (js/clearTimeout cur-timeout)
   (set! cur-timeout (wait standard-timeout #(msg* ""))))
  ([msg opts]
   (msg* msg opts)
   (js/clearTimeout cur-timeout)
   (set! cur-timeout (wait (or (:timeout opts)
                               standard-timeout) #(msg* "")))))

(cmd/command {:command :reset-working
              :desc "Statusbar: Reset working indicator"
              :exec (fn []
                      (statusbar/loader-set 0)
                      )})

Extend set-msg! with custom timeout

Extend set-msg! with custom timeout

The function notifos/set-msg! accepts a :timeout key/value pair in the opts map
to set a custom timeout.


(defproject nightmod "0.0.1-SNAPSHOT"
  :description "FIXME: write description"

  :dependencies [[com.badlogicgames.gdx/gdx "0.9.9"]
                 [com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"]
                 [com.badlogicgames.gdx/gdx-platform "0.9.9"
                  :classifier "natives-desktop"]
                 [nightcode "0.3.0-SNAPSHOT"]
                 [org.clojure/clojure "1.5.1"]
                 [play-clj "0.2.1-SNAPSHOT"]
                 [seesaw "1.4.4"]]
  :repositories [["sonatype"
                  "https://oss.sonatype.org/content/repositories/snapshots/"]]

  :source-paths ["src" "src-common"]
  :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
  :aot [nightmod.core.desktop-launcher]
  :main nightmod.core.desktop-launcher)

(defproject nightmod "0.0.1-SNAPSHOT"
  :description "FIXME: write description"

  :dependencies [[com.badlogicgames.gdx/gdx "0.9.9"]
                 [com.badlogicgames.gdx/gdx-backend-lwjgl "0.9.9"]
                 [com.badlogicgames.gdx/gdx-platform "0.9.9"
                  :classifier "natives-desktop"]
                 [nightcode "0.3.0-SNAPSHOT"
                  :exclusions [leiningen
                               lein-ancient
                               lein-cljsbuild
                               lein-droid
                               lein-fruit
                               play-clj/lein-template]]
                 [org.clojure/clojure "1.5.1"]
                 [play-clj "0.2.1-SNAPSHOT"]
                 [seesaw "1.4.4"]]
  :repositories [["sonatype"
                  "https://oss.sonatype.org/content/repositories/snapshots/"]]

  :source-paths ["src" "src-common"]
  :javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
  :aot [nightmod.core.desktop-launcher]
  :main nightmod.core.desktop-launcher)

Exclude leiningen stuff to save space

Exclude leiningen stuff to save space


(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 collections don't validate"
    (are [example] (some? (s/check RequestSpec example))
         []
         #{}))
  (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 "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"))})))

Improve tests for empty request specs

Improve tests for empty request specs


(ns clj-gatling.chart-test
  (:use [clojure.test])
  (:require [clojure.java.io :as io]
            [clj-gatling.chart :as chart]))

(defn create-dir [dir]
  (.mkdirs (java.io.File. dir)))

(defn copy-file [source-path dest-path]
  (io/copy (io/file source-path) (io/file dest-path)))

(deftest creates-chart-from-simulation-file
  (create-dir "target/test-results/input")
  (copy-file "test/simulation.log" "target/test-results/input/simulation.log")
  (io/delete-file "target/test-results/output/index.html")
  (chart/create-chart "target/test-results")
  (is (.exists (io/as-file "target/test-results/output/index.html"))))

(ns clj-gatling.chart-test
  (:use [clojure.test])
  (:require [clojure.java.io :as io]
            [clj-gatling.chart :as chart]))

(defn create-dir [dir]
  (.mkdirs (java.io.File. dir)))

(defn copy-file [source-path dest-path]
  (io/copy (io/file source-path) (io/file dest-path)))

(defn delete-file-if-exists [path]
  (when (.exists (io/as-file path))
    (io/delete-file path)))

(deftest creates-chart-from-simulation-file
  (create-dir "target/test-results/input")
  (copy-file "test/simulation.log" "target/test-results/input/simulation.log")
  (delete-file-if-exists "target/test-results/output/index.html")
  (chart/create-chart "target/test-results")
  (is (.exists (io/as-file "target/test-results/output/index.html"))))

Delete generated chart file only if it exists already


(ns gigrig.test-runner
  (:require [cljs.test :as test :include-macros true :refer [report]]
            [devtools.core :as devtools]
            [gigrig.tests-to-run]))

(enable-console-print!)
(devtools/install! [:custom-formatters :sanity-hints])

(test/run-all-tests #"gigrig.*-test")

(.groupCollapsed js/console "Figwheel Information")

(ns gigrig.test-runner
  (:require [cljs.test :as test :include-macros true :refer [report]]
            [devtools.core :as devtools]
            [goog.string :as str]
            [goog.string.format]
            [gigrig.tests-to-run]))

(enable-console-print!)
(devtools/install! [:custom-formatters :sanity-hints])

(defn color-favicon-data-url
  "Takes a color and returns a 16x16 data url of the color"
  [color]
  (let [cvs (.createElement js/document "canvas")]
    (set! (.-width cvs) 16)
    (set! (.-height cvs) 16)
    (let [ctx (.getContext cvs "2d")]
      (set! (.-fillStyle ctx) color)
      (.fillRect ctx 0 0 16 16))
    (.toDataURL cvs)))

(defn change-favicon-to-color
  "Changes the tabs favicon to the given color"
  [color]
  (let [icon (.getElementById js/document "favicon")]
    (set! (.-href icon) (color-favicon-data-url color))))

(defn log
  "Logs any text to the console with the given color"
  [{:keys [color]} & args]
  (.log js/console (apply str "%c" args)
        (str "color: " color "; font-weight: bold")))

(defmethod report [::test/default :summary] [{:keys [fail error test pass]}]
  (let [failure (< 0 (+ fail error))
        color (if failure "#d00" "#0d0")]
    (log {:color "blue"}
         (str/format "Ran %d tests containing %d assertions" test (+ pass fail error)))
    (log {:color color}
         (str/format "%d failures, %d errors" fail error))
    (change-favicon-to-color color)))

(.clear js/console)

(test/run-all-tests #"gigrig.*-test")

(.groupCollapsed js/console "Figwheel Information")

Improve test runner by formatting and coloring favicon


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

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

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

(defn -main []
  (init))

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

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

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

(defn -main []
  (init))

Comment out the backend code, to allow heroku to start


(ns incise.config
  (:require [clojure.java.io :refer [reader file resource]]
            [clojure.edn :as edn]
            [faulter.core :refer [faultless!]])
  (:import [java.io PushbackReader])
  (:refer-clojure :exclude [merge load assoc get]))

(def ^:private config (atom {}))

(defn load []
  (when-let [config-file (file (resource "incise.edn"))]
    (reset! config (edn/read (PushbackReader. (reader config-file))))))

(defn assoc [& more]
  (apply swap! config clojure.core/assoc more))

(def ^:private validations
  [[(comp string? :in-dir) "must have an input dir"]
   [(comp string? :out-dir) "must have an output dir"]])

(defn faultless-config!
  "Throws an AssertionError unless the given config map, or @config if not
  supplied, has no faults."
  [& [given-config]]
  (faultless! 'config validations (or given-config @config)))

(defn get [& more]
  (faultless-config!)
  (if (empty? more)
    @config
    (apply @config more)))

(defn merge [& more]
  (apply swap! config
         clojure.core/merge more))

(ns incise.config
  (:require [clojure.java.io :refer [reader file resource]]
            [clojure.edn :as edn]
            [manners.victorian :refer [avow!]])
  (:import [java.io PushbackReader])
  (:refer-clojure :exclude [merge load assoc get]))

(def ^:private config (atom {}))

(defn load []
  (when-let [config-file (file (resource "incise.edn"))]
    (reset! config (edn/read (PushbackReader. (reader config-file))))))

(defn assoc [& more]
  (apply swap! config clojure.core/assoc more))

(def ^:private validations
  [[(comp string? :in-dir) "must have an input dir"]
   [(comp string? :out-dir) "must have an output dir"]])

(defn avow-config!
  "Throws an AssertionError unless the given config map, or @config if not
  supplied, has no faults."
  [& [given-config]]
  (avow! 'config validations (or given-config @config)))

(defn get [& more]
  (avow-config!)
  (if (empty? more)
    @config
    (apply @config more)))

(defn merge [& more]
  (apply swap! config
         clojure.core/merge more))

Use manners instead of faulter.

Use manners instead of faulter.


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

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

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

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

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

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

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

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

Change order of arguments in anagram script


(ns ombs.funcs "contains generic functions")

(defn in?
  "checks if value contained in collection. Used for vectors. For maps, use 'some'"
  [v coll]
  (boolean (some #(= v %) coll))
  )

(defn as-vec
  "get a vector or value and represents it as vector. [1 2 3] -> [1 2 3]; 1 -> [1]"
  [x] (if-not (vector? x)
        (conj [] x)
        x))

(defn parse-int [s]
   (when-let [r (re-find  #"\d+" s )] (Integer. r)))

(defn nil-fix
 "Replace nil value to 0"
 [v] (if (nil? v) 0 v))

Add nil fix in hash-map func.

[up] Add nil fix in hash-map func.


(ns test-core
  (:use [leiningen.core :only [make-groups]] :reload-all)
  (:use [clojure.test]))

(deftest test-make-groups-empty-args
  (is (= [[]] (make-groups []))))

(deftest test-make-groups-single-task
  (is (= [["pom"]] (make-groups ["pom"]))))

(deftest test-make-groups-without-args
  (is (= [["clean"] ["deps"] ["test"]]
         (make-groups ["clean," "deps," "test"]))))

(deftest test-make-groups-with-args
  (is (= [["test" "test-core"] ["version"]]
         (make-groups ["test" "test-core," "version"]))))

(deftest test-make-groups-with-long-chain
  (is (= [["help" "help"] ["help" "version"] ["version"]
          ["test" "test-compile"]]
         (make-groups '("help" "help," "help" "version," "version,"
                        "test" "test-compile")))))

Add another test for arg chaining.

Add another test for arg chaining.


 (ns ^:figwheel-no-load env.ios.main
  (:require [re-natal-om-next.ios.core :as core]
            [figwheel.client :as figwheel :include-macros true]))

 (enable-console-print!)

(figwheel/watch-and-reload
 :websocket-url "ws://localhost:3449/figwheel-ws"
 :heads-up-display true)

(core/init)

 (ns ^:figwheel-no-load env.ios.main
  (:require [re-natal-om-next.ios.core :as core]
            [figwheel.client :as figwheel :include-macros true]))

 (enable-console-print!)

(figwheel/watch-and-reload
 :websocket-url "ws://localhost:3449/figwheel-ws"
 :heads-up-display true
 :jsload-callback re-natal-om-next.ios.core/init)

(core/init)

Enable reload on file save

Enable reload on file save