allow turning off source-map for react-native

--- src/main/shadow/build/targets/react_native.clj
+++ src/main/shadow/build/targets/react_native.clj
@@ -150,36 +150,37 @@
   (SourceCodeEscapers/javascriptEscaper))

 (defn generate-eval-js [{:keys [build-sources] :as state}]
-  (reduce
-    (fn [state src-id]
-      (cond
-        (= src-id output/goog-base-id)
-        state
-
-        ;; already generated
-        (get-in state [:output src-id :eval-js])
-        state
-
-        :else
-        (let [{:keys [output-name] :as rc} (data/get-source-by-id state src-id)
-              {:keys [js] :as output} (data/get-output! state rc)
-              source-map? (output/has-source-map? output)
-
-              code
-              (cond-> js
-                source-map?
-                ;; FIXME: the url here isn't really used, wonder if there is a way to do something useful here
-                (str "\n//# sourceURL=http://localhost:8081/app/" output-name "\n"
-                     ;; "\n//# sourceMappingURL=http://localhost:8081/app/cljs-runtime/" output-name ".map\n"
-                     ;; FIXME: inline map saves having to know the actual URL
-                     (output/generate-source-map-inline state rc output "")
-                     ))]
-
-          ;; pre-cache for later so it doesn't get regenerated on hot-compiles
-          (assoc-in state [:output src-id :eval-js]
-            (str "SHADOW_ENV.evalLoad(\"" output-name "\", \"" (.escape js-escaper ^String code) "\");")))))
-    state
-    build-sources))
+  (let [gen-source-map? (not (false? (get-in state [:compiler-options :source-map])))]
+    (reduce
+      (fn [state src-id]
+        (cond
+          (= src-id output/goog-base-id)
+          state
+
+          ;; already generated
+          (get-in state [:output src-id :eval-js])
+          state
+
+          :else
+          (let [{:keys [output-name] :as rc} (data/get-source-by-id state src-id)
+                {:keys [js] :as output} (data/get-output! state rc)
+                source-map? (and gen-source-map? (output/has-source-map? output))
+
+                code
+                (cond-> js
+                  source-map?
+                  ;; FIXME: the url here isn't really used, wonder if there is a way to do something useful here
+                  (str "\n//# sourceURL=http://localhost:8081/app/" output-name "\n"
+                       ;; "\n//# sourceMappingURL=http://localhost:8081/app/cljs-runtime/" output-name ".map\n"
+                       ;; FIXME: inline map saves having to know the actual URL
+                       (output/generate-source-map-inline state rc output "")
+                       ))]
+
+            ;; pre-cache for later so it doesn't get regenerated on hot-compiles
+            (assoc-in state [:output src-id :eval-js]
+              (str "SHADOW_ENV.evalLoad(\"" output-name "\", \"" (.escape js-escaper ^String code) "\");")))))
+      state
+      build-sources)))

 (defn eval-load-sources [state sources]
   (->> sources


fix preloadable tags

fix preloadable tags

--- src/cljs/swarmpit/component/service/form_settings.cljs
+++ src/cljs/swarmpit/component/service/form_settings.cljs
@@ -57,7 +57,8 @@
                         :InputLabelProps {:shrink true}}
        :onChange       (fn [v]
                          (state/update-value [:repository :tag] (-> v .-value) form-value-cursor)
-                         (ports/load-suggestable-ports (-> v .-value)))
+                         (ports/load-suggestable-ports (merge value
+                                                              {:tag (-> v .-value)})))
        :value          {:label (:tag value)
                         :value (:tag value)}
        :placeholder    "Search a tag"})))


project.clj tweaks

project.clj tweaks

--- src/leiningen/new/yawt/project.clj
+++ src/leiningen/new/yawt/project.clj
@@ -60,7 +60,6 @@
                          :compiler     {:output-to     "resources/public/cljs/main.js"
                                         :source-map    "resources/public/cljs/main.js.map"
                                         :output-dir    "resources/public/cljs/target"
-                                        :externs       ["externs/jquery.js"]
                                         :optimizations :none
                                         :pretty-print  true}}}}

@@ -74,6 +73,7 @@
                                         :builds {:main
                                                  {:compiler ^:replace
                                                             {:output-to     "resources/public/cljs/main.js"
+                                                             :externs       ["externs/jquery.js"]
                                                              :optimizations :advanced
                                                              :pretty-print  false}}}}
 {{/webapp}}
@@ -91,5 +91,6 @@
                                         (pjstadig.humane-test-output/activate!)]}
              :repl    {:resource-paths ["env-resources/repl"]
                        :source-paths   ["dev"]}}
+
  :aliases {"uberjar" ["do" "clean" {{#webapp}}["cljsbuild" "clean"]{{/webapp}} "uberjar"]{{#webapp}}
-           "mkcljs" ["do" ["cljsbuild" "clean"] ["cljsbuild" "once"] ["cljsbuild" "auto"]]{{/webapp}}})+           "cljsdev" ["do" ["cljsbuild" "clean"] ["cljsbuild" "once"] ["cljsbuild" "auto"]]{{/webapp}}})


helper to invert reverse source maps

helper to invert reverse source maps

--- src/main/cljs/cljs/source_map.cljs
+++ src/main/cljs/cljs/source_map.cljs
@@ -278,3 +278,28 @@
         (recur (next line-map-seq)
           (assoc new-lines line new-cols)))
       new-lines)))
+
+;; -----------------------------------------------------------------------------
+;; Reverse Source Map Inversion
+
+(defn invert-reverse-map
+  "Given a ClojureScript to JavaScript source map, invert it. Useful when
+   mapping JavaScript stack traces when environment support is unavailable."
+  [reverse-map]
+  (let [inverted (atom (sorted-map))]
+    (doseq [[line columns] reverse-map]
+      (doseq [[column column-info] columns]
+        (doseq [{:keys [gline gcol name]} column-info]
+          (swap! inverted update-in [gline]
+            (fnil (fn [columns]
+                    (update-in columns [column] (fnil conj [])
+                      {:line line :col column :name name}))
+              (sorted-map))))))
+    @inverted))
+
+(comment
+  (invert-reverse-map
+    {1
+     {1 [{:gcol 0, :gline 0, :name "cljs.core/map"}],
+      5 [{:gcol 24, :gline 0, :name "cljs.core/inc"}]}})
+  )


bump par compile timeout

bump par compile timeout

--- src/main/shadow/build/compiler.clj
+++ src/main/shadow/build/compiler.clj
@@ -627,65 +627,68 @@
   (assert (set? requires))
   (assert (set? provides))

-  (loop [idle-count 1]
-    (let [ready @ready-ref]
-      (cond
-        ;; skip work if errors occured
-        (seq @errors-ref)
-        src
-
-        ;; only compile once all dependencies are compiled
-        ;; FIXME: sleep is not great, cljs.core takes a couple of sec to compile
-        ;; this will spin a couple hundred times, doing additional work
-        ;; don't increase the sleep time since many files compile in the 5-10 range
-        (not (set/superset? ready requires))
-        (do (Thread/sleep 5)
-            ;; forcefully abort compilation when waiting longer than 30sec
-            ;; otherwise the compilation runs forever with no way to abort
-            (when (>= idle-count idle-count 5999) ;; so the 3000 below doesn't trigger
-              (let [pending (set/difference requires ready)]
-
-                (swap! errors-ref assoc resource-id
-                  (ex-info (format "aborted par-compile, %s still waiting for %s"
-                             resource-id
-                             pending)
-                    {:aborted resource-id
-                     :pending pending}))))
-
-            ;; diagnostic warning if we are still waiting for something to compile for 15+ sec
-            (when (zero? (mod idle-count 3000))
-              (let [pending (set/difference requires ready)]
-                (log/warnf "%s waiting for %s" resource-id pending)))
-
-            (recur (inc idle-count)))
-
-        :ready-to-compile
-        (try
-          (let [output (generate-output-for-source state src)
-
-                ;; FIXME: this does not seem ideal
-                ;; maybe generate-output-for-source should expose the actual provides it generated
-
-                ;; we need to mark aliases as ready as soon as a resource is ready
-                ;; cljs.spec.alpha also provides clojure.spec.alpha only
-                ;; if someone used the alias since that happened at resolve time
-                ;; the resource itself does not provide the alias
-                provides
-                (reduce
-                  (fn [provides provide]
-                    (if-let [alias (get-in state [:ns-aliases-reverse provide])]
-                      (conj provides alias)
-                      provides))
+  (let [waiting-since (System/currentTimeMillis)]
+    (loop [idle-count 1]
+      (let [ready @ready-ref]
+        (cond
+          ;; skip work if errors occured
+          (seq @errors-ref)
+          src
+
+          ;; only compile once all dependencies are compiled
+          ;; FIXME: sleep is not great, cljs.core takes a couple of sec to compile
+          ;; this will spin a couple hundred times, doing additional work
+          ;; don't increase the sleep time since many files compile in the 5-10 range
+          (not (set/superset? ready requires))
+          (do (Thread/sleep 5)
+
+              ;; diagnostic warning if we are still waiting for something to compile for 15+ sec
+              (when (zero? (mod idle-count 3000))
+                (let [pending (set/difference requires ready)]
+                  (log/warnf "%s waiting for %s" resource-id pending)))
+
+              ;; forcefully abort compilation when waiting longer than 60sec
+              ;; otherwise the compilation runs forever with no way to abort
+              (when (> (- (System/currentTimeMillis) waiting-since)
+                       60000)
+                (let [pending (set/difference requires ready)]
+
+                  (swap! errors-ref assoc resource-id
+                    (ex-info (format "aborted par-compile, %s still waiting for %s"
+                               resource-id
+                               pending)
+                      {:aborted resource-id
+                       :pending pending}))))
+
+              (recur (inc idle-count)))
+
+          :ready-to-compile
+          (try
+            (let [output (generate-output-for-source state src)
+
+                  ;; FIXME: this does not seem ideal
+                  ;; maybe generate-output-for-source should expose the actual provides it generated
+
+                  ;; we need to mark aliases as ready as soon as a resource is ready
+                  ;; cljs.spec.alpha also provides clojure.spec.alpha only
+                  ;; if someone used the alias since that happened at resolve time
+                  ;; the resource itself does not provide the alias
                   provides
-                  provides)]
-
-            (swap! ready-ref set/union provides)
-            output)
-
-          (catch Throwable e ;; asserts not covered by Exception
-            (swap! errors-ref assoc resource-id e)
-            src
-            ))))))
+                  (reduce
+                    (fn [provides provide]
+                      (if-let [alias (get-in state [:ns-aliases-reverse provide])]
+                        (conj provides alias)
+                        provides))
+                    provides
+                    provides)]
+
+              (swap! ready-ref set/union provides)
+              output)
+
+            (catch Throwable e ;; asserts not covered by Exception
+              (swap! errors-ref assoc resource-id e)
+              src
+              )))))))

 (def load-core-lock (Object.))


more docstrings.

more docstrings.

--- src/metabase/driver/crate/util.clj
+++ src/metabase/driver/crate/util.clj
@@ -49,7 +49,9 @@
 (def ^:private ^:const year   (* 365 day))
 (def ^:private ^:const month  (Math/round (float (/ year 12))))

-(defn date [_ unit expr]
+(defn date
+  "ISQLDriver `date` implementation"
+  [_ unit expr]
   (let [v (if (instance? Timestamp expr)
             (kx/literal (u/date->iso-8601 expr))
             expr)]


CMR-1223: Address review comments

CMR-1223: Address review comments

--- system-int-test/test/cmr/system_int_test/jobs_test.clj
+++ system-int-test/test/cmr/system_int_test/jobs_test.clj
@@ -30,15 +30,15 @@
     (is (= 204 (:status (perform-action-on-jobs :post url :pause token)))))
   (s/only-with-real-database
     (testing "jobs are marked as paused"
-      (is (= [200 true]
-             (let [response (perform-action-on-jobs :get url :status token)]
+      (let [response (perform-action-on-jobs :get url :status token)]
+        (is (= [200 true]
                [(:status response)
                 (paused? response)])))))
   (testing "resume returns 204"
     (is (= 204 (:status (perform-action-on-jobs :post url :resume token)))))
   (testing "jobs are not marked as paused"
-    (is (= [200 false]
-           (let [response (perform-action-on-jobs :get url :status token)]
+    (let [response (perform-action-on-jobs :get url :status token)]
+      (is (= [200 false]
              [(:status response)
               (paused? response)])))))


Wrap en/html-resource

Wrap en/html-resource

--- src/servisne_info/scrape/ns_rs.clj
+++ src/servisne_info/scrape/ns_rs.clj
@@ -5,11 +5,14 @@
   {:url "http://www.021.rs/"
    :links-path "Novi-Sad/Servisne-informacije/"})

+(defn html-resource [url]
+  (en/html-resource (java.net.URL. url)))
+
 (defn info-links-url [site]
   (str (:url site) (:links-path site)))

 (defn info-links-page [site]
-  (en/html-resource (java.net.URL. (info-links-url site))))
+  (html-resource (info-links-url site)))

 (defn info-links [html]
   (map


Updates simple-xpath to work with any seq, not just vectors.

--- umm-spec-lib/src/cmr/umm_spec/simple_xpath.clj
+++ umm-spec-lib/src/cmr/umm_spec/simple_xpath.clj
@@ -325,6 +325,7 @@
   (cond
     (nil? data) []
     (vector? data) data
+    (sequential? data) (vec data)
     :else [data]))

 (defmulti process-data-selector


Tundra: s3 datastore housekeeping

Tundra: s3 datastore housekeeping

--- src/taoensso/carmine/tundra/s3.clj
+++ src/taoensso/carmine/tundra/s3.clj
@@ -16,21 +16,21 @@
 (defrecord S3DataStore [creds bucket]
   IDataStore
   (put-key [this k v]
-    (let [s3-reply (try (s3/put-object creds bucket k (ByteArrayInputStream. v)
-                          {:content-length (count v)
-                           ;; Nb! Prevents overwriting with corrupted data:
-                           :content-md5    (base64-md5 v)})
-                        (catch Exception e e))]
+    (let [reply (try (s3/put-object creds bucket k (ByteArrayInputStream. v)
+                       {:content-length (count v)
+                        ;; Nb! Prevents overwriting with corrupted data:
+                        :content-md5    (base64-md5 v)})
+                     (catch Exception e e))]
       (cond
-       (instance? PutObjectResult s3-reply) true
-       (and (instance? AmazonS3Exception s3-reply)
-            (= (.getMessage ^AmazonS3Exception s3-reply)
+       (instance? PutObjectResult reply) true
+       (and (instance? AmazonS3Exception reply)
+            (= (.getMessage ^AmazonS3Exception reply)
                "The specified bucket does not exist"))
        (let [bucket (first (str/split bucket #"/"))]
          (s3/create-bucket creds bucket)
          (recur k v))
-       (instance? Exception s3-reply) s3-reply
-       :else (Exception. "Unexpected reply type"))))
+       (instance? Exception reply) reply
+       :else (Exception. (format "Unexpected reply: %s" reply)))))

   (fetch-key [this k]
     (let [obj (s3/get-object creds bucket k)


♻ Reorder functions

♻ Reorder functions

Why:
- Avoids the need for a `declare`.

--- src/territory_bro/todo_tracker.clj
+++ src/territory_bro/todo_tracker.clj
@@ -5,12 +5,31 @@
 (ns territory-bro.todo-tracker
   (:refer-clojure :exclude [get]))

+(defn get [m k]
+  (let [{::keys [state desired actual]
+         :or {desired :absent, actual :absent}} (get-in m [::todo k])]
+    {:state state
+     :desired desired
+     :actual actual
+     :action (case [desired actual]
+               [:present :absent] :create
+               [:absent :present] :delete
+               :ignore)}))
+
+(defn creatable [m]
+  (->> (::creatable m)
+       (map #(get-in m [::todo % ::state]))))
+
+(defn deletable [m]
+  (->> (::deletable m)
+       (map #(get-in m [::todo % ::state]))))
+
+
 (defn merge-state [m k new-state]
   (update-in m [::todo k ::state] merge new-state))

 (def ^:private conj-set (fnil conj #{}))

-(declare get)
 (defn- update-indexes [m k]
   (let [action (:action (get m k))]
     (-> m
@@ -33,22 +52,3 @@
   (-> m
       (assoc-in [::todo k ::actual] presence)
       (update-indexes k)))
-
-(defn get [m k]
-  (let [{::keys [state desired actual]
-         :or {desired :absent, actual :absent}} (get-in m [::todo k])]
-    {:state state
-     :desired desired
-     :actual actual
-     :action (case [desired actual]
-               [:present :absent] :create
-               [:absent :present] :delete
-               :ignore)}))
-
-(defn creatable [m]
-  (->> (::creatable m)
-       (map #(get-in m [::todo % ::state]))))
-
-(defn deletable [m]
-  (->> (::deletable m)
-       (map #(get-in m [::todo % ::state]))))


Remove print

Remove print

--- frontend/src/cruncher/moves/main.cljs
+++ frontend/src/cruncher/moves/main.cljs
@@ -22,5 +22,4 @@
         STAB (if (or (= type-1 (:type move)) (= type-2 (:type move)))
                1.25
                1)]
-    (print type-1 " - " type-2 " - Move-Type: " (:type move))
     (pprint/cl-format nil "~,2f" (/ (* (:power move) 1000 STAB) (:duration-ms move)))))


:bug: Only add undo entry when undo changes is not empty.

--- frontend/src/app/main/data/workspace/common.cljs
+++ frontend/src/app/main/data/workspace/common.cljs
@@ -79,7 +79,7 @@
           (when (and save-undo? (not= uidx ::not-found))
             (rx/of (reset-undo uidx)))

-          (when save-undo?
+          (when (and save-undo? (seq undo-changes))
             (let [entry {:undo-changes undo-changes
                          :redo-changes changes}]
               (rx/of (append-undo entry))))))))))


new version -- wipe preferences

new version -- wipe preferences

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@9672 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/DataBrowser/src/org/micromanager/browser/core.clj
+++ plugins/DataBrowser/src/org/micromanager/browser/core.clj
@@ -62,7 +62,7 @@
 (def open-in-ram (atom false))

 (def prefs (.. Preferences userRoot
-      (node "MMDataBrowser") (node "b3d184b1-c580-4f06-a1d9-b9cc00f12641")))
+      (node "MMDataBrowser2") (node "70db64a1-2fd5-4438-812d-5c668b036659")))

 (def tags [
   "ChColors" "ChContrastMax" "ChContrastMin" "ChNames" "Channels" "Comment"
@@ -462,7 +462,7 @@
     (or (read-value-from-prefs prefs "collection-files")
         (let [name (System/getProperty "user.name")]
           {name (.getAbsolutePath (file (JavaUtils/getApplicationDataPath)
-                                        (str name ".mmdb.txt")))}))))
+                                        (str name ".mmdb2.txt")))}))))

 (defn save-collection-map []
   (write-value-to-prefs prefs "collection-files" @collections))


Changing 404 to 422.

Changing 404 to 422.

--- src/kixi/hecuba/amon.clj
+++ src/kixi/hecuba/amon.clj
@@ -265,7 +265,7 @@
           (throw (ex-info "No path resolved for Location header"
                           {:entity-id id})))
         (ring-response {:headers {"Location" location}}))
-      (ring-response {:status 404 :body "Provided projectId not found."}))))
+      (ring-response {:status 422 :body "Provided projectId not found."}))))

 (defresource entity [{:keys [commander querier]} handlers]
   :allowed-methods #{:get :delete}


Remove hard-coded starting color from CLI runner

--- src/cljs/zetawar/cli.cljs
+++ src/cljs/zetawar/cli.cljs
@@ -44,13 +44,16 @@
 (defn ^:export -main [& args]
   (let [system (ig/init cli-game-config)
         ev-chan (-> system :zetawar.system/router :ev-chan)
+        conn (-> system :zetawar.system/datascript :conn)
         rl (.createInterface readline #js {"input" js/process.stdin
                                            "output" js/process.stdout
                                            "terminal" false})]
     (.on rl "line" (fn [line] (end-turn system)))
     (println "Hello from the Zetawar game runner!")
     (app/start-new-game! (:zetawar.system/game system) :sterlings-aruba-ai-vs-ai)
-    (router/dispatch ev-chan
-                     [:zetawar.events.player/send-game-state :faction.color/blue])))
+    (router/dispatch ev-chan [:zetawar.events.player/send-game-state
+                              (->> @conn
+                                   app/current-game
+                                   game/current-faction-color)])))

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


CMR-3254: Addressed review comments.

CMR-3254: Addressed review comments.

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2/distributions_related_url.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/iso19115_2/distributions_related_url.clj
@@ -69,7 +69,7 @@
         ;; outcome of ECSE-129.
         :let [browse-url (or (value-of url "gmd:fileName/gmx:FileName/@src")
                              (value-of url "gmd:fileName/gco:CharacterString"))]]
-    {:URLs [(when browse-url (str/trim browse-url))]
+    {:URLs (when browse-url [(str/trim browse-url)])
      :Description (char-string-value url "gmd:fileDescription")
      :Relation (when-let [rel (resource-name->types (char-string-value url "gmd:fileType"))]
                  [rel])}))


Доработки и исправления. Добавлена галерея, панели и списки


add transform functions

add transform functions

--- saas-dsl/src/saas_dsl/parse.clj
+++ saas-dsl/src/saas_dsl/parse.clj
@@ -49,3 +49,17 @@
                      zip/remove
                      (zip/append-child reduced-indent-node)))))
       (recur (zip/next loc)))))
+
+(defn transform-to-sass-nested-three-whitout-zipper
+  "Given a sass string, return a nested vector"
+  [sass-string]
+  {:pre [(= (class sass-str) java.lang.String)]}
+  (push-down-indents (zip/vector-zip (get-lines sass-str))))
+
+(defn transform-to-sass-nested-tree
+  "Given a sass string, return a zipper."
+  [sass-str]
+  {:pre [(= (class sass-str) java.lang.String)]
+   :post [(not (nil? %))]}
+  (zip/vector-zip (transform-to-sass-nested-tree-without-zipper sass-str)))
+


Better way to ensure full lifecycle is complete.

--- test/onyx/peer/lifecycles_test.clj
+++ test/onyx/peer/lifecycles_test.clj
@@ -127,10 +127,6 @@
   (fact (set (butlast results)) => expected)
   (fact (last results) => :done))

-;; hacky wait to ensure that tasks have had a chance shutdown
-;; before we actually check whether the lifecycles were called
-(Thread/sleep 1000)
-
 (def expected-order
   [:task-started
    :task-before
@@ -148,10 +144,12 @@
    :batch-after
    :task-after])

-(fact @counter => expected-order)
-
+;; shutdown-peer ensure peers are fully shutdown so that
+;; :task-after will have been set
 (doseq [v-peer v-peers]
   (onyx.api/shutdown-peer v-peer))
+
+(fact @counter => expected-order)

 (onyx.api/shutdown-peer-group peer-group)


fix horribly indiect enqueueing mechanism

--- test/western_music/lib/ui_test.clj
+++ test/western_music/lib/ui_test.clj
@@ -15,24 +15,16 @@
 (def sample-tracks
   (delay (map comp/track (:data/raw @sample-data))))

+(defn enqueue-tracks-directly [data tracks]
+  (update-in data ui/player-path #(reduce ui/player-enqueue-track % tracks)))
+
 (deftest test-play
   (testing "Nothing Enqueued"
     (let [player (get-in @sample-data ui/player-path)]
       (is (= {:db player} (ui/player-play player)))))
   (testing "With Enqueued"
     (let [tracks (into [] (take 5) @sample-tracks)
-          with-tracklist (assoc-in @sample-data (conj ui/player-path :player/track-list) tracks)
-          with-enqueued (update-in with-tracklist ui/player-path
-                                   #(reduce (fn [player track-id]
-                                              (->> track-id
-                                                   (ui/player-track-lookup player)
-                                                   (ui/player-enqueue-track player)))
-                                            % (map :track/id tracks))
-                                   ;; TODO wew lad, can do better than
-                                   ;; that^. Prolly a little refactor
-                                   ;; action in the real code, too
-                                   ;; (then can test!)
-                                   )
+          with-enqueued (enqueue-tracks-directly @sample-data tracks)
           player (get-in with-enqueued ui/player-path)
           with-playing (ui/player-play player)]
       (is (= (first tracks) (:player/playing (:db with-playing))))


fix agreement of "hurt"

fix agreement of "hurt"

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -707,13 +707,16 @@

    "hurt" (let [common {:english {:past "hurt"}
                         :synsem {:cat :verb}}]
-            [(let [subject-semantics (ref {:human true})]
+            [(let [subject-semantics (ref {:human true})
+                   subject-agr (ref :top)]
                (merge common
                       {:synsem {:sem {:pred :hurt-oneself
                                       :subj subject-semantics
                                       :obj subject-semantics}
-                                :subcat {:1 {:sem subject-semantics}
-                                         :2 {:pronoun true
+                                :subcat {:1 {:agr subject-agr
+                                             :sem subject-semantics}
+                                         :2 {:agr subject-agr
+                                             :pronoun true
                                              :reflexive true
                                              :sem subject-semantics}}}}))
              (merge common
@@ -1284,11 +1287,10 @@
               :pronoun true
               :case :acc
               :reflexive true
-              :agr {:person :1st
+              :agr {:person :3rd
                     :number :plur
                     :gender :fem}
-              :sem {:human true
-                    :pred :loro}
+              :sem {:human true}
               :subcat '()}}

     {:note "♂"
@@ -1296,11 +1298,10 @@
               :pronoun true
               :case :acc
               :reflexive true
-              :agr {:person :1st
+              :agr {:person :3rd
                     :number :plur
                     :gender :masc}
-              :sem {:human true
-                    :pred :loro}
+              :sem {:human true}
               :subcat '()}}]

    ;; TODO: move gender symbol to :notes for all "they" variants.


added fall asleep

added fall asleep

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -399,6 +399,18 @@
    "faint" {:synsem {:cat :verb
                      :sem {:pred :faint}}}

+   "fall asleep"
+   (let [subject-semantics (ref {:animate true})]
+     {:synsem {:cat :verb
+               :sem {:pred :fall-asleep
+                     :subj subject-semantics
+                     :obj subject-semantics}
+               :subcat {:1 {:sem subject-semantics}
+                        :2 '()}}
+      :english {:participle "falling asleep"
+                :present {:3sing "falls asleep"}
+                :past "fell asleep"}})
+
    "finish" {:synsem {:cat :verb
                       :sem {:pred :finish}}}


reference the commodity, not the id, from context

--- src/clj/clj_money/trading.clj
+++ src/clj/clj_money/trading.clj
@@ -59,9 +59,9 @@

 (defn- create-price
   "Given a context, calculates and appends the share price"
-  [{:keys [storage shares value commodity-id trade-date] :as context}]
+  [{:keys [storage shares value commodity trade-date] :as context}]
   (assoc context :price (prices/create storage
-                                       {:commodity-id commodity-id
+                                       {:commodity-id (:id commodity)
                                         :trade-date trade-date
                                         :price (with-precision 4 (/ value shares))})))


actually drop eval frames from Chrome

actually drop eval frames from Chrome

--- src/clj/cljs/repl/browser.clj
+++ src/clj/cljs/repl/browser.clj
@@ -266,7 +266,7 @@
   (->> st
     string/split-lines
     (drop 1) ;; drop the error message
-    (take-while #(not (.startsWith % "\tat eval")))
+    (take-while #(not (.startsWith % "    at eval")))
     (map #(chrome-st-el->frame % opts))
     (remove nil?)
     vec))


Implemented Advanced Assembly Lines

Implemented Advanced Assembly Lines

--- src/clj/game/cards-assets.clj
+++ src/clj/game/cards-assets.clj
@@ -50,6 +50,20 @@
 (def cards-assets
   {"Adonis Campaign"
    (campaign 12 3)
+
+   "Advanced Assembly Lines"
+   {:effect (effect (gain :credit 3))
+    :msg (msg "gain 3 [Credits]")
+    :abilities [{:label "[Trash]: Install a non-agenda card from HQ"
+                 :effect (effect (trash card) (corp-install target nil))
+                 :msg (msg (corp-install-msg target))
+                 :prompt "Choose a non-agenda card to install from HQ"
+                 :priority true
+                 :req (req (not (:run @state)))
+                 :choices {:req #(and (not (is-type? % "Operation"))
+                                      (not (is-type? % "Agenda"))
+                                      (= (:zone %) [:hand])
+                                      (= (:side %) "Corp"))}}]}

    "Aggressive Secretary"
    (advance-ambush 2 {:effect


Throw an exception if fs/delete-tree fails

--- src/clj/mdr2/archive/core.clj
+++ src/clj/mdr2/archive/core.clj
@@ -184,8 +184,11 @@
           multi-volume? (prod/multi-volume? production)]
       (when (fs/exists? archive-path)
         ;; when repairing the production is already in the spool dir
-        (log/warnf "Archive path %s for periodical already exists, removing" archive-path)
-        (fs/delete-tree archive-path))
+        (when-not (fs/delete-tree archive-path)
+          (let [message (format "Failed to remove archive path for periodical (%s)"
+                                archive-path)]
+            (log/error message)
+            (throw (ex-info message {:error-id ::spool-dir-remove-failed})))))
       (fs/create-dirs archive-path)
       ;; create the rdf
       (let [rdf-path (file archive-path (str dam-number ".rdf"))
@@ -210,8 +213,11 @@
           multi-volume? (prod/multi-volume? production)]
       (when (fs/exists? archive-path)
         ;; when repairing the production is already in the spool dir
-        (log/warnf "Archive path %s for other production already exists, removing" archive-path)
-        (fs/delete-tree archive-path))
+        (when-not (fs/delete-tree archive-path)
+          (let [message (format "Failed to remove archive path for other production (%s)"
+                                archive-path)]
+            (log/error message)
+            (throw (ex-info message {:error-id ::spool-dir-remove-failed})))))
       (fs/create-dirs archive-path)
       ;; create the rdf
       (let [rdf-path (file archive-path (str dam-number ".rdf"))


bugfix explorer load

bugfix explorer load

--- src/clj/pinkgorilla/core.cljs
+++ src/clj/pinkgorilla/core.cljs
@@ -4,7 +4,7 @@
    ;; [taoensso.timbre :refer-macros [info]]
    [secretary.core :as secretary]
    [reagent.core :as ra]
-   [re-frame.core :refer [dispatch-sync]]
+   [re-frame.core :refer [dispatch-sync dispatch]]
    ;; [pinkgorilla.events.usage-analytics]
    [pinkgorilla.subs] ; bring subs to scope
    [pinkgorilla.events] ; bring all events to scope
@@ -38,6 +38,7 @@
     ;; TODO config (+ settings-local-storage) init should kick off off after config is processed
     (dispatch-sync [:settings-localstorage-load])
     (dispatch-sync [:initialize-config])
+    (dispatch [:explore-load])
     (mount-root)
     (when read-write
       (nrepl-kernel/init! (ws-origin "repl/" app-url)))


Start work on #34

Start work on #34

--- src/clj_simple_chart/axis.clj
+++ src/clj_simple_chart/axis.clj
@@ -16,10 +16,12 @@
           (format (str "%." (number-of-decimals scale) "f") v))))

 (defn ticks-for-scale [scale]
-  (let [domain (:domain (meta scale))
+  (let [scale-type (:scale-type (meta scale))
+        domain (:domain (meta scale))
         num-ticks (get (meta scale) :ticks 10)
         tiks (ticks/ticks (first domain) (last domain) num-ticks)]
-    tiks))
+    (cond (= :band scale-type) domain
+          :else tiks)))

 (defn tick-pos-scale [scale d]
   (let [scale-type (get (meta scale) :scale-type :default)


Add bandage character

Add bandage character

--- src/cljc/robinson/render.cljc
+++ src/cljc/robinson/render.cljc
@@ -1260,6 +1260,7 @@
                                                               :fishing-pole    ["/"]
                                                               :match           ["/"]
                                                               :flashlight      [","]
+                                                              :bandage         ["&"]
                                                               :saw             [","]
                                                               :tarp            [","]
                                                               :spellbook       ["+"]


Adds instructions on pushing jars with Boot

Insert middle column with information on pushing to Clojars using Boot.

Closes #578

--- src/clojars/web/dashboard.clj
+++ src/clojars/web/dashboard.clj
@@ -30,12 +30,22 @@
     structured-data/organisation
     [:article.row
      (helpers/select-text-script)
-     [:div.push-information.col-md-6.col-lg-6.col-sm-6.col-xs-12
+     [:div.push-information.col-md-4.col-lg-4.col-sm-4.col-xs-12
       [:h3.push-header "Push with Leiningen"]
       [:div#leiningen.push-example {:onClick "selectText('leiningen');"}
        [:pre.push-example-leiningen
         (tag "$") " lein deploy clojars\n"]]]
-     [:div.push-information.col-md-6.col-lg-6.col-sm-6.col-xs-12
+     [:div.push-information.col-md-4.col-lg-4.col-sm-4.col-xs-12
+      [:h3.push-header "Push with "
+        (link-to "http://boot-clj.com/" "Boot")
+        " (using "
+        (link-to "https://github.com/adzerk/bootlaces" "bootlaces")
+        ")"]
+      [:div#boot.push-example {:onClick "selectText('boot');"}
+       [:pre.push-example-boot
+        (tag "$") " boot build-jar push-snapshot\n"
+        (tag "$") " boot build-jar push-release\n"]]]
+     [:div.push-information.col-md-4.col-lg-4.col-sm-4.col-xs-12
       [:h3.push-header "Maven Repository"]
       [:div#maven.push-example {:onClick "selectText('maven');"}
        [:pre


Cleaned up iso mime-types.

Cleaned up iso mime-types.

--- src/cmr/common/mime_types.clj
+++ src/cmr/common/mime_types.clj
@@ -9,9 +9,7 @@
   {"application/json" :json
    "application/xml" :xml
    "application/echo10+xml" :echo10
-   "application/iso+xml" :iso
    "application/iso-smap+xml" :iso-smap
-   "application/iso-mends+xml" :iso-mends
    "application/iso19115+xml" :iso19115
    "application/dif+xml" :dif
    "text/csv" :csv
@@ -21,9 +19,9 @@
   {:json "application/json"
    :xml "application/xml"
    :echo10 "application/echo10+xml"
-   :iso "application/iso+xml"
+   :iso "application/iso19115+xml"
    :iso-smap "application/iso-smap+xml"
-   :iso-mends "application/iso-mends+xml"
+   :iso-mends "application/iso19115+xml"
    :iso19115 "application/iso19115+xml"
    :dif "application/dif+xml"
    :csv "text/csv"


avoid preventing global drop

avoid preventing global drop

--- src/collabsubtitles/core.cljs
+++ src/collabsubtitles/core.cljs
@@ -83,7 +83,7 @@
 (defn read-file-as-text [file]
   (let [reader (js/FileReader.)
         c (chan)]
-    (set! (.-onload reader) (fn [e] (put! c (-> reader .-result)) (close! c)))
+    (set! (.-onload reader) (fn [_] (put! c (-> reader .-result)) (close! c)))
     (.readAsText reader file)
     c))

@@ -92,26 +92,22 @@
         add-class (partial $/add-class $video "collabsubtitles-dragover")
         remove-class (partial $/remove-class $video "collabsubtitles-dragover")]
     (doto $video
-      ($/on "dragenter dragover" add-class)
+      ($/on "dragenter dragover" #(do (add-class) false))
       ($/on "dragleave dragend" remove-class)
       ($/on "drop" (fn [e]
                      (remove-class)
                      (doseq [file (jq-event-files e)]
                        (go
                          (let [vtt-content (<! (read-file-as-text file))]
-                           (add-subtitles video {:cues (parse-vtt vtt-content)})))))))))
+                           (add-subtitles video {:cues (parse-vtt vtt-content)}))))
+                     false)))))

 (defn setup-player-integration [video]
   (setup-subtitle-drop video)
   (setup-youtube-player-integration video))

 (defn init []
-  (set! (.-ondragover js/window) #(.preventDefault %))
-  (set! (.-ondrop js/window) #(.preventDefault %))
-
   (let [videos (find-videos "body")]
     (log "found videos" videos)
     (doseq [video videos]
       (setup-player-integration video))))
-
-(defn init-background [])


Update comment in example main.

Update comment in example main.

--- examples/movie-lens-recommender/src/movie_lens/main.clj
+++ examples/movie-lens-recommender/src/movie_lens/main.clj
@@ -53,7 +53,10 @@
 (defn -main
   "Main entry point for example."
   [& args]
-  ; TODO: parameterize block and ref locations?
+  ; TODO: parameterize:
+  ; - block url
+  ; - ref tracker
+  ; - spark master
   (let [dataset-path (first args)
         store-cfg {:block-url "data/db/blocks"}
         store (load/init-store store-cfg)
@@ -64,7 +67,6 @@
         conn (conn/connect graph tracker)]
     (spark/with-context spark-ctx (-> (conf/spark-conf)
                                       (conf/app-name "movie-lens-recommender")
-                                      ; TODO: parameterize master
                                       (conf/master "local"))
       (try
         (let [movies (load/build-dataset-table!


Little bit of a risky change: switching from ~A to ~S when formatting paths

--- src/structural_typing/guts/type_descriptions/readable.clj
+++ src/structural_typing/guts/type_descriptions/readable.clj
@@ -7,7 +7,7 @@
   (if (and (= 1 (count components))
            (keyword? (first components)))
     (str (first components))
-    (cl-format nil "[~{~A~^ ~}]" components)))
+    (cl-format nil "[~{~S~^ ~}]" components)))

 (defn friendly [path]
   (->> path


Fix check for EOF in incomplete expression

--- server/src/main/clojure/vimclojure/nails.clj
+++ server/src/main/clojure/vimclojure/nails.clj
@@ -270,7 +270,7 @@
               (recur (read *in* false eof)))))
         (catch clojure.lang.LispReader$ReaderException exc
           (let [e (.getCause exc)]
-            (if (= "EOF while reading" (.getMessage e))
+            (if (.startsWith (.getMessage e) "EOF while reading")
               false
               (throw exc))))))))


unused io.pedestal.http.route

unused io.pedestal.http.route

--- src/ephemeris_api/service.clj
+++ src/ephemeris_api/service.clj
@@ -1,6 +1,5 @@
 (ns ephemeris-api.service
   (:require [io.pedestal.http :as bootstrap]
-            [io.pedestal.http.route :as route]
             [io.pedestal.interceptor :refer [interceptor]]
             [pedestal-api
              [core :as api]


transaction docstrings.

transaction docstrings.

--- src/grafter/rdf/protocols.clj
+++ src/grafter/rdf/protocols.clj
@@ -31,10 +31,11 @@
   (to-statements [this options]))

 (defprotocol ITransactable
-  "Transactions support"
-  (begin [repo])
-  (commit [repo])
-  (rollback [repo]))
+  "Low level protocol for transactions support.  Most users probably
+  want to use grafter.rdf.sesame/with-transaction"
+  (begin [repo] "Start a transaction")
+  (commit [repo] "Commit a transaction")
+  (rollback [repo]) "Rollback a transaction")

 (defrecord Triple
     [s p o]


Add drums for clapping music.

Add drums for clapping music.

--- src/kolmogorov_music/talk.clj
+++ src/kolmogorov_music/talk.clj
@@ -113,7 +113,7 @@
   (let [african-bell-pattern (rhythm [1/8 1/8 1/4 1/8 1/4 1/4 1/8 1/4])]
     (->> african-bell-pattern forever (all :part :clap1)
          (canon
-           #(->> % (take 64) (then (rhythm [1/8])) forever (all :part :clap2))))))
+           #(->> % (take 32) (then (rhythm [1/8])) forever (all :part :clap2))))))

 (comment
   (live/play (clapping-music))
@@ -121,7 +121,7 @@

 (fact "Clapping Music is minimal."
   (definitional description-length clapping-music) => 228
-  (result-length (->> (clapping-music) (take-while #(-> % :time (< 216))))) => 99151)
+  (result-length (->> (clapping-music) (take-while #(-> % :time (< 216))))) => 99416)

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; The Library of Babel ;;;
@@ -219,11 +219,21 @@
 ;;; Arrangement ;;;
 ;;;;;;;;;;;;;;;;;;;

+(definst drum [freq 110 vol 0.5 pan 0]
+  (-> (* 2/3 (brown-noise))
+      (+ (* 1/2 (sin-osc (* 3 freq))))
+      (+ (* 1/5 (sin-osc (* 5 freq))))
+      (clip2 0.8)
+      (rlpf (line:kr freq (* 7 freq) 0.02))
+      (* (env-gen (adsr 0.02 0.4 0.15 0.2) (line:kr 1 0 0.1) :action FREE))
+      (pan2 pan)
+      (* vol)))
+
 (defmethod live/play-note :clap1 [_]
-  ((sample "samples/click2.wav")))
+  (drum 100 :pan 0.75))

 (defmethod live/play-note :clap2 [_]
-  ((sample "samples/select-click.wav")))
+  (drum 150 :pan -0.75))

 (defmethod live/play-note :default
   [{midi :pitch seconds :duration}]


Fix dexing if no dependency projects are specified

--- src/leiningen/droid/build.clj
+++ src/leiningen/droid/build.clj
@@ -30,12 +30,13 @@
   (let [dx-bin (str sdk-path "/platform-tools/dx")
         no-optimize (if (dev-build? project) "--no-optimize" "")
         annotations (str sdk-path "/tools/support/annotations.jar")
-        deps (unique-jars (resolve-dependencies :dependencies project))]
+        deps (unique-jars (resolve-dependencies :dependencies project))
+        external-paths (or external-classes-paths [])]
     (with-process [proc (map str
                              (flatten [dx-bin "--dex" no-optimize
                                        "--output" out-dex-path
                                        compile-path annotations deps
-                                       external-classes-paths]))]
+                                       external-paths]))]
       (.addShutdownHook (Runtime/getRuntime) (Thread. #(.destroy proc))))))

 (defn crunch-resources


Write nrepl port into “”target/repl-port

Allows nrepl/cider port discovery with {:nrepl {:start? true}}

--- src/leiningen/ring/server.clj
+++ src/leiningen/ring/server.clj
@@ -46,6 +46,10 @@
 (defn start-nrepl-expr [project]
   (let [port (-> project :ring :nrepl (:port 0))]
     `(let [{port# :port} (clojure.tools.nrepl.server/start-server :port ~port)]
+       (-> "target/repl-port"
+           java.io.File.
+           (#(do (.deleteOnExit %) %))
+           (spit port#))
        (println "Started nREPL server on port" port#))))

 (defn server-task


launch build timings to non admin users

launch build timings to non admin users

--- src-cljs/frontend/components/build_head.cljs
+++ src-cljs/frontend/components/build_head.cljs
@@ -875,7 +875,7 @@
                   (when (not= 0 fail-count)
                     [:span {:class "fail-count"} fail-count]))]])

-            (when (and admin? (build-model/finished? build))
+            (when (build-model/finished? build)
               [:li {:class (when (= :build-timing selected-tab) "active")}
                [tab-link {:href "#build-timing"} "Build Timing"]])


added locale component using tower - fixing test

--- resources/leiningen/new/closp/integtest/clj/web/setup.clj
+++ resources/leiningen/new/closp/integtest/clj/web/setup.clj
@@ -7,7 +7,8 @@
             [{{ns}}.components.handler :refer [new-handler]]
             [{{ns}}.components.config :as c]
             [{{ns}}.components.db :refer [new-db]]
-            [joplin.core :as j]))
+            [joplin.core :as j]
+            [foo.bar.components.locale :as l]))

 (def db-uri "jdbc:sqlite:./db/{{name}}-integ-test.sqlite")
 (def migrators "resources/migrators/sqlite")
@@ -36,9 +37,10 @@

 (defn test-system []
   (component/system-map
+    :locale (l/new-locale)
     :config (c/new-config test-config)
     :db (component/using (new-db) [:config])
-    :handler (component/using (new-handler) [:config])
+    :handler (component/using (new-handler) [:config :locale])
     :web (component/using (new-web-server) [:handler :config])))

 (def test-base-url (str "http://localhost:3001/"))


Show workflows ahead of user in queue - Remove Launching status

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/launch_analysis.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/method_configs/launch_analysis.cljs
@@ -18,13 +18,12 @@
 (defn- entity->id [entity]
   {:type (entity "entityType") :name (entity "name")})

-;; GAWB-662
-;; show Queued first, then Launching, and collapse all remaining states into Active
+;; GAWB-662 / GAWB-715
+;; show Queued first, ignore Launching, and collapse all remaining states into Active
 (defn queue-status-remap [queue-status]
   (let [status-count-map (queue-status "workflowCountsByStatus")]
     (assoc queue-status "workflowCountsByStatus"
       [["Queued" (get status-count-map "Queued" 0)]
-       ["Launching" (get status-count-map "Launching" 0)]
        ["Active" (apply + (vals (dissoc status-count-map "Queued" "Launching")))]])))

 (defn queue-status-table-row [[status count]]
@@ -35,16 +34,18 @@

 (defn queue-status-table [state]
   (let [error-msg (:submission-queue-error-message @state)
-        queue-status (:submission-queue-status @state)]
+        queue-status (:submission-queue-status @state)
+        {:strs [estimatedQueueTimeMS workflowsBeforeNextUserWorkflow workflowCountsByStatus]} queue-status]
     [:div {:style {:marginBottom "1em" :float "right"}}
      (cond
        error-msg (style/create-server-error-message error-msg)
        (not queue-status) [comps/Spinner {:text "Loading submission queue status..."}]
        :else
        [:div {}
-        [:div {} "Estimated wait time: " (.humanize (js/moment.duration (queue-status "estimatedQueueTimeMS")))]
+        [:div {} "Estimated wait time: " (.humanize (js/moment.duration estimatedQueueTimeMS))]
+        [:div {} (str "There are " workflowsBeforeNextUserWorkflow " workflows ahead of yours in the queue.")]
         "Queue Status: "
-        (map queue-status-table-row (queue-status "workflowCountsByStatus"))])]))
+        (map queue-status-table-row workflowCountsByStatus)])]))

 (defn- render-form [state props]
   [:div {}


Switch heartbeating logic around for readability

--- src/onyx/peer/coordinator.clj
+++ src/onyx/peer/coordinator.clj
@@ -158,7 +158,7 @@
           (if-let [new-replica (poll! allocation-ch)]
             ;; Set up reallocation barriers. Will be sent on next recur through :offer-barriers
             (recur (emit-reallocation-barrier state new-replica))
-            (cond (< (+ (:last-heartbeat-time state) heartbeat-ns) (System/nanoTime))
+            (cond (> (System/nanoTime) (+ (:last-heartbeat-time state) heartbeat-ns))
                   ;; Immediately offer heartbeats
                   (recur (offer-heartbeats state))

@@ -166,8 +166,7 @@
                   ;; Continue offering barriers until success
                   (recur (offer-barriers state))

-                  (< (+ (:last-barrier-time state) barrier-period-ns)
-                     (System/nanoTime))
+                  (> (System/nanoTime) (+ (:last-barrier-time state) barrier-period-ns))
                   ;; Setup barriers, will be sent on next recur through :offer-barriers
                   (recur (periodic-barrier state))


Let's look at timestamps and see if the AS reports the app fully deployed before the test starts.

--- integration-tests/src/test/clojure/immutant/integs/basic.clj
+++ integration-tests/src/test/clojure/immutant/integs/basic.clj
@@ -20,21 +20,22 @@
         clojure.test)
   (:require [clj-http.client :as client]))

-(use-fixtures :once (with-deployment *file*
-                      '{
-                        :root "target/apps/ring/basic-ring/"
-                        :init basic-ring.core/init-web
-                        :context-path "/basic-ring"
-                        }))
+(use-fixtures :once
+  (with-deployment *file*
+      '{
+        :root "target/apps/ring/basic-ring/"
+        :init basic-ring.core/init-web
+        :context-path "/basic-ring"
+        }))

 (deftest simple "it should work"
-  (Thread/sleep 5000)
+  (println "simple:" (java.sql.Timestamp. (.getTime (java.util.Date.))))
   (let [result (client/get "http://localhost:8080/basic-ring")]
     ;(println "RESPONSE" result)
     (is (.startsWith (result :body) "Hello from Immutant!"))))

 (deftest app-should-have-its-config
-  (Thread/sleep 5000)
+  (println "ashic:" (java.sql.Timestamp. (.getTime (java.util.Date.))))
   (let [result (client/get "http://localhost:8080/basic-ring")]
     ;(println "RESPONSE" result)
     (is (.contains (result :body) ":ham :biscuit"))))


Update helpers.file

Update helpers.file

* add #'file?
* allow java.io.File objects to pass through #'resolve-tilde-path
* return path to downloaded file in #'download-file-*
* add #'mk-tmp-dir

--- src/overtone/helpers/file.clj
+++ src/overtone/helpers/file.clj
@@ -2,11 +2,17 @@
     ^{:doc "Useful file manipulation fns"
       :author "Sam Aaron"}
   overtone.helpers.file
-  (:import [java.net URL])
+  (:import [java.net URL]
+           [java.io StringWriter File])
   (:use [clojure.java.io]
         [overtone.helpers.string])
   (:require [org.satta.glob :as satta-glob]
             [clojure.java.io :as io]))
+
+(defn file?
+  "Returns true if f is of type java.io.File"
+  [f]
+  (= java.io.File (type f)))

 (defn- files->abs-paths
   "Given a seq of java.io.File objects, returns a seq of absolute paths for each
@@ -33,21 +39,25 @@
 (declare mk-path)

 (defn resolve-tilde-path
-  [path]
-  (cond
-   (= "~" path)
-   (home-dir)
-
-   (.startsWith path (str "~" (file-separator)))
-   (mk-path [(home-dir) (chop-first-n 2 path)])
-
-   :default
-   path))
+  "Resolves path names starting with ~ to point to home directory. If path is a
+  java.io.File object, returns it unchanged."
+  [path]
+  (if (file? path)
+    path
+    (cond
+     (= "~" path)
+     (home-dir)
+
+     (.startsWith path (str "~" (file-separator)))
+     (mk-path (home-dir) (chop-first-n 2 path))
+
+     :default
+     path)))

 (defn mk-path
   "Takes a seq of strings and returns a string which is a concatanation of all
   the input strings separated by the system's default file separator."
-  [parts]
+  [& parts]
   (let [path (apply str (interpose (file-separator) parts))]
     (resolve-tilde-path path)))

@@ -118,7 +128,8 @@
   (let [target-path (resolve-tilde-path target-path)]
     (with-open [in  (io/input-stream url)
                 out (io/output-stream target-path)]
-      (io/copy in out))))
+      (io/copy in out))
+    target-path))

 (defn- download-file-with-timeout
   "Downloads remote file at url to local file specified by target path. If data
@@ -131,7 +142,20 @@
     (.setReadTimeout con timeout)
     (with-open [in (.getInputStream con)
                 out (io/output-stream target-path)]
-      (io/copy in out))))
+      (io/copy in out))
+    target-path))
+
+(defn get-file-with-timeout
+  "Returns a stringified version of the file pointed to by url. If download
+  stalls for more than timeout ms an exception is thrown."
+  [url timeout]
+  (let [url (URL. url)
+        con  (.openConnection url)]
+    (.setReadTimeout con timeout)
+    (with-open [in (.getInputStream con)
+                out (StringWriter.)]
+      (io/copy in out)
+      (.toString out))))

 (defn download-file
   "Downloads the file pointed to by URI to local path target-path. If no timeout
@@ -170,3 +194,20 @@
   (let [path (resolve-tilde-path path)
         f (File. path)]
     (.exists f)))
+
+(defn mk-tmp-dir
+  "Creates a unique temporary directory on the filesystem. Typically in /tmp on
+  *NIX systems. Returns a File object pointing to the new directory. Raises an
+  exception if the directory couldn't be created after 10000 tries."
+  []
+  (let [base-dir (File. (System/getProperty "java.io.tmpdir"))
+        base-name (str (System/currentTimeMillis) "-" (long (rand 1000000000)) "-")
+        max-attempts 10000]
+    (loop [num-attempts 1]
+      (if (= num-attempts max-attempts)
+        (throw (Exception. (str "Failed to create temporary directory after " max-attempts "attempts.")))
+        (let [tmp-dir-name (str base-dir base-name num-attempts)
+              tmp-dir (File. tmp-dir-name)]
+          (if (.mkdir tmp-dir)
+            tmp-dir
+            (recur (inc num-attempts))))))))


Add conditions for searc-and-replace method

--- src/cljs/salava/social/ui/badge_message.cljs
+++ src/cljs/salava/social/ui/badge_message.cljs
@@ -96,8 +96,8 @@
                         (conj current str2))))]
       (reduce str-space ()  a-seq)))

-(defn search-and-replace-www [item]
-  (let [split-words (clojure.string/split item #" ")
+(defn search-and-replace-www [text]
+  (let [split-words (clojure.string/split text #" ")
         helper (fn [current item]
                  (if (or (re-find #"www." item) (re-find #"^https?://" item) (re-find #"^http?://" item))
                      (conj current (hyperlink item))
@@ -116,7 +116,9 @@
       [:span.date (date-from-unix-time (* 1000 ctime) "minutes")]
      ]
     (into [:div] (for [ item (clojure.string/split-lines message)]
-                   (into [:p.msg] (search-and-replace-www item))))]])
+                   (into [:p.msg] (if (or (re-find #"www." item) (re-find #"^https?://" item) (re-find #"^http?://" item))
+                                    (search-and-replace-www item)
+                                    item))))]])

 (defn message-list-load-more [state]
   (if (pos? (:messages_left @state))


CMR-276: Added to comment for truncate-highest about sequence order.

--- src/cmr/metadata_db/data/oracle/concepts.clj
+++ src/cmr/metadata_db/data/oracle/concepts.clj
@@ -64,7 +64,8 @@

 (defn- truncate-highest
-  "Return a sequence with the highest top-n values removed from the input sequence."
+  "Return a sequence with the highest top-n values removed from the input sequence. The
+  originall order of the sequence may not be preserved."
   [values top-n]
   (drop-last top-n (sort values)))


Add logic to detect whether the OS is Linux and return the `Epoll` classes if so. If not, use the NIO classes.

--- src/riemann/transport/tcp.clj
+++ src/riemann/transport/tcp.clj
@@ -72,8 +72,12 @@

     (isSharable [] true)))

-(def transport {:event-loop-group-fn #(NioEventLoopGroup.)
-                :channel NioServerSocketChannel})
+(def transport
+  (if (.contains (. System getProperty "os.name") "Linux")
+    {:event-loop-group-fn #(EpollEventLoopGroup.)
+     :channel EpollServerSocketChannel}
+    {:event-loop-group-fn #(NioEventLoopGroup.)
+     :channel NioServerSocketChannel}))

 (defn tcp-handler
   "Given a core, a channel, and a message, applies the message to core and


Just dealing with clojure vectors.

Just dealing with clojure vectors.


(PDB-4512) Switch catalog-inputs to an inner join against certnames

So that the drop-unused-joins optimizer has an opportunity to avoid
the expense when you only extract fields that are in the certnames
table.

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -786,12 +786,13 @@
       "inputs" {:type :array
                 :queryable? true
                 :field :ci.inputs}}
-     :selection {:from [[{:select [:certname_id
+     :selection {:from [:certnames]
+                 :join [[{:select [:certname_id
                                    [(hcore/raw "array_agg(array[catalog_inputs.type, name])") :inputs]]
                           :from [:catalog_inputs]
-                          :group-by [:certname_id]} :ci]]
-                 :left-join [:certnames
-                             [:= :certnames.id :ci.certname_id]]}
+                          :group-by [:certname_id]} :ci]
+                        [:= :certnames.id :ci.certname_id]]
+                 :where [:<> :certnames.catalog_inputs_timestamp nil]}
      :relationships certname-relations

      :entity :catalog-inputs


Extract more fns

Extract more fns

--- src-cljs/game_of_life/draw.cljs
+++ src-cljs/game_of_life/draw.cljs
@@ -5,10 +5,16 @@
 (def board-size (* cell-size 50))
 (def glider #{[1 1] [1 3] [2 3] [2 2] [3 2]})

+(defn- clear-board [context]
+  (.clearRect context 0 0 board-size board-size))
+
+(defn- draw-cell [x y context]
+  (.fillRect context (* cell-size x) (* cell-size y) cell-size cell-size))
+
 (defn- draw [living-cells context]
-  (.clearRect context 0 0 board-size board-size)
+  (clear-board context)
   (doseq [[x y] living-cells]
-    (.fillRect context (* cell-size x) (* cell-size y) cell-size cell-size)))
+    (draw-cell x y context)))

 (defn- run [board context]
   (draw board context)


run analysis independently

run analysis independently

--- src/worker/plastic/worker/editor/layout.cljs
+++ src/worker/plastic/worker/editor/layout.cljs
@@ -1,8 +1,8 @@
 (ns plastic.worker.editor.layout
   (:require-macros [plastic.logging :refer [log info warn error group group-end]]
-                   [plastic.frame :refer [dispatch main-dispatch]]
                    [plastic.common :refer [process]])
   (:require [plastic.worker.editor.model :as editor]
+            [plastic.frame :refer [as-independent] :refer-macros [dispatch main-dispatch]]
             [plastic.worker.editor.layout.builder :refer [build-layout]]
             [plastic.worker.editor.layout.selections :refer [build-selections-render-info]]
             [plastic.worker.editor.layout.structural :refer [build-structural-web]]
@@ -23,7 +23,7 @@
         spatial-web-patch (prepare-map-patch (editor/get-spatial-web-for-unit editor unit-id) spatial-web)
         structural-web (build-structural-web unit-loc layout)
         structural-web-patch (prepare-map-patch (editor/get-structural-web-for-unit editor unit-id) structural-web)]
-    (dispatch (editor/get-context editor) [:editor-run-analysis editor-id unit-id])                                   ; TODO: here should be async dispatch
+    (dispatch (editor/get-context editor) (as-independent [:editor-run-analysis editor-id unit-id]))
     (main-dispatch (editor/get-context editor) [:editor-commit-layout-patch editor-id unit-id layout-patch
                                                 spatial-web-patch structural-web-patch])
     (-> editor


Continue refactoring to put tree as last parameter.

--- src/ahnentafel/gedcom/query.clj
+++ src/ahnentafel/gedcom/query.clj
@@ -3,44 +3,44 @@
 (defn- find-items [tag tree]
   (filter #(= tag (:tag %)) (:subordinate-lines tree)))

-(defn- find-item [tree tag]
+(defn- find-item [tag tree]
   (first (find-items tag tree)))

 (defn- find-xref [tree xref]
   (first (filter #(= xref (:xref %)) (:subordinate-lines tree))))

-(defn- find-item-value [tree tag]
-  (:value (find-item tree tag)))
+(defn- find-item-value [tag tree]
+  (:value (find-item tag tree)))

 (defn header
   ([tree] (header tree nil))
   ([tree start-record]
-   (let [header (find-item tree "HEAD")
-         header-value (fn [tag] (find-item-value header tag))
+   (let [header (find-item "HEAD" tree)
+         header-value (fn [tag] (find-item-value tag header))
          add-submitter (fn [m]
                          (if-let [xref (header-value "SUBM")]
-                           (assoc m :submitter {:name (find-item-value (find-xref tree xref) "NAME")
+                           (assoc m :submitter {:name (find-item-value "NAME" (find-xref tree xref))
                                                 :xref xref})
                            m))
          add-source (fn [m]
-                      (let [source (find-item header "SOUR")]
-                        (assoc m :source (:value (or (find-item source "NAME")
+                      (let [source (find-item "SOUR" header)]
+                        (assoc m :source (:value (or (find-item "NAME" source)
                                                      source)))))
          add-start-record (fn [m xref]
                             (if-let [record
                                      (or (and xref (find-xref tree xref))
-                                         (find-item tree "INDI"))]
+                                         (find-item "INDI" tree))]
                               (assoc m
                                      :start-record
-                                     {:name (find-item-value record "NAME")
+                                     {:name (find-item-value "NAME" record)
                                       :xref (:xref record)})
                               m))]
      (-> {:number-of-records (count (:subordinate-lines tree))
           :destination (header-value "DEST")
           :file (header-value "FILE")
           :file-time (header-value "DATE")
-          :gedcom {:version (find-item-value (find-item header "GEDC") "VERS")
-                   :type (find-item-value (find-item header "GEDC") "FORM")}
+          :gedcom {:version (find-item-value "VERS" (find-item "GEDC" header))
+                   :type (find-item-value "FORM" (find-item "GEDC" header))}
           :encoding (header-value "CHAR")}
          (add-source)
          (add-submitter)
@@ -58,39 +58,39 @@
 (defn- add-event-info [m k e]
   (if e
     (assoc m k
-           {:date (find-item-value e "DATE")
-            :place (find-item-value e "PLAC")})
+           {:date (find-item-value "DATE" e)
+            :place (find-item-value "PLAC" e)})
     m))

 (defn- person-info [r]
-  {:xref (:xref r) :name (find-item-value r "NAME")})
+  {:xref (:xref r) :name (find-item-value "NAME" r)})

 (defn- spouse-info [tree i fams]
   (let [xref (:value fams)
         family (find-xref tree xref)
-        spouses (map #(find-item-value family %)
+        spouses (map #(find-item-value % family)
                      '("HUSB" "WIFE"))
         spouse-xref (first (filter #(not (= % (:xref i))) spouses))
         other-person (find-xref tree spouse-xref)]
     {:xref xref
      :spouse {:xref (:xref other-person)
-              :name (find-item-value other-person "NAME")}}))
+              :name (find-item-value "NAME" other-person)}}))

 (defn- make-record [tree raw-record]
     (-> {:type (type-of raw-record)}

         (add-value :name (map :value (find-items "NAME" raw-record)))
-        (add-value :sex (find-item-value raw-record "SEX"))
-        (add-value :family-as-child (find-item-value raw-record "FAMC"))
+        (add-value :sex (find-item-value "SEX" raw-record))
+        (add-value :family-as-child (find-item-value "FAMC" raw-record))
         (add-value :family-as-spouse (map #(spouse-info tree raw-record %) (find-items "FAMS" raw-record)))
-        (add-event-info :birth (find-item raw-record "BIRT"))
-        (add-event-info :death (find-item raw-record "DEAT"))
-        (add-event-info :burial (find-item raw-record "BURI"))
+        (add-event-info :birth (find-item "BIRT" raw-record))
+        (add-event-info :death (find-item "DEAT" raw-record))
+        (add-event-info :burial (find-item "BURI" raw-record))

         (add-value :spouses
-                   [(person-info (find-xref tree (find-item-value raw-record "HUSB")))
-                    (person-info (find-xref tree (find-item-value raw-record "WIFE")))])
-        (add-event-info :marriage (find-item raw-record "MARR"))
+                   [(person-info (find-xref tree (find-item-value "HUSB" raw-record)))
+                    (person-info (find-xref tree (find-item-value "WIFE" raw-record)))])
+        (add-event-info :marriage (find-item "MARR" raw-record))
         (add-value :children
                    (map #(person-info (find-xref tree (:value %)))
                         (find-items "CHIL" raw-record))))  )
@@ -101,5 +101,5 @@
 (defn search [tree query]
   (->> tree
        (find-items "INDI")
-       (filter #(.contains (find-item-value % "NAME") query))
+       (filter #(.contains (find-item-value "NAME" %) query))
        (map #(make-record tree %))))


cleanup: remove unneeded passato/trapassato distinction

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -431,26 +431,14 @@
                                     :sem {:tense :past
                                           :aspect :simple}
                                     :cat :verb}})
-
                    (unify h21a
                           root-is-comp
-                          {:rule "vp-aux-nonphrasal-complement-passato"
+                          {:rule "vp-aux-nonphrasal-complement"
                            :head {:phrasal false
                                   :synsem {:aux true}}
                            :comp {:phrasal false}
                            :synsem {:aux true
-                                    :sem {:tense :past
-                                          :aspect :simple}
-                                    :cat :verb}})
-                   (unify h21a
-                          root-is-comp
-                          {:rule "vp-aux-nonphrasal-complement-trapassato"
-                           :head {:phrasal false
-                                  :synsem {:aux true}}
-                           :comp {:phrasal false}
-                           :synsem {:aux true
-                                    :sem {:tense :past
-                                          :aspect :perfect}
+                                    :sem {:tense :past}
                                     :cat :verb}})

                    ;; these two following rules are kind of complicated and made more so by
@@ -692,7 +680,7 @@
                      (= (:rule %) "vp-aux-nonphrasal-complement-passato")
                      (= (:rule %) "vp-aux-phrasal-complement-passato")
                      (= (:rule %) "vp-aux-22-passato")
-                     (= (:rule %) "vp-aux-nonphrasal-complement-trapassato")
+                     (= (:rule %) "vp-aux-nonphrasal-complement")
                      (= (:rule %) "vp-aux-phrasal-complement-trapassato")
                      (= (:rule %) "vp-aux-22-trapassato")
                      (= (:rule %) "vp-present")


(defn model): should take a name as first param

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -563,7 +563,7 @@
             (if (not (empty? filtered-v))
               [k filtered-v])))))

-(defn model [lexicon-filter-fn grammar-filter-fn]
+(defn model [name lexicon-filter-fn grammar-filter-fn]
   "create a model using a lexicon derived from the supplied filtering function."
   (deliver-lexicon)
   (let [lexicon @lexicon
@@ -575,7 +575,8 @@
                   (if (not (empty? filtered-v))
                     [k filtered-v]))))
         grammar (filter grammar-filter-fn grammar)]
-    {:language "it"
+    {:name name
+     :language "it"
      :language-keyword :italiano
      :morph fo
      :morph-ps fo-ps


"casa": [:sem :spec :def] = :none

"casa": [:sem :spec :def] = :none

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -552,6 +552,7 @@
     ;; in the sense of "a casa": no article needed.
     {:synsem {:cat :noun
               :sem {:city false
+                    :spec {:def :none} ;; "a casa", not "a mia casa", etc
                     :place true
                     :animate false
                     :pred :casa}


remove (atom )s from all adjectives

remove (atom )s from all adjectives

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -402,25 +402,12 @@
    "ballare" {:synsem {:cat :verb
                        :sem {:pred :dance}}}
    "bello"
-   [;; non-comparative
-    {:unify [adjective]
-     :synsem {:sem {:pred :bello
-                    :comparative false
-                    }}} ;; for now, no restrictions on what can be beautiful.
+   [{:unify [adjective non-comparative-adjective]
+     :synsem {:sem {:pred :bello}}}

-    ;; comparative
-    (let [complement-complement-sem (atom :top) ;; for now no restrictions
-          complement-sem (atom {:pred :di
-                               :mod complement-complement-sem})
-          subject-sem (atom :top)] ;; subject can be anything.
-      {:unify [adjective comparative]
-       :synsem {:sem {:pred :bello
-                      :arg1 subject-sem
-                      :arg2 complement-complement-sem}
-                :subcat {:1 {:cat :noun
-                             :sem subject-sem}
-                         :2 {:cat :prep
-                             :sem complement-sem}}}})]
+    {:unify [adjective comparative]
+     :synsem {:sem {:pred :bello}}}]
+
    "bene"
    {:synsem {:cat :adverb
              :sem {:pred :bene}}}
@@ -744,25 +731,14 @@
                        :cat :verb}}

    "contento"
-   [(let [complement-complement-sem (atom {:human true})
-          complement-sem (atom {:pred :di
-                                :mod complement-complement-sem})
-          subject-sem (atom {:place true})]
-      {:unify [adjective comparative]
-       :synsem {:sem {:pred :contento
-                      :arg1 subject-sem
-                      :arg2 complement-complement-sem}
-                :subcat {:1 {:cat :noun
-                             :sem subject-sem}
-                         :2 {:cat :prep
-                             :sem complement-sem}}}}
+   [{:unify [adjective non-comparative-adjective]
+     :synsem {:sem {:pred :contento
+                    :subj {:human true}}}}

-      ;; non-comparative
-      {:unify [adjective]
-       :synsem {:cat :adjective
-                :sem {:pred :contento
-                      :comparative false
-                      :human true}}})]
+    {:unify [adjective comparative]
+     :synsem {:sem {:pred :contento
+                    :subj {:human true}
+                    :obj {:human true}}}}]

    "contraccambiare" {:synsem {:sem {:pred :reciprocate}
                                :cat :verb}}
@@ -775,25 +751,14 @@
                               :sem {:pred :correspond}}}

    "corto"
-   [(let [complement-complement-sem (atom {:human true}) ;; only humans can be short.
-          complement-sem (atom {:pred :di
-                                :mod complement-complement-sem})
-          subject-sem (atom {:human true})] ;; only humans can be short.
-      {:unify [adjective comparative]
-       :synsem {:sem {:pred :corto
-                      :arg1 subject-sem
-                      :arg2 complement-complement-sem}
-                :subcat {:1 {:cat :noun
-                             :sem subject-sem}
-                         :2 {:cat :prep
-                             :sem complement-sem}}}})
-    ;; non-comparative
-    {:unify [adjective]
-     :synsem {:cat :adjective
-              :sem {:pred :corto
-                    :comparative false
-                    :human true}}
-     :italiano {:cat :adjective}}]
+   [{:unify [adjective non-comparative-adjective]
+     :synsem {:sem {:pred :contento
+                    :subj {:human true}}}}
+
+    {:unify [adjective comparative]
+     :synsem {:sem {:pred :contento
+                    :subj {:human true}
+                    :obj {:human true}}}}]

    "creare"  {:synsem {:cat :verb
                        :sem {:pred :create}}}


+isola

+isola

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1374,6 +1374,10 @@
               :sem {:pred :I
                     :human true}
               :subcat '()}}]
+
+   "isola" {:synsem {:agr {:gender :top}
+                :cat :noun
+                :sem {:pred :island}}}
    "la"
    ;; as with "lo", do we need both of these "lo" entries? try to get by with just one.
    ;; TODO: refactor commonalities


doc formatting.

doc formatting.

--- src/clj/forma/source/static.clj
+++ src/clj/forma/source/static.clj
@@ -14,11 +14,12 @@

 (defn index-textfile
   "Prepend a row index to a text file `old-file-name`, located at `base-path`,
-  and save in the same directory with new name `new-file-name`. The `num-drop`
-  parameter specifies the number of lines to drop from the beginning of the
-  text file.  Note that indexing begins with the first textline not dropped,
-  and starts at 0. This function was originally written to clean an ASCII
-  raster file for input into the sampling functions."
+  and save in the same directory with new name `new-file-name`. The
+  `num-drop` parameter specifies the number of lines to drop from the
+  beginning of the text file.  Note that indexing begins with the
+  first textline not dropped, and starts at 0. This function was
+  originally written to clean an ASCII raster file for input into the
+  sampling functions."
   [base-path old-file-name new-file-name num-drop]
   (let [old-file (str base-path old-file-name)
         new-file (str base-path new-file-name)]
@@ -53,11 +54,12 @@
   (map-indexed vector row))

 (defn ascii-source [path]
-  "create a source out of a pre-cleaned ASCII grid, which is associated with a
-  map of characteristic values, such as resolution and extent.  The cleaned
-  grid is located at `path` and has the row index values prepended on the rows,
-  with the ASCII prelude (which is automatically added by Arc) already stripped
-  and cataloged in the map of characteristic values."
+  "create a source out of a pre-cleaned ASCII grid, which is
+  associated with a map of characteristic values, such as resolution
+  and extent.  The cleaned grid is located at `path` and has the row
+  index values prepended on the rows, with the ASCII prelude (which is
+  automatically added by Arc) already stripped and cataloged in the
+  map of characteristic values."
   (let [source (hfs-textline path)]
     (<- [?row ?col ?val]
         (source ?line)
@@ -70,11 +72,11 @@
 ;; grid.

 (defn travel
-  "travel along a grid with cellsize `step` in the direction
-  given by `dir` from an initial position `start` to a position
-  `pos` which is intended to be, for most applications, row or
-  column within the grid.  Note that this takes you to the
-  centroid of the row or column position that you specify."
+  "travel along a grid with cellsize `step` in the direction given by
+  `dir` from an initial position `start` to a position `pos` which is
+  intended to be, for most applications, row or column within the
+  grid.  Note that this takes you to the centroid of the row or column
+  position that you specify."
   [step dir start pos]
   (-> start (dir (* pos step)) (dir (/ step 2))))

@@ -97,11 +99,11 @@
        (apply m/latlon->modis m-res)))

 (defn downsample
-  "This query is for a point grid at higher resolution than the reference
-  grid, which is the MODIS grid in this case. (This is a constraining
-  assumption, since MODIS is hard-coded into this function.  The aggregator
-  function should be called as follows: c/sum, c/max, where c is the prefix
-  refering to cascalog.ops."
+  "This query is for a point grid at higher resolution than the
+  reference grid, which is the MODIS grid in this case. (This is a
+  constraining assumption, since MODIS is hard-coded into this
+  function.  The aggregator function should be called as follows:
+  c/sum, c/max, where c is the prefix refering to cascalog.ops."
   [dataset m-res ascii-info grid-source agg]
   (<- [?dataset ?m-res ?t-res ?mod-h ?mod-v ?sample ?line ?outval]
       (grid-source ?row ?col ?val)
@@ -124,14 +126,16 @@
 ;; direction, between modis and wgs84. Replace with a calculation.

 (defn sample-modis
-  "This function is based on the reference MODIS grid (currently at 1000m res).  The
-  objective of the function is to tag each MODIS pixel with a value from an input
-  ASCII grid.  The process diverges based on whether the ASCII grid is at coarser or
-  finer resolution than the MODIS grid.  If higher, then each ASCII point is assigned
-  a unique MODIS identifier, and the duplicate values are aggregated based on an input
-  aggregator (sum, max, etc.).  If lower, each MODIS pixel is tagged with the ASCII
-  grid cell that it falls within.  Note that the ASCII grid must be in WGS84, with row
-  indices prepended and the ASCII header lopped off."
+  "This function is based on the reference MODIS grid (currently at
+  1000m res).  The objective of the function is to tag each MODIS
+  pixel with a value from an input ASCII grid.  The process diverges
+  based on whether the ASCII grid is at coarser or finer resolution
+  than the MODIS grid.  If higher, then each ASCII point is assigned a
+  unique MODIS identifier, and the duplicate values are aggregated
+  based on an input aggregator (sum, max, etc.).  If lower, each MODIS
+  pixel is tagged with the ASCII grid cell that it falls within.  Note
+  that the ASCII grid must be in WGS84, with row indices prepended and
+  the ASCII header lopped off."
   ([m-res dataset pixel-tap ascii-path & [agg]]
      (let [ascii-info ((keyword dataset) static-datasets)
            grid-source (ascii-source ascii-path)]


Conditionally show the sites section

Conditionally show the sites section

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -34,11 +34,12 @@
    (om/component
     (dom/div nil
              (dom/h1 nil (:heading data))
-             (apply dom/ul nil
-                    (map (fn [{:keys [name url]}]
-                           (dom/li nil
-                                   (dom/a #js {:href url} name)))
-                         (:sites data))))))
+             (when (:sites data)
+               (apply dom/ul nil
+                      (map (fn [{:keys [name url]}]
+                             (dom/li nil
+                                     (dom/a #js {:href url} name)))
+                           (:sites data)))))))
  app-state
  {:target (. js/document (getElementById "main-area"))})