(ns balance.cmn.pages.task-details-page
  (:require [balance.libs.react-native :as rn]
            [reagent.core :as r]
            [re-frame.core :refer [subscribe dispatch]]
            [balance.libs.rnrf :refer [scene-keys]]))

(def page-key (:task-details-page scene-keys))
(def page-title "Task Details")

(def styles {:page        {:margin-top 64
                           :padding 10}
             :title       {:min-height 40
                           :font-size 20
                           :color "gray"}
             :description {:min-height 40
                           :font-size 14}})

(defn- update-task [id path value]
  (dispatch [:update-task id path value]))

(defn page []
  (fn []
    (let [task (subscribe [:get-current-task])
          {:keys [id title description]} @task]
      [rn/view {:style (:page styles)}
       [rn/text-input {:style                  (:title styles)
                       :value                  title
                       :placeholder            "Title"
                       :multiline              true
                       :placeholder-text-color "gray"
                       :on-change-text         #(update-task id [:title] %)}]
       [rn/text-input {:style                  (:description styles)
                       :value                  description
                       :placeholder            "Task Description"
                       :multiline              true
                       :placeholder-text-color "gray"
                       :on-change-text         #(update-task id [:description] %)}]])))

(ns balance.cmn.pages.task-details-page
  (:require [balance.libs.react-native :as rn]
            [reagent.core :as r]
            [re-frame.core :refer [subscribe dispatch]]
            [balance.libs.rnrf :refer [scene-keys]]))

(def page-key (:task-details-page scene-keys))
(def page-title "Task Details")

(def styles {:page        {:margin-top 64
                           :padding 10}
             :title       {:min-height 40
                           :font-size 20
                           :color "gray"}
             :description {:min-height 40
                           :font-size 14}})

(defn- update-task [id path value]
  (dispatch [:update-task id path value]))

(defn page []
  (fn []
    (let [task (subscribe [:get-current-task])
          {:keys [id title description]} @task]
      [rn/view {:style (:page styles)}
       [rn/text-input {:style                  (:title styles)
                       :default-value          title
                       :placeholder            "Title"
                       :multiline              true
                       :auto-correct           false
                       :placeholder-text-color "gray"
                       :on-change-text         #(update-task id [:title] %)}]
       [rn/text-input {:style                  (:description styles)
                       :default-value          description
                       :placeholder            "Task Description"
                       :multiline              true
                       :auto-correct           false
                       :placeholder-text-color "gray"
                       :on-change-text         #(update-task id [:description] %)}]])))

Remove the debounce from text input

Remove the debounce from text input


(ns comic-reader.api
  (:require [re-frame.core :refer [dispatch]]
            [ajax.core :refer [GET POST]]))

(defn error-handler [{:keys [status status-text]}]
  (.log js/console (str "something bad happened: " status " " status-text)))

(defn get-sites []
  (GET "/api/v1/sites" {:handler #(dispatch [:site-list %])
                        :error-handler error-handler
                        :response-format :edn}))

(defn get-comics [site]
  (GET (format "/api/v1/comics/%s" (pr-str site))
      {:handler #(dispatch [:comic-list %])
       :error-handler error-handler
       :response-format :edn}))

(defn get-comic-urls [comic-name]
  (GET (format "/api/v1/comic/%s" (pr-str comic-name))
      {:handler #(dispatch [:comic-urls %])
       :error-handler error-handler
       :response-format :edn}))

Add API functions for other server calls


(ns lens.reducers
  (:require [clojure.core.reducers :as r])
  (:refer-clojure :exclude [empty? partition-by count]))

(defn partition-by
  "Applies f to each value in coll, splitting it each time f returns
  a new value."
  [f coll]
  (reify
    clojure.core.protocols/CollReduce
    (coll-reduce [this f1]
      (clojure.core.protocols/coll-reduce this f1 (f1)))
    (coll-reduce [_ f1 init]
      (let [result (clojure.core.protocols/coll-reduce
                     coll
                     (fn [accum v]
                       (let [r (f v)
                             vs (:vs accum)]
                         (cond
                           (= r (:last accum))
                           (assoc! accum :vs (conj! vs v))

                           (nil? vs)
                           (-> accum
                               (assoc! :vs (transient [v]))
                               (assoc! :last r))

                           :else
                           (let [ret (f1 (:ret accum) (persistent! vs))]
                             (if (reduced? ret)
                               (reduced {:ret @ret})
                               (assoc! accum :ret ret
                                       :vs (transient [v])
                                       :last r))))))
                     (transient {:ret init}))]
        (if (:vs result)
          (f1 (:ret result) (persistent! (:vs result)))
          (:ret result))))))

(defn empty? [coll]
  (zero? (reduce + (r/take 1 (r/map (constantly 1) coll)))))

(defn count [coll]
  (reduce + (r/map (constantly 1) coll)))

(ns lens.reducers
  (:require [clojure.core.reducers :as r])
  (:refer-clojure :exclude [empty? partition-by count]))

(defn partition-by
  "Applies f to each value in coll, splitting it each time f returns
  a new value."
  [f coll]
  (reify
    clojure.core.protocols/CollReduce
    (coll-reduce [this f1]
      (clojure.core.protocols/coll-reduce this f1 (f1)))
    (coll-reduce [_ f1 init]
      (let [result (clojure.core.protocols/coll-reduce
                     coll
                     (fn [accum v]
                       (let [r (f v)
                             vs (:vs accum)]
                         (cond
                           (= r (:last accum))
                           (assoc! accum :vs (conj! vs v))

                           (nil? vs)
                           (-> accum
                               (assoc! :vs (transient [v]))
                               (assoc! :last r))

                           :else
                           (let [ret (f1 (:ret accum) (persistent! vs))]
                             (if (reduced? ret)
                               (reduced {:ret @ret})
                               (assoc! accum :ret ret
                                       :vs (transient [v])
                                       :last r))))))
                     (transient {:ret init}))]
        (if (:vs result)
          (f1 (:ret result) (persistent! (:vs result)))
          (:ret result))))))

(defn empty? [coll]
  (clojure.core/empty? (into [] (r/take 1 coll))))

(defn count [coll]
  (reduce + (r/map (constantly 1) coll)))

Improve Readability of empty? Implementation


(ns subman.const)

(def db-host "http://127.0.0.1:9200")

(def index-name "subman7")

(def type-addicted 0)

(def type-podnapisi 1)

(def type-opensubtitles 2)

(def type-names {type-addicted "Addicted"
                 type-podnapisi "Podnapisi"
                 type-opensubtitles "OpenSubtitles"})

(def update-deep 10)

(def update-period (* 5 60 60))

(def result-size 100)

(ns subman.const)

(def db-host "http://127.0.0.1:9200")

(def index-name "subman7")

(def type-addicted 0)

(def type-podnapisi 1)

(def type-opensubtitles 2)

(def type-names {type-addicted "Addicted"
                 type-podnapisi "Podnapisi"
                 type-opensubtitles "OpenSubtitles"})

(def update-deep 10)

(def update-period (* 5 60 1000))

(def result-size 100)

Change update period to 5 minutes

Change update period to 5 minutes


(ns circle.backend.build.inference
  "fns for creating a build from a source tree"
  (:use circle.util.fs)
  (:require [circle.backend.build.template :as template])
  (:require [circle.backend.action :as action])
  (:require circle.backend.build.inference.rails
            circle.backend.build.inference.php))

(def inference-fns {:rails circle.backend.build.inference.rails/spec
                    :php circle.backend.build.inference.php/spec})

(defn set-inferred [actions]
  (map #(action/set-source % :inferred) actions))

(def action-order [:pre-setup :setup :post-setup :pre-test :test :post-test])

(defn merge-actions [specs]
  (->> specs
       (group-by :type)
       ((apply juxt action-order))
       (apply concat)))

(defn infer-actions
  "Dispatches on repo type returned from (infer-repo-type). Returns a
 seq of build actions."
  [repo]
  (let [actions (->> inference-fns
                     (vals)
                     (mapcat #(% repo))
                     (merge-actions)
                     (set-inferred))]
    ;; if we do an inference, and come up with nothing useful, don't
    ;; add the template, because that would start nodes. Just return []
    (if (seq actions)
      (template/apply-template :build actions)
      [])))

(ns circle.backend.build.inference
  "fns for creating a build from a source tree"
  (:use circle.util.fs)
  (:require [circle.backend.build.template :as template])
  (:require [circle.backend.action :as action])
  (:require circle.backend.build.inference.rails
            circle.backend.build.inference.php))

(def inference-fns {:rails (var circle.backend.build.inference.rails/spec)
                    :php (var circle.backend.build.inference.php/spec)})

(defn set-inferred [actions]
  (map #(action/set-source % :inferred) actions))

(def action-order [:pre-setup :setup :post-setup :pre-test :test :post-test])

(defn merge-actions [specs]
  (->> specs
       (group-by :type)
       ((apply juxt action-order))
       (apply concat)))

(defn infer-actions
  "Dispatches on repo type returned from (infer-repo-type). Returns a
 seq of build actions."
  [repo]
  (let [actions (->> inference-fns
                     (vals)
                     (mapcat #(% repo))
                     (merge-actions)
                     (set-inferred))]
    ;; if we do an inference, and come up with nothing useful, don't
    ;; add the template, because that would start nodes. Just return []
    (if (seq actions)
      (template/apply-template :build actions)
      [])))

Use vars so the fns reload

Use vars so the fns reload


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject re-frame/lein-template "0.3.20"
  :description "Leiningen template for a Reagent web app that implements the re-frame pattern."
  :url "https://github.com/Day8/re-frame-template"
  :license {:name "MIT"}
  :deploy-repositories [["releases" :clojars]
                        ["snapshots" :clojars]]
  :scm {:name "git"
        :url "https://github.com/Day8/re-frame-template"}
  :eval-in-leiningen true)

(defproject re-frame/lein-template "0.3.21-SNAPSHOT"
  :description "Leiningen template for a Reagent web app that implements the re-frame pattern."
  :url "https://github.com/Day8/re-frame-template"
  :license {:name "MIT"}
  :deploy-repositories [["releases" :clojars]
                        ["snapshots" :clojars]]
  :scm {:name "git"
        :url "https://github.com/Day8/re-frame-template"}
  :eval-in-leiningen true)

Bump template version to SNAPSHOT

Bump template version to SNAPSHOT


(defproject com.draines/postal "3.0.0-SNAPSHOT"
  :description "JavaMail on Clojure"
  :url "https://github.com/drewr/postal"
  :license {:name "MIT"
            :url "http://en.wikipedia.org/wiki/MIT_License"
            :distribution :repo
            :comments "Use at your own risk"}
  :deploy-repositories [["releases" :clojars]]
  :dependencies [[commons-codec "1.9"]
                 [com.sun.mail/javax.mail "1.6.2"]
                 [javax.mail/javax.mail-api "1.6.2"]]
  :global-vars {*warn-on-reflection* true}
  :profiles {:dev {:dependencies []}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
             :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
             :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}}
  :aliases {"test-all" ["with-profile" "dev,1.7:dev,1.8:dev,1.9" "test"]})

(defproject com.draines/postal "3.0.0-SNAPSHOT"
  :description "JavaMail on Clojure"
  :url "https://github.com/drewr/postal"
  :license {:name "MIT"
            :url "http://en.wikipedia.org/wiki/MIT_License"
            :distribution :repo
            :comments "Use at your own risk"}
  :deploy-repositories [["releases" :clojars]]
  :dependencies [[commons-codec "1.9"]
                 [com.sun.mail/jakarta.mail "1.6.5"]]
  :global-vars {*warn-on-reflection* true}
  :profiles {:dev {:dependencies []}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
             :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
             :1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}}
  :aliases {"test-all" ["with-profile" "dev,1.7:dev,1.8:dev,1.9" "test"]})

Update JavaMail (now Jakarta Mail) to 1.6.5


(defproject cats "0.5.0-SNAPSHOT"
  :description "Category Theory abstractions for Clojure"
  :url "https://github.com/funcool/cats"
  :license {:name "BSD (2 Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :dependencies []
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}

  :source-paths ["src"]
  :test-paths ["test"]

  :cljsbuild {:test-commands {"test" ["node" "output/tests.js"]}
              :builds [{:id "test"
                        :source-paths ["src" "test"]
                        :notify-command ["node" "output/tests.js"]
                        :compiler {:output-to "output/tests.js"
                                   :output-dir "output"
                                   :source-map true
                                   :static-fns true
                                   :cache-analysis false
                                   :main cats.runner
                                   :optimizations :none
                                   :target :nodejs
                                   :pretty-print true}}]}

  :jar-exclusions [#"\.swp|\.swo"]

  :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]
                                  [org.clojure/clojure "1.7.0-RC2"]
                                  [org.clojure/clojurescript "0.0-3308"]]
                   :codeina {:sources ["src"]
                             :output-dir "doc/codeina"}
                   :plugins [[funcool/codeina "0.1.0-SNAPSHOT"
                              :exclusions [org.clojure/clojure]]
                             [lein-cljsbuild "1.0.6"]]}})

(defproject cats "0.5.0-SNAPSHOT"
  :description "Category Theory abstractions for Clojure"
  :url "https://github.com/funcool/cats"
  :license {:name "BSD (2 Clause)"
            :url "http://opensource.org/licenses/BSD-2-Clause"}
  :dependencies []
  :deploy-repositories {"releases" :clojars
                        "snapshots" :clojars}

  :source-paths ["src"]
  :test-paths ["test"]

  :cljsbuild {:test-commands {"test" ["node" "output/tests.js"]}
              :builds [{:id "test"
                        :source-paths ["src" "test"]
                        :notify-command ["node" "output/tests.js"]
                        :compiler {:output-to "output/tests.js"
                                   :output-dir "output"
                                   :source-map true
                                   :static-fns true
                                   :cache-analysis false
                                   :main cats.runner
                                   :optimizations :none
                                   :target :nodejs
                                   :pretty-print true}}]}

  :jar-exclusions [#"\.swp|\.swo"]
  :profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]
                                  [org.clojure/clojure "1.7.0"]
                                  [org.clojure/clojurescript "0.0-3297"]]
                   :codeina {:sources ["src"]
                             :output-dir "doc/codeina"}
                   :plugins [[funcool/codeina "0.1.0-SNAPSHOT"
                              :exclusions [org.clojure/clojure]]
                             [lein-cljsbuild "1.0.6"]]}})

Update clojure version to 1.7.0 and tools.namespace to 0.2.11.


;; The Climate Corporation licenses this file to you under under the Apache
;; License, Version 2.0 (the "License"); you may not use this file except in
;; compliance with the License.  You may obtain a copy of the License at
;;
;;   http://www.apache.org/licenses/LICENSE-2.0
;;
;; See the NOTICE file distributed with this work for additional information
;; regarding copyright ownership.  Unless required by applicable law or agreed
;; to in writing, software distributed under the License is distributed on an
;; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
;; or implied.  See the License for the specific language governing permissions
;; and limitations under the License.

(defproject com.climate/claypoole
  "0.4.0"
  :description "Claypoole: Threadpool tools for Clojure."
  :url "http://github.com/TheClimateCorporation/claypoole/"
  :license {:name "Apache License Version 2.0"
            :url http://www.apache.org/licenses/LICENSE-2.0
            :distribution :repo}
  :min-lein-version "2.0.0"
  :source-paths ["src/clj"]
  :java-source-paths ["src/java"]
  :pedantic? :warn
  :dependencies [[org.clojure/clojure "1.6.0"]]
  :plugins [[jonase/eastwood "0.2.1"]])

;; The Climate Corporation licenses this file to you under under the Apache
;; License, Version 2.0 (the "License"); you may not use this file except in
;; compliance with the License.  You may obtain a copy of the License at
;;
;;   http://www.apache.org/licenses/LICENSE-2.0
;;
;; See the NOTICE file distributed with this work for additional information
;; regarding copyright ownership.  Unless required by applicable law or agreed
;; to in writing, software distributed under the License is distributed on an
;; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
;; or implied.  See the License for the specific language governing permissions
;; and limitations under the License.

(defproject com.climate/claypoole
  "0.4.0-SNAPSHOT"
  :description "Claypoole: Threadpool tools for Clojure."
  :url "http://github.com/TheClimateCorporation/claypoole/"
  :license {:name "Apache License Version 2.0"
            :url http://www.apache.org/licenses/LICENSE-2.0
            :distribution :repo}
  :min-lein-version "2.0.0"
  :source-paths ["src/clj"]
  :java-source-paths ["src/java"]
  :pedantic? :warn
  :dependencies [[org.clojure/clojure "1.6.0"]]
  :plugins [[jonase/eastwood "0.2.1"]])

Change version back to snapshot

Change version back to snapshot


(defproject onyx-app/lein-template "0.8.8.2"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

(defproject onyx-app/lein-template "0.8.8.3-SNAPSHOT"
  :description "Onyx Leiningen application template"
  :url "https://github.com/onyx-platform/onyx-template"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :repositories {"snapshots" {:url "https://clojars.org/repo"
                              :username :env
                              :password :env
                              :sign-releases false}
                 "releases" {:url "https://clojars.org/repo"
                             :username :env
                             :password :env
                             :sign-releases false}}
  :plugins [[lein-set-version "0.4.1"]]
  :profiles {:dev {:plugins [[lein-set-version "0.4.1"]
                             [lein-update-dependency "0.1.2"]
                             [lein-pprint "1.1.1"]]}}
  :eval-in-leiningen true)

Prepare for next release cycle.

Prepare for next release cycle.


(ns web.components.node-link
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]))

(defui Badge
  Object
  (render [this]
    (let [{:keys [kind]} (om/props this)]
      (dom/span #js {:className "badge"}
        (case kind
          "requirement" "r"
          "component" "c"
          "work-item" "w"
          "tag" "t"
          "?")))))

(def badge (om/factory Badge))

(defui NodeLink
  static om/Ident
  (ident [this props]
    [:node (:name props)])
  static om/IQuery
  (query [this]
    [:name :title :kind])
  Object
  (render [this]
    (let [{:keys [name title kind]} (om/props this)]
      (dom/div #js {:className "node-link"}
        (badge {:kind kind})
        (dom/span #js {:className "node-link-title"} title)
        (dom/span #js {:className "node-link-name"} name)))))

(def node-link (om/factory NodeLink {:key-fn :name}))

(ns web.components.node-link
  (:require [om.next :as om :refer-macros [defui]]
            [om.dom :as dom]
            [web.routing :as routing]))

(defui Badge
  Object
  (render [this]
    (let [{:keys [kind]} (om/props this)]
      (dom/span #js {:className "badge"}
        (case kind
          "requirement" "r"
          "component" "c"
          "work-item" "w"
          "tag" "t"
          "?")))))

(def badge (om/factory Badge))

(def kind->view
  {"requirement" :requirements
   "component" :components
   "work-item" :work-items
   "tag" :tags})

(defn node->route [{:keys [kind name]}]
  {:handler (kind->view kind)
   :route-params {:state '?state
                  :node name}})

(defui NodeLink
  static om/Ident
  (ident [this props]
    [:node (:name props)])
  static om/IQuery
  (query [this]
    [:name :title :kind])
  Object
  (render [this]
    (let [{:keys [name title kind]} (om/props this)
          route (node->route (om/props this))]
      (dom/a #js {:onClick #(routing/activate-route! route)
                  :className "node-link"}
        (badge {:kind kind})
        (dom/span #js {:className "node-link-title"} title)
        (dom/span #js {:className "node-link-name"} name)))))

(def node-link (om/factory NodeLink {:key-fn :name}))

Make node links clickable, redirect to the right view for now


(set-env!
 :source-paths #{"src/main/java" "src/test/java"}
 :dependencies '[[radicalzephyr/boot-junit "0.1.0" :scope "test"]])

(def +version+ "0.1.0")

(require '[radicalzephyr.boot-junit :refer [junit]])

(task-options!
 pom {:project 'http-server
      :version +version+
      :description "A Java HTTP server."
      :url "https://github.com/RadicalZephyr/http-server"
      :scm {:url "https://github.com/RadicalZephyr/http-server.git"}
      :licens {"MIT" "http://opensource.org/licenses/MIT"}}
 junit {:packages '#{net.zephyrizing.http_server}})

(deftask test
  "Compile and run my jUnit tests."
  []
  (comp (javac)
        (junit)))

(deftask build
  "Build my http server."
  []
  (comp (javac)
        (pom)
        (jar)))

(set-env!
 :source-paths #{"src/main/java" "src/test/java"}
 :dependencies '[[radicalzephyr/boot-junit "0.1.0-SNAPSHOT" :scope "test"]])

(def +version+ "0.1.0")

(require '[radicalzephyr.boot-junit :refer [junit]])

(task-options!
 pom {:project 'http-server
      :version +version+
      :description "A Java HTTP server."
      :url "https://github.com/RadicalZephyr/http-server"
      :scm {:url "https://github.com/RadicalZephyr/http-server.git"}
      :licens {"MIT" "http://opensource.org/licenses/MIT"}}
 junit {:packages '#{net.zephyrizing.http_server}})

(deftask test
  "Compile and run my jUnit tests."
  []
  (comp (javac)
        (junit)))

(deftask build
  "Build my http server."
  []
  (comp (javac)
        (pom)
        (jar)))

Use the clojars version of boot-junit

Use the clojars version of boot-junit


(ns my-noir-lab.views.welcome
  (:require [my-noir-lab.views.common :as common]
            [noir.content.getting-started])
  (:use [noir.core :only [defpage]]
        [hiccup.core :only [html]]))

(defpage "/welcome" []
         (common/layout
           [:p "Welcome to my-noir-lab"]))

(defpage "/my-page" []
  (common/site-layout
   [:h1 "Welcome to my site!"]
   [:p#wrapper "Hope you like it!"]))

(defpage "/range" []
  (common/site-layout
   [:h1 "range 1 100"]
   [:p#wrapper (map #(str "<i>" % "</i> ") (range 1 100))]))

Add a page to display the range method.

Add a page to display the range method.


(ns auricle.subs
  (:require [re-frame.core :refer [reg-sub]]))

(reg-sub
  :current-speaker
  (fn [db _]
    (:current-speaker db)))

(reg-sub
 :db
 (fn [db _]
   db))

(reg-sub
 :loading
 (fn [db _]
   (:loading db)))

(defn format-speaker [speaker]
  (-> speaker
      (update :love count)
      (update :smile count)
      (update :neutral count)
      (update :sleep count)))

(defn format-speakers [speakers]
  (map format-speaker speakers))

(reg-sub
 :speakers
 (fn [db _]
   (-> db
       :speakers
       vals
       (or {})
       (format-speakers))))

(ns auricle.subs
  (:require [re-frame.core :refer [reg-sub]]))

(reg-sub
  :current-speaker
  (fn [db _]
    (:current-speaker db)))

(reg-sub
 :db
 (fn [db _]
   db))

(reg-sub
 :loading
 (fn [db _]
   (:loading db)))

(defn format-speaker [speaker]
  (-> speaker
      (update :love count)
      (update :smile count)
      (update :neutral count)
      (update :sleep count)))

(defn format-speakers [speakers]
  (->> speakers
       (map format-speaker)
       (sort-by :created >)))

(reg-sub
 :speakers
 (fn [db _]
   (-> db
       :speakers
       vals
       (or {})
       (format-speakers))))

Sort speakers by creation date

Sort speakers by creation date


(ns icecap.schema
  (:require [schema.core :as s])
  (:import [java.net URI]))

(def supported-schemes
  "The currently supported schemes."
  #{"http" "https"})

(defn get-scheme
  "Gets the scheme of a (String) URL."
  [url]
  (.getScheme (URI. url)))

(def supported-scheme?
  "Does the given URL have a supported scheme?"
  (comp supported-schemes get-scheme))

(def SimpleRequest
  "A simple request."
  {:target (s/both s/Str
                   (s/pred supported-scheme? "supported-scheme?"))})

(def RequestSpec
  (s/either
   SimpleRequest
   [(s/recursive #'RequestSpec)]
   #{(s/recursive #'RequestSpec)}))

(ns icecap.schema
  (:require [schema.core :as s])
  (:import [java.net URI]))

(def supported-schemes
  "The currently supported schemes."
  #{"http" "https"})

(defn get-scheme
  "Gets the scheme of a (String) URL."
  [url]
  (.getScheme (URI. url)))

(def supported-scheme?
  "Does the given URL have a supported scheme?"
  (comp supported-schemes get-scheme))

(def SimpleRequest
  "A simple request."
  {:target (s/both s/Str
                   (s/pred supported-scheme? "supported-scheme?"))})

(def RequestSpec
  "A request specification.

  Please note that this uses prismatic/schema's `conditional` with
  type dispatch, rather than the (perhaps more obvious) `either`. The
  problem with `either` is that it didn't know which of the schemas
  *probably* should have validated: if you give it a bogus
  `SimpleRequest`, it can only tell you that it:

  - wasn't a valid `SimpleRequest`
  - wasn't an unordered collection of valid `SimpleRequests`
  - wasn't an ordered collection of valid `SimpleRequests`

  ... but it fails to tell you that it *was* something that looked
  like a SimpleRequest but didn't validate because, for example, its
  target was `ftp`, which is an unsupported URL scheme. That would've
  been far more useful. Using `conditional` allows us to return
  this (useful) error message.
  "
  (s/conditional
   map? SimpleRequest
   vector? [(s/recursive #'RequestSpec)]
   set? #{(s/recursive #'RequestSpec)}))

Use s/conditional instead of s/either

Use s/conditional instead of s/either

This gives better error reporting.

Closes #1.


;; Copyright © 2014 JUXT LTD.

(ns modular.aleph
  (:require
   [com.stuartsierra.component :refer (Lifecycle)]
   [schema.core :as s]
   [modular.ring :refer (request-handler WebRequestHandler)]
   [aleph.http :as http]))

(defrecord Webserver []
  Lifecycle
  (start [component]
    (if-let [provider (first (filter #(satisfies? WebRequestHandler %) (vals component)))]
      (let [h (request-handler provider)]
        (assert h)
        (let [server (http/start-server h component)]
          (assoc component :server server)))
      (throw (ex-info (format "aleph http server requires the existence of a component that satisfies %s" WebRequestHandler)
                      {:component component})))

    )
  (stop [component]
    (when-let [server (:server component)]
      (.close server)
      (dissoc component :server))))

(def new-webserver-schema {:port s/Int
                           s/Keyword s/Any})

(defn new-webserver [& {:as opts}]
  (->> opts
    (merge {:port 0})
    (s/validate new-webserver-schema)
    map->Webserver))

;; Copyright © 2014 JUXT LTD.

(ns modular.aleph
  (:require
   [com.stuartsierra.component :refer (Lifecycle)]
   [schema.core :as s]
   [modular.ring :refer (request-handler WebRequestHandler)]
   [aleph.http :as http]
   ))

(defn get-handler
  "Extract the Ring handler from the component"
  [component]
  (or
   ;; Handlers can be specified as a constructor arg
   (:handler component)

   ;; Or as a dependency (which satisfies WebRequestHandler)
   (when-let [provider (first (filter #(satisfies? WebRequestHandler %) (vals component)))]
     (request-handler provider))

   ;; Or an exception is thrown
   (throw (ex-info (format "aleph http server requires a handler, or a dependency that satisfies %s" WebRequestHandler)))))

(defrecord Webserver [handler]
  Lifecycle
  (start [component]
    (let [server (http/start-server (get-handler component) component)]
      (assoc component :server server)))
  (stop [component]
    (when-let [server (:server component)]
      (.close server)
      (dissoc component :server))))

(def new-webserver-schema
  {:port s/Int
   s/Keyword s/Any})

(defn new-webserver [& {:as opts}]
  (->> opts
    (merge {:port 0})
    (s/validate new-webserver-schema)
    map->Webserver))

Support for handler in constructor

Support for handler in constructor


(ns salava.core.i18n
  #?(:cljs (:require-macros [taoensso.tower :as tower-macros]))
     (:require
       #?@(:cljs [[reagent.session :as session]
                  [taoensso.tower :as tower :refer-macros (with-tscope)]])
       #?(:clj  [taoensso.tower :as tower :refer (with-tscope)])))

(def tconfig
  #?(:clj {:fallback-locale :en
           :dev-mode? true
           :dictionary "i18n/dict.clj"}
     :cljs {:fallback-locale :en
            :compiled-dictionary (tower-macros/dict-compile* "i18n/dict.clj")}))

(def translation (tower/make-t tconfig)) ; create translation fn

(defn t [key]
  (let [lang #?(:clj "en"
                :cljs (session/get :lang))]
    (translation lang key)))

(ns salava.core.i18n
  #?(:cljs (:require-macros [taoensso.tower :as tower-macros]))
     (:require
       #?@(:cljs [[reagent.session :as session]
                  [taoensso.tower :as tower :refer-macros (with-tscope)]])
       #?(:clj  [taoensso.tower :as tower :refer (with-tscope)])))

(def tconfig
  #?(:clj {:fallback-locale :en
           :dev-mode? true
           :dictionary "i18n/dict.clj"}
     :cljs {:fallback-locale :en
            :compiled-dictionary (tower-macros/dict-compile* "i18n/dict.clj")}))

(def translation (tower/make-t tconfig)) ; create translation fn

(defn t [key]
  (let [lang #?(:clj "en" :cljs (session/get :lang))
        out-str (translation lang key)]
    (if-not (= out-str "")
      out-str
      (str "[" key "]"))))

Replace missing translations with keys

Replace missing translations with keys

Signed-off-by: Antti Koskinen <7180a8b2eda8ec34b3486f8aa865046413c11ed3@discendum.com>


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

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

(defmulti novelty :type)

(defmulti query :type)

(defmethod novelty :default
  [{:keys [type] :as data}]
  (ex/raise :code ::not-implemented
            :message-category :novelty
            :message-type type))

(defmethod query :default
  [data]
  (ex/raise :code ::not-implemented
            :message-category :query
            :message-type type))

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

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

(defmulti novelty :type)

(defmulti query :type)

(defmethod novelty :default
  [{:keys [type] :as data}]
  (ex/raise :code ::not-implemented
            :message-category :novelty
            :message-type type))

(defmethod query :default
  [{:keys [type] :as data}]
  (ex/raise :code ::not-implemented
            :message-category :query
            :message-type type))

Fix unexpected exception on default service handler.


(ns tutorial.moan.lib
  (:require
    [tutorial.moan.db :as db]))

(defn favorites
  []
  [{:id 1
    :text "This is a fantastic tweet"
    :author {:name "Elon Musk"
             :username "fakeelonmusk"}}
   {:id 2
    :text "Lord but I dislike poetry. How can anyone remember words that aren't put to music?"
    :author {:name "Arliden"
             :username "arl_the_bard"}}])

(ns tutorial.moan.lib
  (:require
    [tutorial.moan.db :as db]))

(defn favorites
  []
  [{:id 1
    :text "This is a fantastic tweet"
    :author {:name "Elon Musk"
             :username "fakeelonmusk"}
    :favorite? true}
   {:id 2
    :text "Lord but I dislike poetry. How can anyone remember words that aren't put to music?"
    :author {:name "Arliden"
             :username "arl_the_bard"}
    :favorite? true}])

Mark mock tweets as favorites

Mark mock tweets as favorites


(ns db-quiz.state
  (:require [reagent.core :as reagent :refer [atom]]))

(defonce app-state
  (atom {:answer nil
         :answers {:correct 0
                   :incorrect 0}
         :board {}
         :current-field nil
         :hint nil
         :language :cs
         :loading? false
         :on-turn (rand-nth [:player-1 :player-2])
         :options {:data-source :dbpedia
                   :despoilerify? true
                   :difficulty :normal
                   :doc ""
                   :labels :numeric
                   :selectors #{:persons
                                :places
                                :works}
                   :share-url ""}
         :players {:player-1 "Dmitrij"
                   :player-2 "Paní M."}
         :timer {:completion 0
                 :start 0}
         :verdict nil
         :winner nil}))

(ns db-quiz.state
  (:require [reagent.core :as reagent :refer [atom]]))

(defonce app-state
  (atom {:answer nil
         :answers {:correct 0
                   :incorrect 0}
         :board {}
         :current-field nil
         :hint nil
         :language :cs
         :loading? false
         :on-turn (rand-nth [:player-1 :player-2])
         :options {:data-source :dbpedia
                   :despoilerify? true
                   :difficulty :easy
                   :doc ""
                   :labels :numeric
                   :selectors #{:persons
                                :places
                                :films}
                   :share-url ""}
         :players {:player-1 "Dmitrij"
                   :player-2 "Paní M."}
         :timer {:completion 0
                 :start 0}
         :verdict nil
         :winner nil}))

Change the default to easy

Change the default to easy


(ns asid.trust-pool
  (:use midje.sweet)
  (:use asid.wallet))

(defrecord Origin [identity url])
(defrecord Trustee [signed-values origin])

(defrecord TrustPool [challenge trustees])

(defn new-trust-pool [req-keys]
  (TrustPool. req-keys []))

(defn add-to-pool [pool owner-wallet joiner challenge-response]
  (let [joiner-origin (Origin. (:identity joiner) (:url joiner))
        trustee (Trustee. (map #(sign owner-wallet (:identity joiner) %1 %2)
                               (:challenge pool)
                               challenge-response) joiner-origin)]
    (TrustPool. (:challenge pool)
                (conj (:trustees pool) trustee))))

(facts "about adding to a trust pool"
  (fact "should add with complete challenge"
    (-> (add-to-pool (TrustPool. [:name] [])
                     (new-wallet)
                     {:identity "id" :url "url"}
                     ["blah"]) :trustees count) => 1))

(ns asid.trust-pool
  (:use midje.sweet)
  (:use asid.wallet))

(defrecord Origin [identity url])
(defrecord Trustee [signed-values origin])

(defrecord TrustPool [challenge trustees])

(defn new-trust-pool [req-keys]
  (TrustPool. req-keys []))

(defn add-to-pool [pool owner-wallet joiner challenge-response]
  (let [joiner-origin (Origin. (:identity joiner) (:url joiner))
        trustee (Trustee. (map #(sign owner-wallet (:identity joiner) %1 %2)
                               (:challenge pool)
                               challenge-response) joiner-origin)]
    (TrustPool. (:challenge pool)
                (conj (:trustees pool) trustee))))

(facts "about adding to a trust pool"
  (fact "should add with complete challenge"
    (-> (add-to-pool (TrustPool. [:name] [])
                     (new-wallet "id seed")
                     {:identity "id" :url "url"}
                     ["blah"]) :trustees count) => 1))

Fix failing test as a result of changing interface.


(ns discuss.debug
  "Show information for debugging."
  (:require [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]
            [discuss.lib :as lib]))

(defn debug-view [data _owner]
  (reify om/IRender
    (render [_]
      (dom/div nil
               (dom/h4 nil "Last API call")
               (dom/pre nil (get-in data [:debug :last-api]))

               (dom/h4 nil "Last response")
               (dom/pre nil
                        (apply dom/ul nil
                               (map (fn [[k v]] (dom/li nil (str k "\t\t" v))) (get-in data [:debug :response]))))

               (dom/h4 nil "Token")
               (dom/pre nil (get-in data [:user :token]))
               ))))

(defn update
  "Update displayed debug information."
  [key val]
  (lib/update-state-item! :debug key (fn [_] val)))

(ns discuss.debug
  "Show information for debugging."
  (:require [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]
            [discuss.lib :as lib]))

(defn debug-view [data _owner]
  (reify om/IRender
    (render [_]
      (dom/div nil
               (dom/h4 nil "Last API call")
               (dom/pre nil (get-in data [:debug :last-api]))
               (dom/button #js {:className "btn btn-default"
                                :onClick #(discuss.communication/ajax-get (get-in data [:debug :last-api]))}
                           "Resend API Call")

               (dom/h4 nil "Last response")
               (dom/pre nil
                        (apply dom/ul nil
                               (map (fn [[k v]] (dom/li nil (str k "\t\t" v))) (get-in data [:debug :response]))))

               (dom/h4 nil "Token")
               (dom/pre nil (get-in data [:user :token]))
               ))))

(defn update
  "Update displayed debug information."
  [key val]
  (lib/update-state-item! :debug key (fn [_] val)))

Add button to resend API call

Add button to resend API call


`{:name "link-bio-with-nil"
  :description "This link-bio-with-properties rule requires both
  things being linked to be 'bioentities' and thus this rule excludes
  links within RDF lists that connect to rdf:nil. This rule fills in
  those missing links."
  :head ((?/bio ?/p rdf/nil))
  :body ((?/c obo/IAO_0000219 ?/bio)
         (?/c ?/p rdf/nil))}

`{:name "transfer-rdf-list-links-with-nil"
  :description "This rule transfers links to rdf:nil from list members to bio world. These links are
  predominantly '?x rdf:rest rdf/nil'."
  :head ((?/bio_list_member ?/p rdf/nil))
  :sparql-string "select ?bio_list_member ?p {
  ?list_record rdf:type ccp:IAO_EXT_0000317 .
  ?list_record obo:IAO_0000219 ?list_member .
  ?list_member ?p rdf:nil .
  ?list_record obo:IAO_0000219 ?bio_list_member .
  filter (?list_member != ?bio_list_member)
  }"}

Add transfer-rdf-list-links-with-nil to connect rdf:List members to nil where appropriate


(defproject tailrecursion/boot-classloader "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure             "1.5.1"]
                 [org.springframework/spring-core "1.2.2"]
                 [com.cemerick/pomegranate        "0.2.0" :exclusions [org.clojure/clojure]]]
  :main ^:skip-aot tailrecursion.boot-classloader
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})

(defproject tailrecursion/boot-classloader "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure             "1.5.1"]
                 [org.springframework/spring-core "1.2.2"]
                 [com.cemerick/pomegranate        "0.2.0" :exclusions [org.clojure/clojure]]]
  :main ^:skip-aot tailrecursion.boot-classloader
  :target-path "target" ; force target-path to maintain 2.3 compatibility
  :profiles {:uberjar {:aot :all}})

Set target-path to maintain compatibility with lein 2.3


(defproject mvxcvi/multihash "1.1.0-SNAPSHOT"
  :description "Native Clojure implementation of the multihash standard."
  :url "https://github.com/greglook/clj-multihash"
  :license {:name "Public Domain"
            :url "http://unlicense.org/"}

  :deploy-branches ["master"]

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

  :dependencies
  [[org.clojure/clojure "1.7.0"]]

  :codox {:metadata {:doc/format :markdown}
          :source-uri "https://github.com/greglook/clj-multihash/blob/master/{filepath}#L{line}"
          :doc-paths ["doc/extra"]
          :output-path "doc/api"})

(defproject mvxcvi/multihash "1.1.0-SNAPSHOT"
  :description "Native Clojure implementation of the multihash standard."
  :url "https://github.com/greglook/clj-multihash"
  :license {:name "Public Domain"
            :url "http://unlicense.org/"}

  :deploy-branches ["master"]

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

  :dependencies
  [[org.clojure/clojure "1.7.0"]]

  :codox {:metadata {:doc/format :markdown}
          :source-uri "https://github.com/greglook/clj-multihash/blob/master/{filepath}#L{line}"
          :doc-paths ["doc/extra"]
          :output-path "doc/api"}

  :whidbey {:tag-types {'multihash.core.Multihash {'data/hash 'multihash.core/base58}}})

Add tag type for whidbey.

Add tag type for whidbey.


(defproject test-utils "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [kixi/stats "0.5.2"]]
  :repl-options {:init-ns test-utils.core}
  :source-paths ["src", "test"])

(defproject test-utils "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url "https://www.eclipse.org/legal/epl-2.0/"}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [kixi/stats "0.5.2"]]
  :repl-options {:init (require '[test-utils
                                  [core :as tuc]
                                  [address :as addr]
                                  [fracture-diagnostics :as fd]
                                  [retail :as tur]
                                  [sandbox :as sb]
                                  [word-source :as ws]])
                 }
  :source-paths ["src", "test"])

Initialize the REPL with typical modules


(defproject lapmachine "0.1.0"
  :description "A Language/Action Perspective-based engine for pragmatic interaction on the Web"
  :url "http://github.com/bpdp/lapmachine"
  :license {:name "Eclipse Public License v 1.0"
            :url "https://www.eclipse.org/org/documents/epl-v10.php"}
  :main lapmachine.repl
  :ring {:handler lapmachine.interact/handler}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [instaparse "1.3.4"]
                 [liberator "0.12.2"]
                 [compojure "1.2.2"]
                 [ring/ring-core "1.3.2"]]
  :dev-dependencies
                [[ring/ring-devel "1.3.2"]])

(defproject lapmachine "0.1.0"
  :description "A Language/Action Perspective-based engine for pragmatic interaction on the Web"
  :url "http://github.com/bpdp/lapmachine"
  :license {:name "Eclipse Public License v 1.0"
            :url "https://www.eclipse.org/org/documents/epl-v10.php"}
  :main lapmachine.repl
  :ring {:handler lapmachine.interact/handler}
  :repositories [["bigdata" "http://systap.com/maven/releases"]
                 ["nxparser" "http://nxparser.googlecode.com/svn/repository"]
                 ["sonatype" "https://oss.sonatype.org/content/repositories/releases"]
                 ["apache" "http://repository.apache.org/content/repositories/releases"]]
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [instaparse "1.3.5"]
                 [liberator "0.12.2"]
                 [compojure "1.3.0"]
                 [ring/ring-core "1.3.2"]
                 [com.bigdata/bigdata "1.4.0"]]
  :dev-dependencies
                [[ring/ring-devel "1.3.2"]])

Add bigdata 1.4.0 and its dependencies

Add bigdata 1.4.0 and its dependencies


(defproject riverford/compound "0.5.0-alpha4"
  :description "A micro structure for reagent data"
  :url "https://github.com/riverford/compound"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.9.0-RC2"]
                 [org.clojure/spec.alpha "0.1.143"]]
  :publish {:site "compound"
            :theme "bolton"
            :output "docs"
            :template {:author "Daniel Neal"
                       :logo-white "img/compound_small.png"
                       :email "danielneal@riverford.co.uk"}
            :files {"index" {:input "test/compound/docs.cljc"
                             :site "compound"
                             :title "core"
                             :subtitle "api docs"}}}
  :profiles {:dev {:dependencies [[im.chit/lucid.publish "1.3.13"]
                                  [orchestra "2017.11.12-1"]]}})

(defproject riverford/compound "2017.12.20-1"
  :description "A micro structure for reagent data"
  :url "https://github.com/riverford/compound"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.9.0-RC2"]
                 [org.clojure/spec.alpha "0.1.143"]]
  :publish {:site "compound"
            :theme "bolton"
            :output "docs"
            :template {:author "Daniel Neal"
                       :logo-white "img/compound_small.png"
                       :email "danielneal@riverford.co.uk"}
            :files {"index" {:input "test/compound/docs.cljc"
                             :site "compound"
                             :title "core"
                             :subtitle "api docs"}}}
  :profiles {:dev {:dependencies [[im.chit/lucid.publish "1.3.13"]
                                  [orchestra "2017.11.12-1"]]}})

Change numbering system for releases

Change numbering system for releases


(defproject jungerer "0.1.2-SNAPSHOT"
  :description "Clojure network/graph library wrapping JUNG"
  :url "https://github.com/totakke/jungerer"
  :license {:name "The BSD 3-Clause License"
            :url "https://opensource.org/licenses/BSD-3-Clause"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [net.sf.jung/jung-algorithms "2.1"]
                 [net.sf.jung/jung-api "2.1"]
                 [net.sf.jung/jung-graph-impl "2.1"]
                 [net.sf.jung/jung-visualization "2.1"]]
  :profiles {:dev {:global-vars {*warn-on-reflection* true}}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}
  :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})

(defproject jungerer "0.1.2-SNAPSHOT"
  :description "Clojure network/graph library wrapping JUNG"
  :url "https://github.com/totakke/jungerer"
  :license {:name "The BSD 3-Clause License"
            :url "https://opensource.org/licenses/BSD-3-Clause"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [net.sf.jung/jung-algorithms "2.1"]
                 [net.sf.jung/jung-api "2.1"]
                 [net.sf.jung/jung-graph-impl "2.1"]
                 [net.sf.jung/jung-visualization "2.1"]]
  :profiles {:dev {:global-vars {*warn-on-reflection* true}
                   :resource-paths ["dev-resources"]}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]
                   :resource-paths ["dev-resources"]}}
  :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})

Add `dev-resources` to `resource-paths` of profile dev and 1.7


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

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

Add conman and mysql deps

Add conman and mysql deps


(defproject com.howardlewisship/bgg-graphql-proxy "0.12.0"
  :description "GraphQL interface to BoardGameGeek"
  :dependencies [[org.clojure/clojure "1.9.0-alpha14"]
                 [io.aviso/logging "0.2.0"]
                 [com.walmartlabs/lacinia "NEXT"]
                 [clj-http "2.3.0"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/data.xml "0.0.8"]
                 [io.pedestal/pedestal.service "0.5.2"]
                 [io.pedestal/pedestal.jetty "0.5.2"]]
  :repositories [["ereceipts-releases"
                  "http://dfw-receipts-jenkins.mobile.walmart.com:8081/nexus/content/repositories/releases/"]]
  :codox {:source-uri ""
          :metadata {:doc/format :markdown}})

(defproject com.howardlewisship/bgg-graphql-proxy "0.12.0"
  :description "GraphQL interface to BoardGameGeek"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [io.aviso/logging "0.2.0"]
                 [com.walmartlabs/lacinia "NEXT"]
                 [clj-http "2.3.0"]
                 [org.clojure/data.json "0.2.6"]
                 [org.clojure/data.xml "0.0.8"]
                 [io.pedestal/pedestal.service "0.5.2"]
                 [io.pedestal/pedestal.jetty "0.5.2"]]
  :repositories [["ereceipts-releases"
                  "http://dfw-receipts-jenkins.mobile.walmart.com:8081/nexus/content/repositories/releases/"]]
  :codox {:source-uri ""
          :metadata {:doc/format :markdown}})

Switch over to latest Lacinia, based on Clojure 1.8


(defproject pjstadig/assertions "0.2.0-SNAPSHOT"
  :description "Zero penalty runtime assertions for Clojure."
  :url "http://github.com/pjstadig/assert"
  :license {:name "Mozilla Public License, v. 2.0"
            :url "http://mozilla.org/MPL/2.0/"}
  :dependencies [[org.clojure/clojure "1.5.1"]]
  :java-source-paths ["src"])

(defproject pjstadig/assertions "0.2.0-SNAPSHOT"
  :description "Zero penalty runtime assertions for Clojure."
  :url "http://github.com/pjstadig/assert"
  :license {:name "Mozilla Public License, v. 2.0"
            :url "http://mozilla.org/MPL/2.0/"}
  :deploy-repositories [["releases" :clojars]]
  :dependencies [[org.clojure/clojure "1.5.1"]]
  :java-source-paths ["src"])

Add clojars as release repository.

Add clojars as release repository.


(defproject io.aviso/twixt "0.1.4"
  :description "An extensible asset pipeline for Clojure web applications"
  :url "https://github.com/AvisoNovate/twixt"
  :license {:name "Apache Sofware Licencse 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ring/ring-core "1.2.0"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.1.2"]
                 [de.neuland/jade4j "0.3.15"]
                 [io.aviso/pretty "0.1.4"]
                 [hiccup "1.0.4"]]
  :repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/twixt/blob/master/"
          :src-linenum-anchor-prefix "L"}
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

(defproject io.aviso/twixt "0.1.4"
  :description "An extensible asset pipeline for Clojure web applications"
  :url "https://github.com/AvisoNovate/twixt"
  :license {:name "Apache Sofware Licencse 2.0"
            :url  "http://www.apache.org/licenses/LICENSE-2.0.html"}
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [org.clojure/tools.logging "0.2.6"]
                 [ring/ring-core "1.2.0"]
                 [org.mozilla/rhino "1.7R4"]
                 [com.github.sommeri/less4j "1.1.2"]
                 [de.neuland/jade4j "0.3.15"]
                 [io.aviso/pretty "0.1.5"]
                 [hiccup "1.0.4"]]
  :repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]]
  :codox {:src-dir-uri               "https://github.com/AvisoNovate/twixt/blob/master/"
          :src-linenum-anchor-prefix "L"}
  :profiles {:dev {:dependencies [[log4j "1.2.17"]
                                  [ring/ring-jetty-adapter "1.2.0"]]}})

Update dependency for pretty to 0.1.5

Update dependency for pretty to 0.1.5


(defproject jungerer "0.1.2"
  :description "Clojure network/graph library wrapping JUNG"
  :url "https://github.com/totakke/jungerer"
  :license {:name "The BSD 3-Clause License"
            :url "https://opensource.org/licenses/BSD-3-Clause"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [net.sf.jung/jung-algorithms "2.1"]
                 [net.sf.jung/jung-api "2.1"]
                 [net.sf.jung/jung-graph-impl "2.1"]
                 [net.sf.jung/jung-io "2.1"]
                 [net.sf.jung/jung-visualization "2.1"]]
  :profiles {:dev {:global-vars {*warn-on-reflection* true}
                   :resource-paths ["dev-resources"]}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]
                   :resource-paths ["dev-resources"]}}
  :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})

(defproject jungerer "0.1.3-SNAPSHOT"
  :description "Clojure network/graph library wrapping JUNG"
  :url "https://github.com/totakke/jungerer"
  :license {:name "The BSD 3-Clause License"
            :url "https://opensource.org/licenses/BSD-3-Clause"}
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [net.sf.jung/jung-algorithms "2.1"]
                 [net.sf.jung/jung-api "2.1"]
                 [net.sf.jung/jung-graph-impl "2.1"]
                 [net.sf.jung/jung-io "2.1"]
                 [net.sf.jung/jung-visualization "2.1"]]
  :profiles {:dev {:global-vars {*warn-on-reflection* true}
                   :resource-paths ["dev-resources"]}
             :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]
                   :resource-paths ["dev-resources"]}}
  :codox {:source-uri "https://github.com/totakke/jungerer/blob/{version}/{filepath}#L{line}"})

Prepare for next development iteration (0.1.3-SNAPSHOT)


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(ns infinispan.test
  (:gen-class)
  (:import (org.infinispan.client.hotrod RemoteCacheManager
                                         RemoteCache)
           (org.infinispan.client.hotrod.configuration ConfigurationBuilder)
           (org.infinispan.client.hotrod.impl ConfigurationProperties)))

(defn -main
  "Creates simple HR client, puts key/value into remote server and reads it back"
  [& args]
  (def conf (ConfigurationBuilder.))
  (.port (.host (.addServer conf) "127.0.0.1") ConfigurationProperties/DEFAULT_HOTROD_PORT)
  (def cm (RemoteCacheManager. (.build conf)))
  (def cache (.getCache cm))
  (println "Sending key -> value")
  (.put cache "key" "value")
  (def value (.get cache "key"))
  (println "Got key -> " value)
  (.stop cm))

(ns infinispan.test
  (:gen-class)
  (:import (org.infinispan.client.hotrod RemoteCacheManager
                                         RemoteCache)
           (org.infinispan.client.hotrod.configuration ConfigurationBuilder)
           (org.infinispan.client.hotrod.impl ConfigurationProperties)))

(defn -main
  "Creates simple HR client, puts key/value into remote server and reads it back"
  [& args]
  (def conf (ConfigurationBuilder.))
  ;;(.port (.host (.addServer conf) "127.0.0.1") ConfigurationProperties/DEFAULT_HOTROD_PORT)
  (-> (.addServer conf) (.host "127.0.0.1") (.port ConfigurationProperties/DEFAULT_HOTROD_PORT))
  (def cm (RemoteCacheManager. (.build conf)))
  (def cache (.getCache cm))
  (println "Sending key -> value")
  (.put cache "key" "value")
  (def value (.get cache "key"))
  (println "Got key -> " value)
  (.stop cm))

Use more readable conf in Cloure clinet

Use more readable conf in Cloure clinet


(ns blaagh.db.core
    (:require [clojure.java.jdbc :as sql])
    (:require [yesql.core :refer [defqueries]]))

(def db-spec {
    :classname "org.sqlite.JDBC"
    :subprotocol "sqlite"
    :subname "resources/db/blaagh.sqlite3"}) ;; creates DB if not already present

(defqueries "blaagh/db/queries.sql"
   {:connection db-spec})

(defn get-all-names []
    (let [results (get-names)]
        (cond
            (empty? results) {:status 404}
            :else results)))

(defn create-tables []
    (try
        (sql/db-do-commands db-spec
            "CREATE TABLE foo (name text); "
            "CREATE TABLE bar (name text); "
            "CREATE TABLE baz (name text); ")
        (catch Exception e
            (println e))))

(defn populate-tables []
    (try
        (sql/db-do-commands db-spec
            "INSERT INTO foo (name) VALUES
                ('Rick'),
                ('Carol'),
                ('Daryl'),
                ('Michonne'),
                ('Glenn'),
                ('Maggie'),
                ('Carl'),
                ('Sasha'),
                ('Abraham'),
                ('Morgan');")
        (catch Exception e
            (println e))))

(ns blaagh.db.core
    (:require [clojure.java.jdbc :as sql])
    (:require [yesql.core :refer [defqueries]]))

(def db-spec {
    :classname "org.sqlite.JDBC"
    :subprotocol "sqlite"
    :subname "resources/db/blaagh.sqlite3"}) ;; creates DB if not already present

(defqueries "blaagh/db/queries.sql"
   {:connection db-spec})

(defn get-all-names []
    (try
        (let [results (get-names)]
            (cond
                (empty? results) {:status 404}
                :else results))
    (catch Exception e
        (println e))))

(defn create-tables []
    (try
        (sql/db-do-commands db-spec
            "CREATE TABLE foo (name text); "
            "CREATE TABLE bar (name text); "
            "CREATE TABLE baz (name text); ")
        (catch Exception e
            (println e))))

(defn populate-tables []
    (try
        (sql/db-do-commands db-spec
            "INSERT INTO foo (name) VALUES
                ('Rick'),
                ('Carol'),
                ('Daryl'),
                ('Michonne'),
                ('Glenn'),
                ('Maggie'),
                ('Carl'),
                ('Sasha'),
                ('Abraham'),
                ('Morgan');")
        (catch Exception e
            (println e))))

Add a try/catch block to get-all-names

Add a try/catch block to get-all-names


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(defproject net.uncontended/beehive "0.2.0"
  :description "Beehive is a Clojure facade for the Precipice library."
  :url "https://github.com/tbrooks8/Beehive"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0"}
  :profiles {:dev {:dependencies [[org.clojure/core.async "0.1.346.0-17112a-alpha"]
                                  [clj-http "1.0.1"]
                                  [criterium "0.4.3"]]}}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [net.uncontended/Precipice "0.1.0"]])

(defproject net.uncontended/beehive "0.2.0"
  :description "Beehive is a Clojure facade for the Precipice library."
  :url "https://github.com/tbrooks8/Beehive"
  :license {:name "Apache License, Version 2.0"
            :url "http://www.apache.org/licenses/LICENSE-2.0"}
  :signing {:gpg-key "tim@uncontended.net"}
  :profiles {:dev {:dependencies [[org.clojure/core.async "0.1.346.0-17112a-alpha"]
                                  [clj-http "1.0.1"]
                                  [criterium "0.4.3"]]}}
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [net.uncontended/Precipice "0.1.0"]])

Add which signing to use

Add which signing to use


(ns leiningen.core
  (:require [leiningen deps test compile]
            [clojure.contrib.with-ns])
  (:gen-class))

(def project nil)

(defmacro defproject [project-name & args]
  ;; This is necessary since we must allow defproject to be eval'd in
  ;; any namespace due to load-file; we can't just create a var with
  ;; def or we would not have access to it once load-file returned.
  `(do (alter-var-root #'project
                       (fn [_#] (assoc (apply hash-map (quote ~args))
                                  :name ~(name project-name)
                                  :root ~(.getParent (java.io.File. *file*)))))
       (def ~project-name project)))

(defn read-project
  ([file] (load-file file)
     project)
  ([] (read-project "project.clj")))

(defn -main [command & args]
  (let [action (ns-resolve (symbol (str "leiningen." command))
                           (symbol command))]
    ;; TODO: ensure tasks run only once
    (apply action (read-project) args)
    ;; In case tests or some other task started any:
    (shutdown-agents)))

(ns leiningen.core
  (:use [clojure.contrib.with-ns])
  (:gen-class))

(def project nil)

(defmacro defproject [project-name & args]
  ;; This is necessary since we must allow defproject to be eval'd in
  ;; any namespace due to load-file; we can't just create a var with
  ;; def or we would not have access to it once load-file returned.
  `(do (alter-var-root #'project
                       (fn [_#] (assoc (apply hash-map (quote ~args))
                                  :name ~(name project-name)
                                  :root ~(.getParent (java.io.File. *file*)))))
       (def ~project-name project)))

;; So it doesn't need to be fully-qualified in project.clj
(with-ns 'user (use ['leiningen.core :only ['defproject]]))

(defn read-project
  ([file] (load-file file)
     project)
  ([] (read-project "project.clj")))

(defn -main [command & args]
  (let [action-ns (symbol (str "leiningen." command))
        _ (require action-ns)
        action (ns-resolve action-ns (symbol command))
        project (read-project)]
    (binding [*compile-path* (or (:compile-path project)
                                 (str (:root project) "/classes/"))]
      ;; TODO: ensure tasks run only once
      (apply action project args)
      ;; In case tests or some other task started any:
      (shutdown-agents))))

Use with-ns so defproject works unqualified. Bind *compile-path* explicitly.

Not sure why explicit *compile-path* is required, but it was getting
reset somehow.


{
 :name "mailit",
 :path "",
 :func (fn [recipient subject intro result-maps]
         (cond
           (pg/eoi? result-maps) (pg/done)

           (every? map? result-maps)
           (let [msgs (for [retmap result-maps]
                        (let [name (retmap :name)
                              [bams csv] (retmap :value)
                              bams (map fs/basename bams)
                              csv (fs/basename csv)
                              exit (retmap :exit)
                              err (retmap :err)]
                          (if (= exit :succss)
                            [exit csv]
                            [exit err [bams csv]])))
                 msg (->> msgs (cons intro) (map str) (str/join "\n"))]
             (pg/send-msg [recipient] subject msg))

           :else
           (let [msg (->> result-maps (cons intro) (map str) (str/join "\n"))]
             (pg/send-msg [recipient] subject msg))))

 :description "General mailer function node. recipient is user account that requested the associated job this node is final pt of DAG, subject is type of job, msg is job finish details."
}

{
 :name "mailit",
 :path "",
 :func (fn [recipient subject intro result-maps]
         (cond
           (pg/eoi? result-maps) (pg/done)

           (every? map? result-maps)
           (let [base (->> result-maps first :value second fs/dirname)
                 msgs (for [retmap result-maps]
                        (let [name (retmap :name)
                              [bams csv] (retmap :value)
                              bams (map fs/basename bams)
                              csv (fs/basename csv)
                              exit (retmap :exit)
                              err (retmap :err)]
                          (if (= exit :success)
                            [exit csv]
                            [exit err [bams csv]])))
                 overall (reduce (fn[R x]
                                   (cond (= x R :success) R
                                         (= x R :fail) R
                                         :else :mixed))
                                 (map first msgs))
                 msg (->> msgs
                          (cons (str "Base '" base "'"))
                          (cons (str "Overall " overall))
                          (cons intro)
                          (map str) (str/join "\n"))]
             (pg/send-msg [recipient] subject msg))

           :else
           (let [msg (->> result-maps (cons intro) (map str) (str/join "\n"))]
             (pg/send-msg [recipient] subject msg))))

 :description "General mailer function node. recipient is user account that requested the associated job this node is final pt of DAG, subject is type of job, msg is job finish details."
}

Adjust job status messaging info

Adjust job status messaging info


(ns whitman.client)

(def source-url [cfg user]
  (format (get cfg "source") user))

(ns whitman.client)

(defn source-url [cfg user]
  (format (get cfg "source") user))

Use defn instead of def

Fix: Use defn instead of def

Oops.


 (ns re-frame.utils)

 (defn warn
   [& args]
   (.warn js/console (apply str args)))

 (defn first-in-vector
  [v]
  (if (vector? v)
    (first v)
    (warn "re-frame: expected a vector event, but got: " v)))

 (ns re-frame.utils)

 (defn warn
   [& args]
   (.warn js/console (apply str args)))

 (defn dbg
   [& args]
   (.debug js/console (apply str args)))

 (defn log
   [& args]
   (.log js/console (apply str args)))

 (defn group
   [& args]
   (.group js/console (apply str args)))

 (defn groupEnd
   []
   (.groupEnd js/console))

 (defn first-in-vector
  [v]
  (if (vector? v)
    (first v)
    (warn "re-frame: expected a vector event, but got: " v)))

Add other round of console API methods. Not very happy about this. But will sort it out later.


(ns bob.test (:use clojure.test))
(load-file "bob.clj")

(deftest responds-to-shouts
  (is (= "Woah, chill out!" (bob/response-for "SHOUTING"))))

(deftest responds-to-questions
  (is (= "Sure." (bob/response-for "A question?"))))

(deftest responds-to-statements
  (is (= "Whatever." (bob/response-for "A statement."))))

(deftest responds-to-silence
  (is (= "Fine, be that way." (bob/response-for ""))))

(run-tests)

(ns bob.test (:use clojure.test))
(load-file "bob.clj")

(deftest responds-to-something
  (is (= "Whatever." (bob/response-for "Tom-ay-to, tom-aaaah-to."))))

(deftest responds-to-shouts
  (is (= "Woah, chill out!" (bob/response-for "WATCH OUT!"))))

(deftest responds-to-questions
  (is (= "Sure." (bob/response-for "Does this cryogenic chamber make me look fat?"))))

(deftest responds-to-forceful-talking
  (is (= "Whatever." (bob/response-for "Let's go make out behind the gym!"))))

(deftest responds-to-acronyms
  (is (= "Whatever." (bob/response-for "It's OK if you don't want to go to the DMV."))))

(deftest responds-to-forceful-questions
  (is (= "Woah, chill out!" (bob/response-for "WHAT THE HELL WERE YOU THINKING?"))))

(deftest responds-to-shouting-with-special-characters
  (is (= "Woah, chill out!" (bob/response-for "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"))))

(deftest responds-to-shouting-numbers
  (is (= "Woah, chill out!" (bob/response-for "1, 2, 3 GO!"))))

(deftest responds-to-shouting-with-no-exclamation-mark
  (is (= "Woah, chill out!" (bob/response-for "I HATE YOU"))))

(deftest responds-to-statement-containing-question-mark
  (is (= "Whatever." (bob/response-for "Ending with ? means a question."))))

(deftest responds-to-silence
  (is (= "Fine, be that way." (bob/response-for ""))))

(run-tests)

Bring tests in line with Ruby tests.

Bring tests in line with Ruby tests.

The Ruby spec for Bob includes a number of tests that clarify certain
points of Bob's behavior.  This commit brings them to the Clojure spec
for Bob.


(ns reports.exporter
  (:require [clojure.java.io :as io])
  (:import java.io.File
           java.util.UUID
           org.waterforpeople.mapping.dataexport.SurveyDataImportExportFactory))

(defn- get-file-extension [t]
  (if (= t "SURVEY_FORM")
    "xls"
    "xlsx"))

(defn- get-file [et id]
  (let [path (str "/var/tmp/akvo/flow/reports/" (UUID/randomUUID))]
    (.mkdirs (io/file path))
    (io/file (format "%s/%s-%s.%s" path et id (get-file-extension et)))))

(defn ^File export-report [type base id options]
  (let [exporter (.getExporter (SurveyDataImportExportFactory.) type)
        file (get-file type id)]
    (.export exporter {"surveyId" id} file base options) file))

(ns reports.exporter
  (:require [clojure.java.io :as io])
  (:import java.io.File
           java.util.UUID
           org.waterforpeople.mapping.dataexport.SurveyDataImportExportFactory))

(defn- get-file-extension [t]
  (if (= t "SURVEY_FORM")
    "xls"
    "xlsx"))

(defn- get-path []
  (format "%s/%s/%s" (System/getProperty "java.io.tmpdir") "akvo/flow/reports" (UUID/randomUUID)))

(defn- get-file [et id]
  (let [path (get-path)]
    (.mkdirs (io/file path))
    (io/file (format "%s/%s-%s.%s" path et id (get-file-extension et)))))

(defn ^File export-report [type base id options]
  (let [exporter (.getExporter (SurveyDataImportExportFactory.) type)
        file (get-file type id)]
    (.export exporter {"surveyId" id} file base options)
    file))

Use java.io.tmpdir for storing the exported files


(ns discuss.cards
  (:require [devcards.core :as dc :refer-macros [defcard defcard-om defcard-om-next dom-node]]
            [sablono.core :as html :refer-macros [html]]
            [om.next :as om :refer-macros [defui]]
            [discuss.parser :as parser]
            [discuss.components.search.statements :refer [SearchQuery]]
            [discuss.utils.common :as lib]
            [discuss.views :as views]))

(enable-console-print!)

(defcard-om discuss
  views/main-view
  lib/app-state)

(defonce test-data {:foo :bar
                    :search/results [:foo :bar :baz]})

(defonce devcard-reconciler
  (om/reconciler {:state test-data
                  :parser (om/parser {:read parser/read :mutate parser/mutate})}))

(defcard search-query-card-no-next
  (dom-node
   (fn [_ node]
     (om/add-root! devcard-reconciler SearchQuery node)))
  {:inspect-data true})

;; -----------------------------------------------------------------------------
;; Start devcards

(defn main []
  ;; conditionally start the app based on whether the #main-app-area
  ;; node is on the page
  (when-let [node (.getElementById js/document "main-app-area")]
    (.render js/ReactDOM (html [:div "This is working"]) node)))
(main)

(ns discuss.cards
  (:require [devcards.core :as dc :refer-macros [defcard defcard-om defcard-om-next dom-node]]
            [sablono.core :as html :refer-macros [html]]
            [om.next :as om :refer-macros [defui]]
            [discuss.parser :as parser]
            [discuss.components.search.statements :refer [SearchQuery Results]]
            [discuss.utils.common :as lib]
            [discuss.views :as views]))

(enable-console-print!)

(defcard-om discuss
  views/main-view
  lib/app-state)

(defonce test-data {:foo :bar
                    :search/results [:foo :bar :baz]})

(defonce devcard-reconciler
  (om/reconciler {:state test-data
                  :parser (om/parser {:read parser/read :mutate parser/mutate})}))

(defcard search-query
  (dom-node
   (fn [_ node]
     (om/add-root! parser/reconciler SearchQuery node)))
  {:inspect-data true})

(defcard search-results
  (dom-node
   (fn [_ node]
     (om/add-root! parser/reconciler Results node)))
  {:inspect-data true})

;; -----------------------------------------------------------------------------
;; Start devcards

(defn main []
  ;; conditionally start the app based on whether the #main-app-area
  ;; node is on the page
  (when-let [node (.getElementById js/document "main-app-area")]
    (.render js/ReactDOM (html [:div "This is working"]) node)))
(main)

Add separate card for search-results

Add separate card for search-results


(ns lcmap.clownfish.configuration
  "Supplies system configuration map"
  (:require [clojure.string :as str]
            [clojure.tools.logging :as log]
            [dire.core :as dire :refer [with-handler!]]
            [lcmap.commons.numbers :refer [numberize]]
            [mount.core :refer [defstate] :as mount]))

(defn- tokenize
  "Split a string on whitespace and returns a vector of the tokens or nil if
   the value was untokenizable"
  [value]
  (vec (remove #(zero? (count %)) (str/split value #" "))))

(with-handler! #'tokenize
  [java.lang.NullPointerException java.lang.ClassCastException]
  (fn [e & args] nil))

(defn config-map
  [env]
  {:http   {:port (numberize (:http-port env))
            :join? false :daemon? true}
   :event  {:host (:event-host env)
            :port (numberize (:event-port env))}
   :db     {:keyspace (:db-keyspace env)
            :cluster {:contact-points (tokenize (:db-url env))
                      :credentials {:user (:db-user env)
                                    :password (:db-pass env)}}}
   :server {:exchange (:exchange env) :queue (:queue env)}
   :chip-specs-url (:chip-specs-url env)})

(defstate config
  :start (log/spy :debug (config-map ((mount/args) :environment))))

(ns lcmap.clownfish.configuration
  "Supplies system configuration map"
  (:require [clojure.string :as str]
            [clojure.tools.logging :as log]
            [dire.core :as dire :refer [with-handler!]]
            [lcmap.commons.numbers :refer [numberize]]
            [mount.core :refer [defstate] :as mount]))

(defn- tokenize
  "Split a string on whitespace and returns a vector of the tokens or nil if
   the value was untokenizable"
  [value]
  (vec (remove #(zero? (count %)) (str/split value #" "))))

(with-handler! #'tokenize
  [java.lang.NullPointerException java.lang.ClassCastException]
  (fn [e & args] nil))

(defn config-map
  [env]
  {:http   {:port (numberize (:http-port env))
            :join? false :daemon? true}
   :event  {:host (:event-host env)
            :port (numberize (:event-port env))}
   :db     {:keyspace (:db-keyspace env)
            :cluster {:contact-points (tokenize (:db-url env))
                      :credentials {:user (:db-user env)
                                    :password (:db-pass env)}
                      :query-options {:consistency :quorum}}}
   :server {:exchange (:exchange env) :queue (:queue env)}
   :chip-specs-url (:chip-specs-url env)})

(defstate config
  :start (log/spy :debug (config-map ((mount/args) :environment))))

Set DB consistency to quorum

Set DB consistency to quorum


(ns reitit.doo-runner
  (:require [doo.runner :refer-macros [doo-tests]]
            reitit.coercion-test
            reitit.core-test
            reitit.impl-test
            reitit.middleware-test
            reitit.ring-test
            #_reitit.spec-test
            reitit.exception-test
            reitit.frontend.core-test
            reitit.frontend.history-test
            reitit.frontend.controllers-test))

(enable-console-print!)

(doo-tests 'reitit.coercion-test
           'reitit.core-test
           'reitit.impl-test
           'reitit.middleware-test
           'reitit.ring-test
           #_'reitit.spec-test
           'reitit.exception-test
           'reitit.frontend.core-test
           'reitit.frontend.history-test
           'reitit.frontend.controllers-test)

(ns reitit.doo-runner
  (:require [doo.runner :refer-macros [doo-tests]]
            reitit.coercion-test
            reitit.core-test
            reitit.impl-test
            reitit.middleware-test
            reitit.ring-test
            reitit.spec-test
            reitit.exception-test
            reitit.frontend.core-test
            reitit.frontend.history-test
            reitit.frontend.controllers-test))

(enable-console-print!)

(doo-tests 'reitit.coercion-test
           'reitit.core-test
           'reitit.impl-test
           'reitit.middleware-test
           'reitit.ring-test
           'reitit.spec-test
           'reitit.exception-test
           'reitit.frontend.core-test
           'reitit.frontend.history-test
           'reitit.frontend.controllers-test)

Return of the spec-tests for cljs

Return of the spec-tests for cljs


(ns evermind.domain.core-test
  (:require [clojure.test :refer :all]
            [evermind.domain.core :refer :all]
            [clojure.spec.test.alpha :as stest]
            [evermind.test-util :as tu]))

(defn fixture [f]
  (tu/instrument-namespaces)
  (f))

(use-fixtures :once fixture)

(deftest test-create-node
         (is (tu/check 'evermind.domain.core/create-node)))

(deftest test-set-attributes
         (is (tu/check 'evermind.domain.core/set-attributes)))

(deftest test-add-child
         (is (tu/check 'evermind.domain.core/add-child)))

(deftest test-remove-child
  (is (tu/check 'evermind.domain.core/remove-child)))

(deftest test-filter-children
         (is (tu/check 'evermind.domain.core/filter-children)))

(deftest test-create-mindmap
         (is (tu/check 'evermind.domain.core/create-mindmap)))

(ns evermind.domain.core-test
  (:require [clojure.test :refer :all]
            [evermind.domain.core :refer :all]
            [clojure.spec.test.alpha :as stest]
            [evermind.test-util :as tu]))

(defn fixture [f]
  (tu/instrument-namespaces)
  (f))

(use-fixtures :once fixture)

(deftest test-create-node
         (is (tu/check 'evermind.domain.core/create-node)))

(deftest test-set-attributes
         (is (tu/check 'evermind.domain.core/set-attributes)))

(deftest test-add-child
         (is (tu/check 'evermind.domain.core/add-child)))

(deftest test-remove-child
  (is (tu/check 'evermind.domain.core/remove-child)))

(deftest test-filter-children
         (is (tu/check 'evermind.domain.core/filter-children {::clojure.spec.test.check/opts {:num-tests 10}})))

(deftest test-create-mindmap
         (is (tu/check 'evermind.domain.core/create-mindmap)))

Fix number of tests for filter-children.


(ns ^{:doc "A way to keep track of the pertinent context of the current nested fact.
            Currently, that is only the fact's description/doc-string"}
  midje.internal-ideas.fact-context
  (:use [clojure.string :only [join]]))

(def fact-context (atom []))

(defn nested-descriptions []
  @fact-context)

(defn- enter-runtime-context [description]
  (swap! fact-context conj description))

(defn- leave-runtime-context []
  (swap! fact-context #(vec (butlast %))))

(defmacro within-runtime-fact-context [description & body]
  `(try
     (#'enter-runtime-context ~description)
     ~@body
     (finally
       (#'leave-runtime-context))))

(ns ^{:doc "A way to keep track of the pertinent context of the current nested fact.
            Currently, that is only the fact's description/doc-string"}
  midje.internal-ideas.fact-context
  (:use [clojure.string :only [join]]))

(def ^{:dynamic true} *fact-context* [])

(defn nested-descriptions []
  *fact-context*)

(defmacro within-runtime-fact-context [description & body]
  `(binding [*fact-context* (conj *fact-context* ~description)]
     ~@body))

Switch from atom to var

Switch from atom to var


{:user {:dependencies [[slamhound "1.3.1"]
                       [org.clojure/tools.namespace "0.2.4"]
                       [clj-stacktrace "0.2.7"]]
        :plugins [[lein-difftest "2.0.0"]
                  [lein-marginalia "0.7.1"]
                  [lein-pprint "1.1.1"]
                  [lein-swank "1.4.4"]
                  [lein-kibit "0.0.8"]]

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

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

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

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

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

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

Add cloverage to lein plugins

Add cloverage to lein plugins


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

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

Prepare for next release cycle.

Prepare for next release cycle.


(ns incise.watcher
  (:require [taoensso.timbre :refer [error]]
            [clojure.stacktrace :refer [print-cause-trace]]
            [watchtower.core :refer [watcher rate file-filter extensions
                                     on-change]]))

(defn log-exceptions [func]
  "Log (i.e. print) exceptions received from the given function."
  (let [out *out*
        err *err*]
    (fn [& args]
      (binding [*out* out
                *err* err]
        (try
          (apply func args)
          (catch Exception e
            (error (with-out-str (print-cause-trace e)))))))))

(defn per-change [change-fn]
  (fn [files]
    (doseq [file files]
      (change-fn file))))

(defn watch
  [change-fn]
  (watcher ["resources/posts/" "resources/pages/"]
           (rate 300)
           (on-change (-> change-fn
                          per-change
                          log-exceptions))))

(def watching nil)

(defn start-watching [& args]
  (alter-var-root #'watching (fn [& _] (apply watch args))))

(defn stop-watching []
  (when watching
    (future-cancel watching)))

(ns incise.watcher
  (:require [taoensso.timbre :refer [error]]
            [clojure.stacktrace :refer [print-cause-trace]]
            [watchtower.core :refer [watcher rate file-filter extensions
                                     on-change]])
  (:import [java.io File]))

(defn log-exceptions [func]
  "Log (i.e. print) exceptions received from the given function."
  (let [out *out*
        err *err*]
    (fn [& args]
      (binding [*out* out
                *err* err]
        (try
          (apply func args)
          (catch Exception e
            (error (with-out-str (print-cause-trace e)))))))))

(defn per-change [change-fn]
  (fn [files]
    (doseq [file files]
      (change-fn file))))

(def gitignore-file? [^File file]
  (= (.getName file) ".gitignore"))

(defn delete-recursively
  "Delete a directory tree."
  [^File root]
  (when (.isDirectory root)
    (doseq [file (remove gitignore-file? (.listFiles root))]
      (delete-recursively file)))
  (.delete root))

(defn watch
  [change-fn]
  (delete-recursively (File. "resources/public/"))
  (watcher ["resources/posts/" "resources/pages/"]
           (rate 300)
           (on-change (-> change-fn
                          per-change
                          log-exceptions))))

(def watching nil)

(defn start-watching [& args]
  (alter-var-root #'watching (fn [& _] (apply watch args))))

(defn stop-watching []
  (when watching
    (future-cancel watching)))

Delete public directory when watching starts.


(ns graphql-clj.box
  (:import [clojure.lang IObj IDeref IPersistentCollection Named]
           [java.io Writer]))

(deftype Box [value meta]

  IObj
  (meta [_] meta)

  IDeref
  (deref [_] (if (instance? Box value) @value value))

  IPersistentCollection
  (equiv [a b] (.equals a b))

  Named
  (getName [this] (if (instance? Box value) (.getName value) (.toString this)))

  Object
  (equals [_ b] (if (instance? Box b) (= value @b) (= value b)))
  (hashCode [_] (.hashCode value))
  (toString [_] (str value)))

(defmethod print-method Box [v ^Writer w]
  (.write w (.toString v)))

(defn kv->box
  "Given a single key value pair in a map, preserve metadata for the value."
  [value]
  (let [m (meta value)
        [[k v]] (vec value)]
    {k (->Box v m)}))

(defn box->val
  "Given a potentially boxed value, strip the box and return the raw value.
   Same as identity if value is already unboxed"
  [v]
  (if (instance? Box v) @v v))

(ns graphql-clj.box
  (:import [clojure.lang IObj IDeref IPersistentCollection Named]
           [java.io Writer]))

(deftype Box [value meta]

  IObj
  (meta [_] meta)

  IDeref
  (deref [_] (if (instance? Box value) @value value))

  IPersistentCollection
  (equiv [a b] (.equals a b))

  Named
  (getName [_] (if (instance? Box value) (.getName value) (str value)))

  Object
  (equals [_ b] (if (instance? Box b) (= value @b) (= value b)))
  (hashCode [_] (.hashCode value))
  (toString [_] (str value)))

(defmethod print-method Box [v ^Writer w]
  (.write w (.toString v)))

(defn kv->box
  "Given a single key value pair in a map, preserve metadata for the value."
  [value]
  (let [m (meta value)
        [[k v]] (vec value)]
    {k (->Box v m)}))

(defn box->val
  "Given a potentially boxed value, strip the box and return the raw value.
   Same as identity if value is already unboxed"
  [v]
  (if (instance? Box v) @v v))

Use str instead of .toString

Use str instead of .toString