Displaying user's links via website

Displaying user's links via website

--- src/hackerati_interval_web_app/views.clj
+++ src/hackerati_interval_web_app/views.clj
@@ -28,34 +28,32 @@
     [:body
      [:h1 "amzn scrpr"] h]]))

-
 (defn logged-in [request]
-  (let [{params :params} request
-        {username :username} params
+  (let [username (get-username-from-request-map request)
         {session :session} request]
-      ;; TODO get-links
-      {:status 200
-       :headers {"Content-Type" "text/html"}
-       :body (site-template (html [:h3 "Links you're following, " (:username session)] [:br] [:br]
-                                  (db/get-links username )
-                                  (debug session)))
-       :session (assoc session :username username)}))
-
+    {:status 200
+     :headers {"Content-Type" "text/html"}
+     :body (site-template (html [:h3 "Links you're following, " (str username)] [:br] [:br]
+                                (for [url (db/get-links username)]
+                                  [:a {:href url} url])
+                                (debug request)))
+     :session (assoc session :username username)}))
+
 (defn not-logged-in [session]
   (site-template
    (html
     (form-to [:post "/login"]
-              "username:" [:input {:type "text" :name "username"}] [:br]
-              "password:" (password-field "password") [:br]
-              (submit-button "log in"))
-     (html [:br] [:br])
-     (form-to [:post "/register"]
-              "username:" [:input {:type "text" :name "username"}] [:br]
-              "password:" (password-field "password") [:br]
-              "email:" [:input {:type "text" :name "email"}] [:br]
-              (anti-forgery-field)
-              (submit-button "submit"))
-     (html [:br] [:br] (debug session)))))
+             "username:" [:input {:type "text" :name "username"}] [:br]
+             "password:" (password-field "password") [:br]
+             (submit-button "log in"))
+    (html [:br] [:br])
+    (form-to [:post "/register"]
+             "username:" [:input {:type "text" :name "username"}] [:br]
+             "password:" (password-field "password") [:br]
+             "email:" [:input {:type "text" :name "email"}] [:br]
+             (anti-forgery-field)
+             (submit-button "submit"))
+    (html [:br] [:br] (debug session)))))

 (defn index [session]
   (html (debug session) (link-to session "/login" "log-in" ))


bug fix

bug fix

--- kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/goa/goa.clj
+++ kabob-build/src/main/resources/edu/ucdenver/ccp/kabob/build/rules/temp/goa/goa.clj
@@ -59,7 +59,7 @@
          (?/loc rdfs/subClassOf obo/GO_0051179) ;localization

          (?/protein rdfs/subClassOf ?/bioentity)
-         (?/gocc rdfs/subClassOf ?go)
+         (?/gocc rdfs/subClassOf ?/go)

          (?/of1 rdf/type owl/Restriction)
          (?/of1 owl/onProperty obo/RO_0002313) ;transports or maintains localization of


Remove old code that handles subscriptions to individual betas

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -187,16 +187,14 @@
   (reify
     om/IRender
     (render [_]
-      (let [betas (get-in app state/user-betas-path)]
-        (html
-         [:div
-          [:h4.beta-programs "Current Beta Features"]
-          (map
-           (fn [program]
-             (let [participating? (contains? (set betas) (:id program))]
-               (card/titled {:title (:name program)}
-                            (:description program))))
-           available-betas)])))))
+      (html
+       [:div
+        [:h4.beta-programs "Current Beta Features"]
+        (map
+         (fn [program]
+           (card/titled {:title (:name program)}
+                        (:description program)))
+         available-betas)]))))

 (defn set-beta-program-preference! [owner pref]
   (raise! owner [:preferences-updated {state/user-in-beta-key pref}]))


fix bug in landing animation

fix bug in landing animation

"signup-animation" isn't comparable with UUID :/

--- src-cljs/frontend/components/drawing.cljs
+++ src-cljs/frontend/components/drawing.cljs
@@ -12,6 +12,8 @@
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true])
   (:import [goog.ui IdGenerator]))
+
+(defonce signup-animation-source (utils/squuid))

 (defn add-tick [tick-state tick tick-fn]
   (update-in tick-state [:ticks tick] (fn [f] (fn [owner]
@@ -300,7 +302,7 @@
                   :end-tick 130
                   :start-x text-start-x :end-x (+ text-start-x text-width)
                   :start-y text-start-y :end-y (- text-start-y text-height)
-                  :source "signup-animation"
+                  :source signup-animation-source
                   :props {:layer/signup-button true}})
       (move-mouse {:start-tick 140
                    :end-tick 145
@@ -312,7 +314,7 @@
                    :end-tick 200
                    :start-x rect-start-x :end-x rect-end-x
                    :start-y rect-start-y :end-y rect-end-y
-                   :source "signup-animation"
+                   :source signup-animation-source
                    :props {:layer/ui-target "/signup"
                            :layer/ui-id "/signup"
                            :layer/signup-button true}})
@@ -326,7 +328,7 @@
       ;; TODO: would be nice to get this a different way :(
       (let [viewport (utils/canvas-size)]
         (when (and (< 640 (:width viewport)) ;; only if not on mobile
-                   (empty? (d/datoms @(om/get-shared owner :db) :avet :layer/source "signup-animation")))
+                   (empty? (d/datoms @(om/get-shared owner :db) :avet :layer/source signup-animation-source)))
           (run-animation owner (signup-animation document (cameras/top-right camera viewport))))))
     om/IWillUnmount
     (will-unmount [_]


fix test password value

fix test password value

--- test/clj/omlab/db/user_test.clj
+++ test/clj/omlab/db/user_test.clj
@@ -32,7 +32,7 @@
   (testing "no auth"
     (is (= nil (auth-credentials (t/db) "missing-user"))))
   (testing "root access"
-    (is (= {:username "root", :password "$2a$10$erb66jCAhUc.5yNHY5XyxeCpLlbliRl3zdj5obVdZSCzaZS0u5Lm2", :roles #{:omlab.auth/admin}, :name "Omlab Administrator"}
+    (is (= {:username "root", :password  "$2a$10$Hfb7nFYC8s7f7gX5wxsOZ.YvoFe7NVyc4jvOwITNR4ZDLNGOCO8Ci", :roles #{:omlab.auth/admin}, :name "Omlab Administrator"}
            (auth-credentials (t/db) "root"))))
   (testing "multiple roles"
     (is (= nil


Make it Baz

Make it Baz

--- test/clj/potoo/datomic_test.clj
+++ test/clj/potoo/datomic_test.clj
@@ -33,7 +33,7 @@
           _ (create-user conn "Rick" "")
           _ (create-potoo conn "Foo" "Rick" date)
           _ (create-potoo conn "Bar" "Rick" date)
-          _ (create-potoo conn "Bar" "Morty" date)]
+          _ (create-potoo conn "Baz" "Morty" date)]
       (is (= #{["Foo" #inst "1986-10-14T04:03:27.456-00:00"]
                ["Bar" #inst "1986-10-14T04:03:27.456-00:00"]}
              (find-potoos-for-user conn "Rick"))))))


fixed react warnings by setting keys for proposal items

--- src-cljs/club_of_naaarfs/core.cljs
+++ src-cljs/club_of_naaarfs/core.cljs
@@ -8,23 +8,23 @@
             [ajax.core :refer [GET POST]])
   (:import goog.History))

+(enable-console-print!)

 (def hardcoded-proposals [{:title "Nase Bohren"
                            :description "Mal was anderes als Arschkratzen"
-                           :author {:name "Matzetias Hackmann!"
+                           :author {:nickname   "Matzetias Hackmann!"
                                     :avatar-url "https://avatars.slack-edge.com/2015-11-13/14513569492_4ebac28ff715db6b5350_192.jpg"
-                                    :email "mwahlfälscher@cduhhh.com"}}
+                                    :email      "mwahlfälscher@cduhhh.com"}}
                           {:title "Po Pieken"
                            :description "Mal was anderes als Nasebohren"
-                           :author {:name "Flolowlowloooow"
+                           :author {:nickname   "Flolowlowloooow"
                                     :avatar-url "https://secure.gravatar.com/avatar/86cbefc14488bbe76a1c2368189efc6c.jpg?s=512&d=https%3A%2F%2Fslack.global.ssl.fastly.net%2F7fa9%2Fimg%2Favatars%2Fava_0001-512.png"
-                                    :email "flooooooooo@bumbahumba.com"}}
+                                    :email      "flooooooooo@bumbahumba.com"}}
                           {:title "SchlauKacken"
                            :description "Besser als Nasebohren oder PoPieken"
-                           :author {:name "Schrizdruff Stullrich"
+                           :author {:nickname   "Schrizdruff Stullrich"
                                     :avatar-url "https://avatars.slack-edge.com/2015-12-14/16662818098_1ecb9b85f3bdbc61aec0_192.jpg"
-                                    :email "stullrich@tomicowski.com"}}])
-
+                                    :email      "stullrich@tomicowski.com"}}])

 (declare <proposal-list>
          <proposal-item>)
@@ -35,16 +35,16 @@
   [:div.container-fluid
    [:ul.proposal-list
     (for [proposal proposal-list]
-      [<proposal-item> proposal])]])
+      ^{:key (:title proposal)} [<proposal-item> proposal])]])

 (defn <proposal-item>
   "A proposal item component"
-  [{:keys [title description] {:keys [name avatar-url]} :author}]
+  [{:keys [title description] {:keys [nickname avatar-url]} :author}]
   [:li.proposal-item
    [:h4 title]
    [:p description]
    [:img.img-circle.img-thumb {:src avatar-url}]
-   [:span name]])
+   [:span nickname]])

 (defn nav-link [uri title page collapsed?]
   [:li {:class (when (= page (session/get :page)) "active")}


Add key to list

Add key to list

--- src-cljs/reagent_tutorial/core.cljs
+++ src-cljs/reagent_tutorial/core.cljs
@@ -46,10 +46,10 @@
         (>= c 2) (assoc :middle middle)))))

 ;; UI components
-(defn contact [c]
-  [:li
+(defn contact [id c]
+  [:li {:key id}
    [:span (display-name c)]
-   [:button {:on-click #(remove-contact! c)}
+   [:button {:on-click #(remove-contact! c)}
     "Delete"]])

 (defn new-contact []
@@ -69,12 +69,11 @@
   [:div
    [:h1 "Contact list"]
    [:ul
-    (for [c (:contacts @app-state)]
-      [contact c])]
+    (map-indexed (fn [id element] (contact id element)) (:contacts @app-state))]
    [new-contact]])

 ;; Render the root component
 (defn start []
-  (r/render-component
+  (r/render-component
    [contact-list]
    (.getElementById js/document "root")))


Fix up failing hello-build test

Fix up failing hello-build test

I was mistaken about which block of 0 bytes was being checked.

Went ahead and added a test to verify that the actual encrypted block
decrypts as expected.

--- test/frereth_cp/client_test.clj
+++ test/frereth_cp/client_test.clj
@@ -174,7 +174,8 @@
   (testing "Can I build a Hello packet?"
     (let [server-long-pair (crypto/random-key-pair)
           start-time (System/nanoTime)
-          {:keys [::state/chan->server]
+          {:keys [::state/chan->server
+                  ::shared/my-keys]
            :as client-state} (factory/raw-client (gensym "client/build-hello-")
                                                  (fn []
                                                    (log/file-writer-factory "/tmp/client/build-hello.log.edn"))
@@ -186,27 +187,51 @@
                                                    (throw (RuntimeException. "Don't expect any messages to client")))
                                                  (fn [_]
                                                    (throw (RuntimeException. "Don't expect to spawn a child"))))]
+      (assert client-state)
       (when client-state
         (try
           ;; Note that test-factory calls start! in a future.
           (let [hello-bundle @(strm/try-take! chan->server ::drained 500 ::timeout)
                 built-time (System/nanoTime)
                 time-delta (- built-time start-time)]
-            (is (and hello-bundle
-                     (not= hello-bundle ::drained)
-                     (not= hello-bundle ::timeout)))
+            (is hello-bundle)
+            (is (not= hello-bundle ::drained))
+            (is (not= hello-bundle ::timeout))
             (let [packet (:message hello-bundle)]
               (is packet (str "Missing :message in " hello-bundle))
               (is (= K/hello-packet-length (count packet)))
               (let [v (vec packet)]
                 (is (= (subvec v 0 (count K/hello-header))
                        (vec K/hello-header)))
-                ;; These really can't be equal:
-                ;; the hello version should be encrypted.
-                ;; Q: Worth decrypting to verify?
-                ;; Umm...I'm getting all zeros here.
-                ;; Wut?
-                (is (not= (subvec v 72 136) (take 64 (repeat 0))))))
+                ;; This is 64 bytes of 0 padding
+                (is (= (subvec v 72 136) (take 64 (repeat 0))))
+                ;; 0 nonce indicates end-of-stream
+                (let [nonce-suffix (subvec v 136 144)]
+                  (is (not= nonce-suffix (take 8 (repeat 0)))))
+                ;; block of zeroes encrypted from client's short-term
+                ;; secret key to server's long-term public key.
+                (let [crypto-zeroes (subvec v 144)
+                      payload (take 80 (repeat 0))]
+                  (is (not= crypto-zeroes payload))
+                  (let [server-sk (.getSecretKey server-long-pair)
+                        ^com.iwebpp.crypto.TweetNaclFast$Box$KeyPair client-short-pair (::shared/short-pair my-keys)
+                        client-pk (.getPublicKey client-short-pair)
+                        shared-key (crypto/box-prepare client-pk server-sk)
+                        nonce-suffix (->> v
+                                          (drop 136)
+                                          (take 8)
+                                          vec)
+                        {clear-text-buf ::crypto/unboxed} (crypto/open-box (log/init ::build-hello)
+                                                                           K/hello-nonce-prefix
+                                                                           (byte-array nonce-suffix)
+                                                                           (byte-array crypto-zeroes)
+                                                                           shared-key)
+                        expected (take 64 (repeat 0))
+                        clear-text-array (byte-array (.readableBytes clear-text-buf))]
+                    (.getBytes clear-text-buf 0 clear-text-array)
+                    (let [clear-text (vec clear-text-array)]
+                      (is (= (count expected) (count clear-text)))
+                      (is (= expected clear-text)))))))
             ;; This isn't a time-critical operation.
             ;; It's a fairly arbitrary number that's totally going to
             ;; depend on things like hardware and underlying libraries.


properties - 1st cut of rejig to new code style.

--- src/kixi/hecuba/api/properties.clj
+++ src/kixi/hecuba/api/properties.clj
@@ -4,30 +4,33 @@
    [cheshire.core :as json]
    [clojure.tools.logging :as log]
    [kixi.hecuba.protocols :as hecuba]
-   [kixi.hecuba.webutil :as util]
-   [kixi.hecuba.webutil :refer (decode-body authorized? uuid stringify-values sha1-regex)]
-   [liberator.core :refer (defresource)]
-   ))
+   [kixi.hecuba.webutil :refer (decode-body authorized? uuid stringify-values sha1-regex routes-from ) :as util]
+   [liberator.core :refer (defresource)]))
+
+(defn- project-id-from [ctx]
+  (get-in [:request :route-params :project-id]))
+
+(defn index-handle-ok [querier handlers ctx]
+  (let [request (:request ctx)]
+    (let [coll (->> (if (project-id-from ctx)
+                      (hecuba/items querier :entity (:route-params request))
+                      (hecuba/items querier :entity))
+                    (map #(-> %
+                              (assoc :device-ids (map :id (hecuba/items querier :device {:entity-id (:id %)}))
+                                     :href (bidi/path-for (routes-from ctx)
+                                                          (:entity @handlers) :entity-id (:id %))))))
+          scoll (sort-by :address-street-two coll)]
+
+      (case (get-in ctx [:representation :media-type])
+        "text/html" (util/render-items request scoll)
+        "application/json" (->> scoll
+                                (map util/downcast-to-json)
+                                (map util/camelify)
+                                json/encode)
+        scoll))))

 (defresource index [{:keys [commander querier]} handlers]
   :allowed-methods #{:get}
   :available-media-types #{"application/json" "application/edn" "text/html"}
   :authorized? (authorized? querier :property)
-
-  :handle-ok
-  (fn [{{mime :media-type} :representation {routes :modular.bidi/routes route-params :route-params} :request :as req}]
-      (let [coll (->> (if (:project-id route-params)
-                      (hecuba/items querier :entity route-params)
-                      (hecuba/items querier :entity))
-                      (map #(-> %
-                                (assoc :device-ids (map :id (hecuba/items querier :device {:entity-id (:id %)})))
-                                (assoc :href (bidi/path-for routes (:entity @handlers) :entity-id (:id %))))))
-            scoll (sort-by :address-street-two coll)]
-
-        (case mime
-          "text/html" (util/render-items req scoll)
-          "application/json" (->> scoll
-                                  (map util/downcast-to-json)
-                                  (map util/camelify)
-                                  json/encode)
-          scoll))))
+  :handle-ok (partial index-handle-ok querier handlers))


Add compressor node

Add compressor node

--- src/alder/node-type.cljs
+++ src/alder/node-type.cljs
@@ -293,6 +293,51 @@
              (fn [ctx] (.call (aget ctx "createDelay") ctx 5))
              {:constructor "context.createDelay(5)"}))

+(def compressor-node-type
+  (NodeType. {:signal-in {:type :node
+                          :index 0
+                          :title "Signal in"}
+              :threshold {:type :param
+                          :name "threshold"
+                          :data-type :number
+                          :default -24
+                          :title "Threshold"
+                          :range [-100 0]}
+              :knee {:type :param
+                     :name "knee"
+                     :data-type :number
+                     :default 30
+                     :range [0 40]
+                     :title "Knee"}
+              :ratio {:type :param
+                      :name "ratio"
+                      :data-type :number
+                      :default 12
+                      :range [1 20]
+                      :title "Ratio"}
+              :attack {:type :param
+                       :name "attack"
+                       :data-type :number
+                       :default 0.003
+                       :range [0 1]
+                       :title "Attack"}
+              :release {:type :param
+                        :name "release"
+                        :data-type :number
+                        :default 0.25
+                        :range [0 1]
+                        :title "Release"}}
+             {:signal-out {:type :node
+                           :index 0
+                           :title "Signal out"
+                           :data-type :signal}}
+             nil
+             false
+             "Compressor"
+             [120 100]
+             (fn [ctx] (.call (aget ctx "createDynamicsCompressor") ctx))
+             {:constructor "context.createDynamicsCompressor()"}))
+
 (def midi-note-node-type
   (NodeType. {:device {:type :accessor
                        :name "device"
@@ -379,7 +424,8 @@
                      :stereo-panner stereo-panner-node-type
                      :stereo-splitter stereo-splitter-node-type
                      :stereo-merger stereo-merger-node-type
-                     :delay delay-node-type}
+                     :delay delay-node-type
+                     :compressor compressor-node-type}
         midi-nodes (if has-midi-support
                      {:midi-note midi-note-node-type
                       :midi-cc midi-cc-node-type}
@@ -394,7 +440,8 @@
                  [:stereo-panner stereo-panner-node-type]
                  [:stereo-splitter stereo-splitter-node-type]
                  [:stereo-merger stereo-merger-node-type]
-                 [:delay delay-node-type]]
+                 [:delay delay-node-type]
+                 [:compressor compressor-node-type]]
         envelopes [[:adsr adsr-node-type]]
         midi-nodes [[:midi-note midi-note-node-type]
                     [:midi-cc midi-cc-node-type]]


remove unused method

remove unused method

--- src/clj/clj_money/models/transactions.clj
+++ src/clj/clj_money/models/transactions.clj
@@ -732,23 +732,6 @@
               (recalculate-account storage account-id recalc-base-date))
             (reload storage validated)))))))

-(defn- get-preceding-items
-  "Returns the items that precede each item in the
-  specified transaction.
-
-  If an item in the transaction is the first item for an account
-  a fake item is generate to seed the following items."
-  [storage transaction]
-  (->> (:items transaction)
-       (group-by :account-id)
-       (map second)
-       (map #(sort-by :index %))
-       (map first)
-       (map #(or (get-previous-item storage %)
-                 {:account-id (:account-id %)
-                  :index -1
-                  :balance 0}))))
-
 (defn can-delete?
   [transaction]
   (->> transaction


use case

use case

--- src/clj/org/openforis/ceo/db/projects.clj
+++ src/clj/org/openforis/ceo/db/projects.clj
@@ -411,7 +411,7 @@
                                sample-resolution]
   ;; TODO Right now you have to have a sample shape or csv file if you have a plot shape file.
   ;;      Update create random / gridded to work on boundary so any plot type can have random, gridded, center.
-  (doseq [[x y] (condp = sample-distribution
+  (doseq [[x y] (case sample-distribution
                   "center"
                   [plot-center]

@@ -456,7 +456,7 @@
               ext-sample-count (:sample_count counts)]
           (check-plot-limits ext-plot-count
                              50000.0
-                             (condp = sample-distribution
+                             (case sample-distribution
                                "gridded" (count-gridded-sample-set plot-size sample-resolution)
                                "random"  samples-per-plot
                                "center"  1.0
@@ -490,7 +490,7 @@
                            (count-gridded-points left bottom right top plot-spacing)
                            num-plots)
                          5000.0
-                         (condp = sample-distribution
+                         (case sample-distribution
                            "gridded" (count-gridded-sample-set plot-size sample-resolution)
                            "random"  samples-per-plot
                            "center"  1.0


CMR-957: Added another special case polygon


Product and repository name should be used to get stat for repository

--- src/arachnida/html_renderer.clj
+++ src/arachnida/html_renderer.clj
@@ -99,8 +99,8 @@
     [:td {:style "text-align:right"} (or (get (val s) k) "0")])

 (defn url-to-repo-page
-    [repository]
-    [:a {:href (str "/repository?name=" repository)} repository])
+    [product-name repository]
+    [:a {:href (str "/repository?product=" product-name "&repository=" repository)} repository])

 (defn url-to-gitlab
     [url]
@@ -121,7 +121,7 @@
                     [:table {:class "table table-condensed table-hover table-bordered" :rules "all"}
                         (for [repository repositories]
                             [:tr
-                                [:td (url-to-repo-page (:name repository))]
+                                [:td (url-to-repo-page product-name (:name repository))]
                                 [:td (url-to-gitlab (:url  repository))]])
                     ]]
                 [:div {:class "panel panel-primary"}


RS | #85 | Use html/select to select the first flash bar in library.html

--- src/objective8/templates/page_furniture.clj
+++ src/objective8/templates/page_furniture.clj
@@ -52,6 +52,8 @@

 ;; STATUS BAR

+(def flash-bar-snippet (first (html/select library-html-resource [:.clj-flash-message-bar])))
+
 (html/defsnippet invitation-response-banner library-html [:.clj-invitation-response-link]
   [invitation-rsvp translations]
   [:.clj-invitation-response-link]
@@ -59,8 +61,9 @@
     (html/set-attr :href (utils/local-path-for :fe/objective :id (:objective-id invitation-rsvp)))
     (html/content (translations :invitation-response/banner-message))))

-(html/defsnippet flash-bar library-html [:.clj-flash-message-bar] [flash]
-  [:.clj-flash-message-bar-text] (html/content flash))
+(defn flash-bar [flash]
+  (html/at flash-bar-snippet
+           [:.clj-flash-message-bar-text] (html/content flash)))

 (html/defsnippet status-flash-bar
   library-html [:.clj-status-bar] [{:keys [doc translations invitation-rsvp] :as context}]


don't use 24 hour clock when already printing AM/PM

--- src/chat/client/views/helpers.cljs
+++ src/chat/client/views/helpers.cljs
@@ -48,4 +48,4 @@
 (defn format-date
   "Turn a Date object into a nicely formatted string"
   [date]
-  (f/unparse (f/formatter "H:mm A") (t/to-default-time-zone date)))
+  (f/unparse (f/formatter "h:mm A") (t/to-default-time-zone date)))


Fix a missing require

Fix a missing require

--- src/circle/backend/build/email.clj
+++ src/circle/backend/build/email.clj
@@ -1,9 +1,9 @@
 (ns circle.backend.build.email
+  (:require [clojure.string :as str])
+  (:use [clojure.tools.logging :only (infof)])
+  (:use [clojure.core.incubator :only (-?>)])
   (:require [circle.backend.build :as build])
-  (:require [circle.backend.email :as email])
-  (:use [clojure.core.incubator :only (-?>)])
-  (:use [clojure.tools.logging :only (infof)])
-  (:use [arohner.utils :only (inspect)]))
+  (:require [circle.backend.email :as email]))

 (defn email-subject [build]
   (if (build/successful? build)


Trying the transducer approach

Trying the transducer approach

--- src/clj/algorithms_clj/huffman.clj
+++ src/clj/algorithms_clj/huffman.clj
@@ -75,6 +75,39 @@
 ;; Decoding
 ;; -----------------------------------------------------------

+(defn huffman-decoder
+  "Transducer step function to decode a huffman stream of values"
+  [huffman-tree]
+  (fn [xf]
+    (let [curr-branch (volatile! huffman-tree)
+          is-leaf #(= 1 (-> % :values count))
+          leaf-val #(-> % :values first)]
+
+      (fn step-fn
+        ([] (xf))
+        ([result]
+          (if (is-leaf @curr-branch)
+            (xf result (leaf-val @curr-branch))
+            (xf result)))
+
+        ([result input]
+          (let [prev-branch @curr-branch
+                {:keys [lhs rhs]} (if (is-leaf prev-branch) huffman-tree @curr-branch)]
+            (vreset! curr-branch
+              (cond
+                (= 0 input) lhs
+                (= 1 input) rhs))
+            (if (is-leaf prev-branch)
+              (xf result (leaf-val prev-branch))
+              result)
+            ))
+        ))))
+
+(defn decode-with-xf
+  [huffman-tree inputs]
+  (transduce (huffman-decoder huffman-tree) conj [] inputs))
+
+
 (defn ^:private decode-one ;; TODO - Could be made a step function of a transducer
   [{:keys [values lhs rhs]} bits]
   (cond
@@ -108,6 +141,7 @@
   (prn (encode-with t [:a :b]))
   (prn (encode [:a :b]))
   (prn (decode t [0 1 0 0 1 1]))
+  (prn (decode-with-xf t [0 1 0 0 1 1]))
   )


Switch images to https

Switch images to https

--- src/clj/clojuredocs/site/intro.clj
+++ src/clj/clojuredocs/site/intro.clj
@@ -62,7 +62,7 @@
       " takes a bit to get your head around. Stick with it, and you won't be disappointed."]]
     [:div.col-md-6
      [:p "But don't take our word for it, here's what XKCD has to say:"]
-     [:p [:img {:src "http://imgs.xkcd.com/comics/lisp_cycles.png"}]]
+     [:p [:img {:src "https://imgs.xkcd.com/comics/lisp_cycles.png"}]]
      [:p "Seems like more than a few, these days. Happy coding!"]]
     [:div.col-md-12.used-by
      [:h3 "Clojure in Production"]
@@ -70,23 +70,23 @@
       (for [{:keys [src url]}
             [{:src "https://g.twimg.com/Twitter_logo_blue.png"
               :url "https://twitter.com"}
-             {:src "http://www.akamai.com/images/img/bg/akamai-logo.png"
+             {:src "https://upload.wikimedia.org/wikipedia/en/8/8b/Akamai_logo.svg"
               :url "http://www.akamai.com/"}
-             {:src "http://www.climate.com/preso/assets/imgs/shared/logos/tcc_logo_marcom.png"
+             {:src "https://upload.wikimedia.org/wikipedia/en/2/22/The_Climate_Corporation_Logo2.jpg"
               :url "http://www.climate.com/"}
-             {:src "http://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Netflix_logo.svg/200px-Netflix_logo.svg.png"
+             {:src "https://upload.wikimedia.org/wikipedia/commons/thumb/6/69/Netflix_logo.svg/200px-Netflix_logo.svg.png"
               :url "https://www.netflix.com"}
-             {:src "http://www.factual.com/assets/factual_logo_small-9d5ae614ae5422b251648ca62d6b4e51.png"
+             {:src "https://www.factual.com/assets/factual_logo_small-9d5ae614ae5422b251648ca62d6b4e51.png"
               :url "http://www.factual.com"}
              {:src "https://www.simple.com/img/logo-a2236763875.png"
               :url "https://simple.com"}
-             {:src "http://upload.wikimedia.org/wikipedia/commons/c/cc/Groupon_logo.png"
+             {:src "https://upload.wikimedia.org/wikipedia/commons/c/cc/Groupon_logo.png"
               :url "http://www.groupon.com/"}
              {:src "https://d1lpkba4w1baqt.cloudfront.net/heroku-logo-light-234x60.png"
               :url "https://www.heroku.com"}
-             {:src "http://img.brightcove.com/logo-corporate-new.png"
+             {:src "https://img.brightcove.com/logo-corporate-new.png"
               :url "http://www.brightcove.com"}
-             {:src "http://f.cl.ly/items/3D0u2W0H322U1V2Z2u0P/80x50_orange.png"
+             {:src "https://upload.wikimedia.org/wikipedia/en/9/92/SoundCloud_logo.svg"
               :url "https://soundcloud.com"}]]
         [:li [:a {:href url} [:img {:src src}]]])]]]
    [:div.row


refine transaction update

refine transaction update

--- src/clj_money/web/transactions.clj
+++ src/clj_money/web/transactions.clj
@@ -62,7 +62,8 @@
         (hidden-input-element (str "id-" index) id))
       (select-element (str "account-id-" index)
                       (:account-id item)
-                      (account-options entity-id)
+                      (account-options entity-id
+                                       {:include-none? true})
                       {:suppress-label? true}))]
    [:td.col-sm-2
     (text-input-element (str "credit-amount-" index) (:credit-amount item) {:suppress-label? true})]
@@ -92,6 +93,16 @@
         (update-in [:account-id] #(Integer. %))
         (dissoc :credit-amount :debit-amount))))

+(defn- items-for-form
+  [transaction]
+  (map-indexed #(->> %2
+                        ->form-item
+                        (item-row (:entity-id transaction) %1))
+               (concat (:items transaction)
+                       (repeat {:action nil
+                                :account-id nil
+                                :amount nil}))))
+
 (defn- form-fields
   [transaction]
   (html
@@ -103,9 +114,7 @@
       [:th "Account"]
       [:th "Credit"]
       [:th "Debit"]]
-     (map-indexed #(->> %2
-                        ->form-item
-                        (item-row (:entity-id transaction) %1)) (:items transaction))]
+     (take 10 (items-for-form transaction))]
     [:input.btn.btn-primary {:type :submit :value "Save"}]
     [:a.btn.btn-default
      {:href (format "/entities/%s/transactions" (:entity-id transaction))
@@ -134,7 +143,7 @@
                      indexed-attr (map #(keyword (str (name %) "-" index)) attr)
                      item (zipmap attr (map #(% params) indexed-attr))]
                  item)))
-       (take-while #(:account-id %))
+       (take-while #(or (integer? (:account-id %)) (seq (:account-id %))))
        (map ->transaction-item)))

 (defn create
@@ -170,7 +179,7 @@
                         (assoc :items (extract-items params)))
         updated (transactions/update (env :db) transaction)]
     (if (validation/has-error? updated)
-      (edit transaction)
+      (edit transaction {:alerts [{:type :danger :message (str "Unable to save the transaction " (validation/get-errors updated))}]})
       (redirect (format "/entities/%s/transactions" (:entity-id updated))))))

 (defn delete


Rename exception? precate to throwable?.

--- src/cljx/cats/monad/exception.cljx
+++ src/cljx/cats/monad/exception.cljx
@@ -69,9 +69,9 @@
   #+clj (throw (IllegalArgumentException. message))
   #+cljs (throw (js/Error. message)))

-(defn exception?
-  "Check if provided parameter is an instance
-  of exception or not."
+(defn throwable?
+  "Return true if `v` is an instance of
+  the Throwable or js/Error type."
   [e]
   (instance? #+clj Exception #+cljs js/Error e))

@@ -178,7 +178,7 @@
   differs a little bit from clojure."
   ([e] (failure e ""))
   ([e message]
-   (if (exception? e)
+   (if (throwable? e)
      (Failure. e)
      (Failure. (ex-info message e)))))


Add comments re: attack plan

Add comments re: attack plan

The top-level message/child-> and /parent-> functions have access to
the ioloop, but not any sort of state.

Basically just trying to figure out what I do about logging there.

--- src/clojure/frereth_cp/message.clj
+++ src/clojure/frereth_cp/message.clj
@@ -1011,7 +1011,7 @@
                        #(log2/warn %
                                    ::action-trigger
                                    "Updater returned"
-                                   (dissoc state' ::log/state)))
+                                   (dissoc state' ::log2/state)))
         _ (assert (::specs/outgoing state') (str "After updating for " tag))
         my-logs (::log2/state state')
         forked-logs (log2/fork my-logs)
@@ -1541,18 +1541,32 @@
                                  ::specs/stream stream})]
      (let [state-holder (dfrd/deferred)
            req (strm/try-put! stream [::query-state state-holder] timeout)]
+       ;; FIXME: Switch to using dfrd/chain instead
        (dfrd/on-realized req
                          (fn [success]
-                           (log/debug
-                            (utils/pre-log message-loop-name)
-                            "Submitted get-state query:" success))
+                           (log2/flush-logs! logger
+                                             (log2/debug local-logs
+                                                         ::succeeded
+                                                         "get-state query submitted"
+                                                         {::result success
+                                                          ::specs/message-loop-name message-loop-name})))
                          (fn [failure]
-                           (log/error failure
-                                      (utils/pre-log message-loop-name)
-                                      "Submitting state query")
+                           (log2/flush-logs! logger
+                                             (if (instance? Throwable failure)
+                                               (log2/exception local-logs
+                                                               failure
+                                                               ::exceptional-failure
+                                                               "Submitting get-state query failed"
+                                                               {::specs/message-loop-name message-loop-name})
+                                               (log2/error local-logs
+                                                           ::non-exceptional-failure
+                                                           "Submitting get-state failed mysteriously"
+                                                           {::result failure
+                                                            ::specs/message-loop-name message-loop-name})))
                            (deliver state-holder failure)))
        (let [{log-state ::log2/state
               :as result} (deref state-holder timeout failure-signal)]
+         ;; Need to sync log-state with local-logs
          (throw (RuntimeException. "Start back here"))
          result))))
   ([stream-holder]
@@ -1602,6 +1616,20 @@
     :as io-handle}
    array-o-bytes]
   (let [prelog (utils/pre-log message-loop-name)]
+    ;; Q: What on Earth can I do about logging this?
+    ;; I could just create a new set of log entries each
+    ;; time.
+    ;; Starting over from 0 seems idiotic.
+    ;; I could wrap the function definition in an atom/agent that
+    ;; tracks the log state over the course of each call.
+    ;; That seems really dumb, since it creates a single-threaded
+    ;; pipeline bottleneck from each child thread.
+    ;; That probably isn't a big deal for clients, but it seems like
+    ;; a mistake for servers.
+    ;; Servers will wind up with their own bottlenecks, but this
+    ;; should not be one of them.
+    ;; It's a conundrum.
+    ;; TODO: Unravel it.
     (log/debug prelog
                "Top of child->!")
     (when-not from-child
@@ -1673,6 +1701,13 @@
   ;; needs to happen first.
   (let [prelog (utils/pre-log message-loop-name)]
     (try
+      ;; This has the same problem as child->
+      ;; Where am I supposed to send the logs?
+      ;; It's tempting to create a child-specific
+      ;; instance of both functions when the ioloop
+      ;; gets created.
+      ;; That doesn't seem like a terrible idea.
+      ;; Q: Does it hold water under the light of day?
       (log/info prelog
                 "Top of parent->!")
       (let [success
@@ -1711,5 +1746,5 @@

   ;; The child-monitor loop should handle this
   ;; detail
-  (comment (child-> io-handle ::specs/normal))
+  #_(comment (child-> io-handle ::specs/normal))
   (.close from-child))


removed ndvi from docstring

removed ndvi from docstring

--- src/clj/forma/trends/filter.clj
+++ src/clj/forma/trends/filter.clj
@@ -12,7 +12,7 @@
   time series.

   Example:
-    (dummy-mat 23 (count ndvi))
+    (dummy-mat 23 (count (s/sample-normal 100)))
     ;; 23: frequency of 16-day MODIS data
     ;; 12: frequency of 32-day MODIS data"
   [freq n]
@@ -20,10 +20,10 @@

 (defn deseasonalize
   "returns a deseasonalized vector based on the frequency `freq` of
-  the data in the supplied time series `ts`
+  the measurements in the supplied timeseries `ts`

   Example:
-    (deseasonalize 23 ndvi)"
+    (deseasonalize 23 (s/sample-uniform 200))"
   [freq ts]
   (let [x (dummy-mat freq (i/nrow ts))
         xt (i/trans x)


implement Disposable HQ

implement Disposable HQ

--- src/clj/game/cards-upgrades.clj
+++ src/clj/game/cards-upgrades.clj
@@ -116,6 +116,25 @@
    "Dedicated Technician Team"
    {:recurring 2}

+   "Disposable HQ"
+   (letfn [(dhq [n i]
+             {:req (req (pos? i))
+              :prompt "Choose a card in HQ to add to the bottom of R&D"
+              :choices {:req #(and (:side % "Corp") (in-hand? %))}
+              :msg "add a card to the bottom of R&D"
+              :effect (req (move state side target :deck)
+                           (when (< n i)
+                             (resolve-ability state side (dhq (inc n) i) card nil)))})]
+     {:access {:effect (req (let [n (count (:hand corp))]
+                              (show-wait-prompt state :runner "Corp to finish using Disposable HQ")
+                              (resolve-ability state side
+                                {:optional
+                                 {:prompt "Use Disposable HQ to add cards to the bottom of R&D?"
+                                  :yes-ability {:msg "add cards in HQ to the bottom of R&D"
+                                                :effect (effect (resolve-ability (dhq 1 n) card nil))}
+                                  :end-effect (effect (clear-wait-prompt :runner))}}
+                               card nil)))}})
+
    "Experiential Data"
    {:effect (req (update-ice-in-server state side (card->server state card)))
     :events {:pre-ice-strength {:req (req (= (card->server state card) (card->server state target)))


Tuple rule for basic match and :exists

Tuple rule for basic match and :exists

--- src/clj/todomvc/tuple_rule.cljc
+++ src/clj/todomvc/tuple_rule.cljc
@@ -1,5 +1,6 @@
 (ns todomvc.tuple-rule
-    (:require [clara.rules.compiler :as com]
+    (:require [clara.rules :refer [defrule]]
+              [clara.rules.compiler :as com]
               [clara.rules.dsl :as dsl]))

@@ -49,40 +50,39 @@
 ;       ;; Add the environment, if given.
 ;       (not (empty? env)) (assoc :env matching-env)))))
 (defn is-binding? [x]
-  ;(println "Is a binding?" x)
+  (println "Is a binding?" x)
   ;TODO. Long cannot be cast to Named
   (= (first (name x)) \?))

-(defn rewrite-lhs [forms]
-  (println "Forms" forms)
-  (mapv (fn main-one [form]
-         ;(println "Form" form)
-         ;(println "Type" (type form))
-         (println "is op" (dsl/ops (first form)))
-         (if (dsl/ops (first form))
-           form
-           (let [bindings (into {}
-                            (filter
-                              (fn [[k v]]
-                                (and (not= \_ v)
-                                     (identity v)
-                                     (is-binding? v)))
-                              ;(juxt (comp identity second)
-                              ;      (partial (not= \_)) second
-                              ;      (comp is-binding? second)))
-                              {:e (first form)
-                               :a (second form)
-                               :v (last form)}))
-                 attribute (if (keyword? (second form)) (second form) :all)]
-             (prn "Bindigs are" bindings)
-             ;(println "attribute is" attribute)
-            (vector
-              attribute (vector ['e 'a 'v])
-              (map (fn last-one [[k v]]
-                       (println "k v bindings" k v)
-                       (list '= v (symbol (name k)))) bindings)))))
+(defn tuple-bindings [tuple]
+  (into {}
+    (filter
+      (fn [[k v]]
+        (and (not= \_ v)
+          (identity v)
+          (is-binding? v)))
+      {:e (first tuple)
+       :a (second tuple)
+       :v (last tuple)})))

-    forms))
+(defn rewrite-lhs [exprs]
+  (mapv (fn main-one [expr]
+          (println "expr" expr)
+          (println "is op" (dsl/ops (first expr)))
+          (if (dsl/ops (first expr))
+            expr
+            (let [tuple     (first expr)
+                  bindings  (tuple-bindings tuple)
+                  attribute (if (keyword? (second tuple)) (second tuple) :all)]
+              (println "Bindings: " bindings)
+              (reduce
+                (fn last-one [condition [k v]]
+                  (println "K V" k v)
+                  (conj condition (list '= v (symbol (name k)))))
+                (vector attribute (vector ['e 'a 'v]))
+                bindings))))
+    exprs))
+
 #?(:clj
    (defmacro def-tuple-rule
      "Defines a rule and stores it in the given var. For instance, a simple rule would look like this:
@@ -105,25 +105,21 @@
              body       (if doc (rest body) body)
              properties (if (map? (first body)) (first body) nil)
              definition (if properties (rest body) body)
-             {:keys [lhs rhs]} (dsl/split-lhs-rhs definition)
-             lhs-new    (rewrite-lhs (first lhs))]
-         (println "LHS" lhs-new)
-         (println "RHS" rhs)
+             {:keys [lhs rhs]} (dsl/split-lhs-rhs definition)]
+         ;(println "LHS in" lhs)
+         ;(println "LHS out" (rewrite-lhs lhs))
          (when-not rhs
            (throw (ex-info (str "Invalid rule " name ". No RHS (missing =>?).")
                     {})))
          `(def ~(vary-meta name assoc :rule true :doc doc)
-            (cond-> ~(dsl/parse-rule* lhs-new rhs properties {} (meta &form))
+            (cond-> ~(dsl/parse-rule* (rewrite-lhs lhs) rhs properties {} (meta &form))
               ~name (assoc :name ~(str (clojure.core/name (ns-name *ns*)) "/" (clojure.core/name name)))
               ~doc (assoc :doc ~doc)))))))

 ;LHS ([[?e :todo/title _]] [:exists [:todo/done]])

 ;LHS ([:todo/title [[e a v]] (= ?e e)] [:exists [:todo/done]])
-(rewrite-lhs (first
-               '([
-                  [?e :todo/title _]
-                  [:exists [:todo/done]]])))
+(rewrite-lhs '([[?e :todo/title _]] [:exists [:todo/done]]))

 (macroexpand
   '(def-tuple-rule my-tuple-rule
@@ -134,7 +130,7 @@
      (println "Hello!")))

 (macroexpand
-  '(def-tuple-rule my-regular-rule
+  '(defrule my-regular-rule
      "Docstring!!"
      [:todo/title [[e a v]] (= ?e e)]
      [:exists [:todo/done]]


cljs-nusmods.main - Add `ModuleDepartment` information to Exhibit 3 db

This enables the `Faculty / Department` HierarchicalFacet on the Module
Finder page.

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -95,6 +95,36 @@
   (.push itemsArray (js-obj "type" "ModuleType", "label" "Not in CORS"))
   itemsArray)

+(defn- add-module-departments-to-exhibit-items
+  "Adds `ModuleDepartment` information to a JavaScript Array used as the `items`
+   value for an Exhibit 3 database, and returns the Array.
+   This enables the HierarchicalFacet on the Module Finder page which filters
+   modules by Faculty / Department"
+  [AUXMODULES itemsArray]
+  (let [departmentToFacultyIndexHash (aget AUXMODULES "departmentToFaculty")
+        departmentStringsArray       (aget AUXMODULES "departments")]
+    (doseq [[departmentIdxString facultyIdx]
+              (filter (fn [kv]
+                        (let [departmentIdx (int (first kv))
+                              facultyIdx    (second kv)]
+                          (not= departmentIdx facultyIdx)))
+                      (js->clj departmentToFacultyIndexHash))]
+      (let [departmentIdx    (int departmentIdxString)
+            departmentString (nth departmentStringsArray departmentIdx)
+            facultyString    (nth departmentStringsArray facultyIdx)]
+        (.push itemsArray (js-obj "type"       "ModuleDepartment"
+                                  "label"      departmentString
+                                  "subtopicOf" facultyString))))
+    itemsArray))
+
+(defn- add-aux-info-to-exhibit-items
+  "Add `ModuleType` and `ModuleDepartment` information to a JavaScript Array
+   used as the `items` value for an Exhibit 3 database, and returns the Array."
+  [AUXMODULES itemsArray]
+  (add-module-types-to-exhibit-items itemsArray)
+  (add-module-departments-to-exhibit-items AUXMODULES itemsArray)
+  itemsArray)
+
 ; Main entry point of the program
 (defn ^:export init []
   ; Globals
@@ -112,7 +142,8 @@
     (one $document "scriptsLoaded.exhibit"
       (fn []
         (let [modulesArray (build-modules-array MODULES AUXMODULES)
-              itemsArray   (add-module-types-to-exhibit-items modulesArray)
+              itemsArray   (add-aux-info-to-exhibit-items AUXMODULES
+                                                          modulesArray)
               Exhibit      (aget js/window "Exhibit")
               database     (aset js/window "database"
                                  (.create (.-Database Exhibit)))


Docstrings

Docstrings

--- src/cljs/db_quiz/normalize.cljs
+++ src/cljs/db_quiz/normalize.cljs
@@ -1,9 +1,9 @@
 (ns db-quiz.normalize
-  "Clojurescript version of <http://stackoverflow.com/a/18391901/385505>"
   (:refer-clojure :exclude [replace])
   (:require [clojure.string :refer [replace]]))

-(def ^:private default-diacritics-removalap
+(def ^:private default-diacritics-removal-map
+  "Clojurescript version of <http://stackoverflow.com/a/18391901/385505>"
   [
    {:base "A"
     :letters "\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"}
@@ -180,12 +180,13 @@
   ])

 (def diacritics-map
-  (into {} (apply concat
-                  (map (fn [{:keys [base letters]}]
-                         (map #(vector % base) letters))
-                       default-diacritics-removalap))))
+  (->> default-diacritics-removal-map
+       (map (fn [{:keys [base letters]}] (map #(vector % base) letters)))
+       (apply concat)
+       (into {})))

 (defn replace-diacritics
+  "Replace diacritical characters in s with their ASCII analogues."
   [s]
   (replace s
            #"[^\u0000-\u007E]"


Comment only.

Comment only.

--- src/cljs/leipzig_live/core.cljs
+++ src/cljs/leipzig_live/core.cljs
@@ -68,11 +68,11 @@
     (-> state :music print)]])

 ;; -------------------------
-;; Initialize app
+;; Wiring

 (defn mount-root []
   (let [state-atom (atom {:music [100 120]
-                     :text "'(100 120)"})]
+                          :text "'(100 120)"})]
     (reagent/render
       [home-page (partial apply-action! state-atom) @state-atom]
       js/document.body)))


Add get-arities util function.

Add get-arities util function.

--- src/clojure/catacumba/utils.clj
+++ src/clojure/catacumba/utils.clj
@@ -22,3 +22,11 @@
         [cur val])
       val)))

+(defn- get-arities
+  [f]
+  {:pre [(instance? clojure.lang.AFunction f)]}
+  (->> (class f)
+       (.getDeclaredMethods)
+       (filter #(= "invoke" (.getName %)))
+       (map #(-> % .getParameterTypes alength))
+       (set)))


Good eye, Steve.

Good eye, Steve.

--- src/clojure/parkour/io/dseq.clj
+++ src/clojure/parkour/io/dseq.clj
@@ -60,7 +60,7 @@

 (defn dseq?
   "True iff `x` is a distributed sequence."
-  [x] (instance? DSeq true))
+  [x] (instance? DSeq x))

 (defn dseq
   "Return the distributed sequence represented by dseq-able object or


open chat for ens names

open chat for ens names

Signed-off-by: Andrey Shovkoplyas <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/browser/views.cljs
+++ src/status_im/ui/screens/browser/views.cljs
@@ -146,7 +146,7 @@
     (when (or loading? resolving?)
       [react/view styles/web-view-loading
        [react/activity-indicator {:animating true}]])]
-   [navigation url webview can-go-back? can-go-forward?]
+   [navigation url-original webview can-go-back? can-go-forward?]
    [permissions.views/permissions-panel browser show-permission]
    (when show-tooltip
      [tooltip/bottom-tooltip-info


connecting to twitter's stream and plotting the mentions of bacon

--- src/cljs/baconator/client/main.cljs
+++ src/cljs/baconator/client/main.cljs
@@ -4,8 +4,8 @@

 ;; Setting up the world map

-(def world-map (js/L.map "map", (clj->js {:touchZoom false :zoomControl false :boxZoom false})))
-(def tiles (js/L.tileLayer "http://{s}.tile.cloudmade.com/a0ae0154488d43c281abff127d602c05/997/256/{z}/{x}/{y}.png", (clj->js {:maxZoom 2})))
+(def world-map (js/L.map "map", (clj->js {:dragging false :touchZoom false :zoomControl false :boxZoom false})))
+(def tiles (js/L.tileLayer "http://{s}.tile.cloudmade.com/a0ae0154488d43c281abff127d602c05/997/256/{z}/{x}/{y}.png", (clj->js {:maxZoom 2 :minZoom 2})))
 (.setView world-map (clj->js [21.28 0]) 2)
 (.addTo tiles world-map)

@@ -19,6 +19,8 @@
     (reset! vis-marker marker)
     (.addTo marker world-map)))

+;; Twitter users
+
 ;; Get bacon lovers

 (def ws-url "ws://localhost:8080/checkins")


Don't scroll until 95% of the document

Don't scroll until 95% of the document

As the document gets longer, this is more of a problem actually.

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -84,7 +84,7 @@
                                  .-body
                                  .-clientHeight)]
          (if (> screen-bottom
-                (* 0.75 document-height))
+                (* 0.95 document-height))
            (get-next-image db)
            db))
        db)))


refactor evide

refactor evide

--- src/cljs/salava/badge/ui/modal.cljs
+++ src/cljs/salava/badge/ui/modal.cljs
@@ -19,7 +19,7 @@
             [salava.admin.ui.reporttool :refer [reporttool1]]
             [salava.badge.ui.verify :refer [check-badge]]
             [salava.core.ui.tag :as tag]
-            [clojure.string :refer [blank? starts-with?]]
+            [clojure.string :refer [blank? starts-with? split]]
             [salava.badge.ui.evidence :refer [evidence-icon]]))

@@ -232,6 +232,8 @@
           (reduce (fn [r evidence]
                     (let [{:keys [narrative description name evidence_type id url mtime ctime properties]} evidence
                           added-by-user? (and (not (blank? description)) (starts-with? description "Added by badge recipient"))
+                          resource_id (when-not (= "file" (:type evidence_type)) (->> (split url #"/") ;;FIX
+                                                                                (last)))
                           desc (cond
                                  (not (blank? narrative)) narrative
                                  (not added-by-user?) description ;;todo use regex to match description
@@ -247,7 +249,16 @@

                               (when-not (blank? name) [:div.content-body.name name])
                               (when-not (blank? desc) [:div.content-body.description desc])
-                              [:div.content-body.url (hyperlink url)]]
+                              [:div.content-body.url
+                               (case (:type evidence_type)
+                                 "file" (hyperlink url)
+                                 "page" (if (session/get :user)
+                                          [:a {:href "#"
+                                               :on-click #(do
+                                                            (.preventDefault %)
+                                                            (mo/open-modal [:page :view] {:page-id resource_id}))} url]
+                                          (hyperlink url))
+                                 (hyperlink url))]]
                              ])))
                   [:div ] evidences)]])]]))


[SW] fetch promise timeout

[SW] fetch promise timeout

--- src/clojurescript/nossal/sw/sw.cljs
+++ src/clojurescript/nossal/sw/sw.cljs
@@ -30,12 +30,16 @@
       (.then (fn [response]
                (or response (js/Promise.reject (str "no-match: " (.-url request))))))))

-(defn- fetch [request]
-  (-> (js/fetch request)
-      (.then (fn [response]
-               (if (.-ok response)
-                 (add-cache request (.clone response)))
-               response))
+(defn- fetch [request timeout]
+  (-> (js/Promise. (fn [fulfill reject]
+                     (let [timer (js/setTimeout reject timeout)]
+                       (-> (js/fetch request)
+                           (.then (fn [response]
+                                    (js/clearTimeout timer)
+                                    (if (.-ok response)
+                                      (add-cache request (.clone response)))
+                                    (fulfill response)))
+                           (.catch (fn [] (from-cache request)))))))
       (.catch (fn [] (from-cache request)))))

 (defn- on-install [e]
@@ -51,7 +55,7 @@
 (defn- on-fetch [e]
   (let [request (.-request e)]
     (case (:host (parse-url (.-url request)))
-      ("localhost" "noss.al" "nossal.com.br") (fetch request)
+      ("localhost" "noss.al" "nossal.com.br") (fetch request 400)
       (js/fetch request))))

 (defn- on-activate [e]
@@ -61,5 +65,5 @@

 (.addEventListener js/self "install" #(.waitUntil % (on-install %)))
-(.addEventListener js/self "fetch" #(.respondWith % (on-fetch % 400)))
+(.addEventListener js/self "fetch" #(.respondWith % (on-fetch %)))
 (.addEventListener js/self "activate" #(.waitUntil % (on-activate %)))


code_rand update: NOOP and print to stderr if there are no global-atom-generators.

--- src/clojush/instructions/random.clj
+++ src/clojush/instructions/random.clj
@@ -32,11 +32,15 @@
   code_rand
   (fn [state]
     (if (not (empty? (:integer state)))
-      (push-item (random-code (math/abs (mod (stack-ref :integer 0 state)
-                                             max-points-in-random-expressions))
-                              @global-atom-generators)
-                 :code
-                 (pop-item :integer state))
+      (if (empty? @clojush.globals/global-atom-generators)
+	(binding [*out* *err*]
+	  (println "code_rand: global-atom-generators is empty.")
+	  state)
+	(push-item (random-code (math/abs (mod (stack-ref :integer 0 state)
+					       max-points-in-random-expressions))
+				@global-atom-generators)
+		   :code
+		   (pop-item :integer state)))
       state)))

 (define-registered


Call hooks without do-swing

Call hooks without do-swing

they might not need it.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/draw/scenes.clj
+++ src/conexp/contrib/draw/scenes.clj
@@ -8,7 +8,6 @@

 (ns conexp.contrib.draw.scenes
   (:use conexp.base)
-  (:use [clojure.contrib.swing-utils :only (do-swing)])
   (:import [java.awt Color Canvas]
 	   [java.awt.event ComponentListener]
 	   [java.io File]
@@ -139,7 +138,7 @@
   (when (not (contains? (get-scene-hooks scn) hook))
     (illegal-argument "Hook " hook " cannot be called for scene."))
   (doseq [callback (get (get-scene-hooks scn) hook)]
-    (do-swing (apply callback args))))
+    (apply callback args)))

 ;; methods on scenes


Update words.clj

Update words.clj

--- src/iyye/subcon/knowledge/words.clj
+++ src/iyye/subcon/knowledge/words.clj
@@ -22,28 +22,33 @@
     ;[iyye.subcon.knowledge.relation :as relation]
     ))

+(def types-words (ref []))
 (def relations-words (ref []))
-(def types-words (ref []))
 (def instances-words (ref []))
 (def adjective-words (ref []))
 (def action-words (ref []))

-(defrecord Iyye_Predicate [AccordingTo When Time Prob])
+(defrecord Iyye_ModalPredicate [AccordingTo When Time Prob])
+(defrecord Iyye_Atom [Name Uname])
+(defrecord Iyye_Relation [atom Predicate Inputs Function])
+(defrecord Iyye_Type [atom SubtypeOf Subtypes])
+(defrecord Iyye_Instance [atom type])

-(defrecord Iyye_Atom [Name Uname predicate])
-
-(defn create-iyye-atom [name according when words-list]
+(defn create-iyye-atom [name words-list]
   (let [Time (persistence/current-time-to-string)
         uname (str name (count words-list))
-        atom (->Iyye_Atom name uname (->Iyye_Predicate according when Time 1.0))]
+        atom (->Iyye_Atom name uname)]
     atom))

-(defrecord Iyye_Type [atom SubtypeOf Subtypes Predicates])
+(defn create-iyye-type [Name]
+  (let [type-atom (create-iyye-atom Name types-words)
+        type (->Iyye_Type type-atom [] [])]
+    type))

-(defn create-iyye-type [Name AccordingTo When SubtypeOf Subtypes]
-  (let [type-atom (create-iyye-atom Name AccordingTo When types-words)
-        type (->Iyye_Type type-atom SubtypeOf Subtypes [])]
-    type))
+(defn create-iyye-relation [Name AccordingTo Reason When Types Function]
+  (let [action-atom (create-iyye-atom Name @relations-words)
+        relation (->Iyye_Relation action-atom Reason Types Function)]
+    relation))

 (defn load-iyye-atom-from-db [uname]
   )
@@ -54,43 +59,9 @@
 ;(dosync (alter types-words conj type))
 ;(persistence/write-noun-to-db (into {} type))

-(defrecord Iyye_Relation [atom Reason Types Function])
-
-(defn create-iyye-relation [Name AccordingTo Reason When Types Function]
-  (let [action-atom (create-iyye-atom Name AccordingTo When @relations-words)
-        relation (->Iyye_Relation action-atom Reason Types Function)]
-    relation))
-
-(defrecord Iyye_Instance [atom type])

 (defn create-iyye-instance [values])

-;(dosync (alter relations-words conj relation))
-;(persistence/write-action-to-db (conj (into {} (:atom 8action)) (dissoc (into {} action) :atom)))
-;
-; (defn write-to-db [atom]
-;  (persistence/write-knowledge-to-db (conj (into {} (:atom action)) (dissoc (into {} action) :atom))))
-
-;(defn ^{:source "(+ 1 a)"} aaa [a] (+ 1 a))
-;(defmacro getsrc [func] `(:source (meta (var ~func))))
-
-(defn iyye_is_type_function [p1 p2]
-  (let [p2-type (load-iyye-type-from-db p2)
-        newtype (if p2-type p2-type (create-iyye-type p2 :IYE :ALWAYS p1 []))])
-
-  )
-
-(defn iyye_consists_function [p1 p2]
-  (let [])
-  )
-
-(defn iyye_instance_function [p1 name]
-  (let [])
-  )
-
-(def iyye_is_type (ref 0))
-(def iyye_consists_type (ref 0))
-(def iyye_create_instance (ref 0))

 (defn action [cmd params IO]
   (let [actions
@@ -103,32 +74,3 @@
             ((:Function action) params)
             (ioframes/process-output IO (str "failed to parse: types mismatch " cmd ": " action ":" params))))
       (ioframes/process-output IO (str "failed to parse: too many matched action to " cmd ": " actions)))))
-
-(defn- init-builtins-kb []
-  (let [t_is (create-iyye-relation "is" :IYE :AXIOM :ALWAYS [] iyye_is_type_function)
-        consistsof (create-iyye-relation "consists" :IYE :AXIOM :ALWAYS [] iyye_consists_function)
-        instof (create-iyye-relation "instance of" :IYE :AXIOM :ALWAYS [] iyye_instance_function)]
-    (dosync (ref-set iyye_is_type t_is))
-    (dosync (ref-set iyye_consists_type consistsof))
-    (dosync (ref-set iyye_create_instance instof))
-    ; (dosync (alter noun-words conj iyye_concept))
-    ;(dorun (map #(do ( persistence/write-fact-to-db (into {} %))) @action-words))
-    ))
-
-(defn- init-db-kb []
-  (let []
-    (dosync (alter relations-words #(apply conj %1 %2) (persistence/read-knowledge-from-db "relations" {:When :ALWAYS})))
-    (dosync (alter types-words #(apply conj %1 %2) (persistence/read-knowledge-from-db "types" {:When :ALWAYS})))
-    ))
-
-(defn load-init-kb []
-  (init-builtins-kb)
-  (init-db-kb)
-
-  )
-
-(defn init-kb []
-  (init-builtins-kb)
-  )
-
-; (apply str (rest (str (:When {:When :ALWAYS}))))


fix incorrect ns form in main namespace

fix incorrect ns form in main namespace

--- src/leiningen/new/lein_quick_om/main.cljs
+++ src/leiningen/new/lein_quick_om/main.cljs
@@ -1,4 +1,4 @@
-(ns {{name}}.core
+(ns {{name}}.main
   (:require-macros [cljs.core.async.macros :refer [go]])
   (:require [om.core :as om]
             [om.dom :as dom]


disable cleanup

disable cleanup

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -973,7 +973,7 @@
   ([{eof :eof :as opts :or {eof :eofthrow}} reader] (read* reader (= eof :eofthrow) eof nil opts (LinkedList.)))
   ([reader eof-error? sentinel]
    (let [ret (read* reader eof-error? sentinel nil {} (LinkedList.))]
-     (when (source-logging-reader? reader)
+     #_(when (source-logging-reader? reader)
        (let [^StringBuilder buf (:buffer @(.source-log-frames ^SourceLoggingPushbackReader reader))]
          (.setLength buf 0)))
      ret)))


correctly check for non-empty paths

correctly check for non-empty paths

--- src/org/spootnik/cyanite/store.clj
+++ src/org/spootnik/cyanite/store.clj
@@ -221,7 +221,7 @@
   (debug "fetching paths from store: " paths rollup period from to
          (max-points paths rollup from to))

-  (if paths
+  (if (seq paths)
     (let [q          (fetchq session)
           data       (->> (alia/execute
                            session q


use serialization to setup tests

use serialization to setup tests

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -11,6 +11,7 @@
             [clj-money.models.transactions :as transactions]
             [clj-money.factories.user-factory]
             [clj-money.factories.entity-factory]
+            [clj-money.serialization :as serialization]
             [clj-money.test-helpers :refer [reset-db
                                             assert-validation-error]]))

@@ -133,76 +134,48 @@
     (is (validation/has-error? transaction :items) "Validation error should be present")))

 (def balance-context
-  {:entities [{:name "Personal"}]
+  {:users [(factory :user, {:email "john@doe.com"})]
+   :entities [{:name "Personal"
+               :user-id "john@doe.com"}]
    :accounts [{:name "Checking"
                :type :asset
-               :entity-name "Personal"}
+               :entity-id "Personal"}
               {:name "Salary"
                :type :income
-               :entity-name "Personal"}
+               :entity-id "Personal"}
               {:name "Groceries"
                :type :expense
-               :entity-name "Personal"}]
+               :entity-id "Personal"}]
    :transactions [{:transaction-date (t/local-date 2016 3 2)
-                   :entity-name "Personal"
+                   :entity-id "Personal"
                    :items [{:action :debit
-                            :account-name "Checking"
+                            :account-id "Checking"
                             :amount 1000}
                            {:action :credit
-                            :account-name "Salary"
+                            :account-id "Salary"
                             :amount 1000}]}
                   {:transaction-date (t/local-date 2016 3 3)
-                   :entity-name "Personal"
+                   :entity-id "Personal"
                    :items [{:action :debit
-                            :account-name "Groceries"
+                            :account-id "Groceries"
                             :amount 100}
                            {:action :credit
-                            :account-name "Checking"
+                            :account-id "Checking"
                             :amount 100}]}]})

-(defn realize-users
-  [context]
-  (throw (RuntimeException. "Not implemented")))
-
-(defn realize-entities
-  [context]
-  (update-in context [:entities] (fn [entities]
-                                 (map (fn [attributes]
-                                        (entities/create storage-spec attributes))
-                                      entities))))
-
-(defn create-accounts
-  [context accounts]
-  (map (fn [attributes]
-         (let [entity (->> context
-                           :entities
-                           (filter #(= (:name %) (:entity-name attributes))))]
-           (accounts/create storage-spec (-> attributes
-                                             (assoc :entity entity)
-                                             (dissoc :entity-name)))))
-       accounts))
-
-(defn realize-accounts
-  [context]
-  (update-in context [:accounts] #(create-accounts context %)))
-
-(defn realize
-  "Realizes a test context"
-  [input]
-  (-> input
-      realize-users
-      realize-entities
-      realize-accounts))

 (deftest item-balances-are-set-when-saved
-  (let [context (realize balance-context)
+  (let [context (serialization/realize storage-spec balance-context)
         [checking-items
          salary-items
          groceries-items] (map #(transactions/items-by-account storage-spec (:id %))
                                (:accounts context))]
-    (is (= [(bigdec 1000) (bigdec 900)] (map :balance (checking-items))) "The checking account balances are correct")
-    (is (= [(bigdec 1000)] (map :balance (salary-items))) "The salary account balances are correct")
-    (is (= [(bigdec 100)] (map :balance (groceries-items))) "The groceries account balances are correct")))
+    (is (= [(bigdec 1000) (bigdec 900)] (map :balance checking-items))
+        "The checking account balances are correct")
+    (is (= [(bigdec 1000)] (map :balance (salary-items)))
+          "The salary account balances are correct")
+    (is (= [(bigdec 100)] (map :balance (groceries-items)))
+          "The groceries account balances are correct")))

 ; TODO Need to create the accounts for each test instead of once
 (deftest item-indexes-are-set-when-saved


fix broken module-hash-names

fix broken module-hash-names

closes #284

--- src/main/shadow/build/targets/browser.clj
+++ src/main/shadow/build/targets/browser.clj
@@ -396,8 +396,7 @@
              (filter #(= :shadow-js (:type %)))
              (map #(data/get-output! state %))
              (map :js)
-             (into [prepend output])
-             (conj append)
+             (into [prepend output append])
              (remove nil?)
              (util/md5hex-seq))


Fix unqualify to ensure there is no / in the resulting symbol

--- src/main/workflo/macros/command/util.cljc
+++ src/main/workflo/macros/command/util.cljc
@@ -21,7 +21,7 @@
    it by replacing slashes (/) with dashes (-)."
   [x]
   (let [x-ns   (namespace x)
-        x-name (name x)]
+        x-name (string/replace (name x) "/" "")]
     (if x-ns
       (symbol (str x-ns "-" x-name))
       (symbol x-name))))


Wrong var name

Wrong var name

--- test/onyx/log/percentage_multi_job_test.clj
+++ test/onyx/log/percentage_multi_job_test.clj
@@ -11,11 +11,11 @@

 (def config (read-string (slurp (clojure.java.io/resource "test-config.edn"))))

-(def env-config (assoc (:env-config config) :onyx/id id))
+(def env-config (assoc (:env-config config) :onyx/id onyx-id))

 (def peer-config
   (assoc (:peer-config config)
-    :onyx/id id
+    :onyx/id onyx-id
     :onyx.peer/job-scheduler :onyx.job-scheduler/percentage))

 (def env (onyx.api/start-env env-config))


The :button-color key inside :brand-color is not optional.

--- src/oc/storage/resources/common.clj
+++ src/oc/storage/resources/common.clj
@@ -80,7 +80,7 @@
 (def Color
   {:rgb RGBColor
    :hex (schema/pred hex-color?)
-   (schema/optional-key :button-color) schema/Str})
+   :button-color schema/Str})

 (def BrandColor
   {:light Color


correct sparql endpoint for standalone

correct sparql endpoint for standalone

--- server/src/server/system.clj
+++ server/src/server/system.clj
@@ -39,7 +39,7 @@
                 :join true
                 :auto-reload? true})

-(def oracle-sparql-endpoint "http://localhost:8080/openrdf-sesame/repositories/lov")
+(def oracle-sparql-endpoint "http://localhost:8080/openrdf-sesame")

 (def sparqlify-opts {:host "http://localhost"
                      :port 7531})


(PDB-1854) Strip resources blob when converting reports-query->wire-v5

This commit removes the resources blob when formatting a reports-query
report format to a wire v5 format. This is used only in PE.

--- src/puppetlabs/puppetdb/reports.clj
+++ src/puppetlabs/puppetdb/reports.clj
@@ -123,6 +123,10 @@
   {:href s/Str
    (s/optional-key :data) [metric-wireformat-schema]})

+(def resources-expanded-query-schema
+  {:href s/Str
+   (s/optional-key :data) [resource-wireformat-schema]})
+
 (def logs-expanded-query-schema
   {:href s/Str
    (s/optional-key :data) [log-wireformat-schema]})
@@ -139,6 +143,7 @@
    (s/optional-key :noop) (s/maybe s/Bool)
    (s/optional-key :report_format) s/Int
    (s/optional-key :configuration_version) s/Str
+   (s/optional-key :resources) resources-expanded-query-schema
    (s/optional-key :metrics) metrics-expanded-query-schema
    (s/optional-key :logs) logs-expanded-query-schema
    (s/optional-key :resource_events) resource-events-expanded-query-schema
@@ -168,7 +173,7 @@
 (pls/defn-validated report-query->wire-v5 :- report-v5-wireformat-schema
   [report :- report-query-schema]
   (-> report
-      (dissoc :hash :receive_time)
+      (dissoc :hash :receive_time :resources)
       (update :resource_events resource-events-query->wire-v5)
       (update :metrics metrics-query->wire-v5)
       (update :logs logs-query->wire-v5)))


CMR-2257: Added test.

CMR-2257: Added test.

--- system-int-test/test/cmr/system_int_test/ingest/translation_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/translation_test.clj
@@ -31,7 +31,8 @@
     (is (= 422 status))
     (is (re-find error-regex body))))

-(def minimal-valid-echo-xml "<Collection>
+(def minimal-valid-echo-xml
+  "<Collection>
   <ShortName>ShortName_Larc</ShortName>
   <VersionId>Version01</VersionId>
   <InsertTime>1999-12-31T19:00:00-05:00</InsertTime>
@@ -42,7 +43,7 @@
   <Description>A minimal valid collection</Description>
   <Orderable>true</Orderable>
   <Visible>true</Visible>
-</Collection>")
+  </Collection>")

 (deftest translate-metadata
   (doseq [input-format valid-formats
@@ -106,6 +107,44 @@
           (is (= (mt/format->mime-type output-format) content-type))
           (is (re-find #"<Short_Name>ShortName_Larc</Short_Name>" body)))))))

+(deftest translate-metadata-handles-date-string
+  (testing "CMR-2257: date-string in DIF9 causes InternalServerError"
+    (let [dif9-xml "<DIF xmlns=\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\" xmlns:dif=\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/ http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/dif_v9.8.4.xsd\">
+                   <Entry_ID>minimal_dif_dataset</Entry_ID>
+                   <Entry_Title>A minimal dif dataset</Entry_Title>
+                   <Data_Set_Citation>
+                   <Dataset_Title>dataset_title</Dataset_Title>
+                   </Data_Set_Citation>
+                   <Parameters>
+                   <Category>category</Category>
+                   <Topic>topic</Topic>
+                   <Term>term</Term>
+                   </Parameters>
+                   <Temporal_Coverage>
+                   <Start_Date>1975-01-01</Start_Date>
+                   </Temporal_Coverage>
+                   <Data_Center>
+                   <Data_Center_Name>
+                   <Short_Name>datacenter_short_name</Short_Name>
+                   <Long_Name>data center long name</Long_Name>
+                   </Data_Center_Name>
+                   <Personnel>
+                   <Role>DummyRole</Role>
+                   <Last_Name>UNEP</Last_Name>
+                   </Personnel>
+                   </Data_Center>
+                   <Summary>
+                   <Abstract>summary of the dataset</Abstract>
+                   <Purpose>A grand purpose</Purpose>
+                   </Summary>
+                   <Metadata_Name>CEOS IDN DIF</Metadata_Name>
+                   <Metadata_Version>VERSION 9.8.4</Metadata_Version>
+                   <Last_DIF_Revision_Date>2013-10-22</Last_DIF_Revision_Date>
+                   </DIF>"
+                   {:keys [status body]} (ingest/translate-metadata
+                                           :collection :dif dif9-xml :umm-json
+                                           {:query-params {"skip_umm_validation" "true"}})]
+      (is (= 200 status)))))

 (comment


cleanup

cleanup

--- demo/sitetools/core.cljs
+++ demo/sitetools/core.cljs
@@ -6,9 +6,8 @@
             [secretary.core :as secretary :refer-macros [defroute]]
             [reagent.debug :refer-macros [dbg log dev?]]
             [reagent.interop :as i :refer-macros [.' .!]])
-  (:import [goog History]
-           [goog.history Html5History]
-           [goog.net Jsonp]))
+  (:import goog.History
+           goog.history.Html5History))

 (when (exists? js/console)
   (enable-console-print!))


fix Marcus Batty to trash itself properly and do the ice targeting

--- src/clj/game/cards-upgrades.clj
+++ src/clj/game/cards-upgrades.clj
@@ -143,11 +143,13 @@
                               (lose state :runner :tag 1))}]}

    "Marcus Batty"
-   {:abilities [{:label "[Trash]: Start a Psi game" :msg "start a Psi game"
-                 :psi {:not-equal {:req (req this-server)
-                                   :choices {:req #(and (has? % :type "ICE") (:rezzed %))}
-                                   :msg (msg "resolve a subroutine on " (:title target))
-                                   :effect (effect (trash card {:cause :ability-cost}))}}}]}
+   {:abilities [{:req (req this-server)
+                 :label "[Trash]: Start a Psi game" :msg "start a Psi game"
+                 :psi {:not-equal {:prompt "Choose a rezzed piece of ICE to resolve one of its subroutines"
+                                   :choices {:req #(and (has? % :type "ICE")
+                                                        (:rezzed %))}
+                                   :msg (msg "resolve a subroutine on " (:title target))}}
+                 :effect (effect (trash card))}]}

    "Midori"
    {:abilities


navigate to dashboard on oauth login

navigate to dashboard on oauth login

--- src/clj/salava/oauth/routes.clj
+++ src/clj/salava/oauth/routes.clj
@@ -32,7 +32,7 @@
                     (if (= status "success")
                       (if current-user
                         (redirect (str (get-base-path ctx) "/user/oauth/facebook"))
-                        (assoc-in (redirect (str (get-base-path ctx) "/social/stream"))[:session :identity] {:id user-id :role role :private private} ))
+                        (assoc-in (redirect (str (get-base-path ctx) "/social"))[:session :identity] {:id user-id :role role :private private} ))
                       (if current-user
                         (assoc (redirect (str (get-base-path ctx) "/user/oauth/facebook")) :flash message)
                         (assoc (redirect (str (get-base-path ctx) "/user/login")) :flash message)))))
@@ -56,7 +56,7 @@
                         (if current-user
                           (redirect (str (get-base-path ctx) "/user/oauth/facebook"))
                           ;(u/set-session ctx (redirect (str (get-base-path ctx) "/social/stream")) user-id)
-                          (u/finalize-login ctx (redirect (str (get-base-path ctx) "/social/stream")) user-id (get-in req [:session :pending :user-badge-id]) false)))
+                          (u/finalize-login ctx (redirect (str (get-base-path ctx) "/social")) user-id (get-in req [:session :pending :user-badge-id]) false)))

                       (if current-user
                         (assoc (redirect (str (get-base-path ctx) "/user/oauth/facebook")) :flash message)
@@ -93,7 +93,7 @@
                         (if current-user
                           (redirect (str (get-base-path ctx) "/user/oauth/linkedin"))
                           ;(u/set-session ctx (found (str (get-base-path ctx) "/social/stream/")) user-id)
-                          (u/finalize-login ctx (redirect (str (get-base-path ctx) "/social/stream")) user-id (get-in req [:session :pending :user-badge-id]) false)))
+                          (u/finalize-login ctx (redirect (str (get-base-path ctx) "/social")) user-id (get-in req [:session :pending :user-badge-id]) false)))

                       (if current-user
                         (assoc (redirect (str (get-base-path ctx) "/user/oauth/linkedin")) :flash message)


Quick fn to search the revision from a string

--- src/clj_applenewsapi/bundle.clj
+++ src/clj_applenewsapi/bundle.clj
@@ -20,8 +20,11 @@
 (defn thumbnail [bundle]
   (last (re-find #"\"thumbnailURL\"\:\"bundle\://(.*)\",\"canonicalURL" (article-json bundle))))

+(defn revision-from-json [json]
+  (last (re-find #"\"revision\":\"(.*)\"" json)))
+
 (defn revision [bundle]
-  (last (re-find #"\"revision\":\"(.*)\"" (metadata bundle))))
+  (revision-from-json (metadata bundle)))

 (defn update-revision [bundle revision]
   (let [metadata (json/decode (metadata bundle))]


encapsulate card-list

encapsulate card-list

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -50,12 +50,6 @@
     {:cards {}
      :filter ""
     }))
-
-(def card-list
-  "FRP style zoom on the app state to render"
-  (reaction
-    (filter-by-title (:filter @app-state) (:cards @app-state))
-  ))

 (defn update-card!
   "Update a card"
@@ -153,10 +147,10 @@

 (defn render-app
   []
-  (let [filter (r/cursor app-state [:filter])]
+  (let [filter (r/cursor app-state [:filter])
     [:div
      (render-filter filter)
-     [render-board @card-list]]
+     [render-board @cards]]
   ))

 (def fetch-and-render-app


Reindent some code

Reindent some code

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -40,9 +40,9 @@
         [:div
          [:h1 "Manga Sites"]
          [:ul.inline-list (map (id-btn-for-callback
-                    #(r/comics-path
-                      {:site (name (:id %))}))
-                   site-list)]]))))
+                                #(r/comics-path
+                                  {:site (name (:id %))}))
+                               site-list)]]))))

 (defn comic-buttons [site comic-list]
   (map (id-btn-for-callback


gallery temp revert

gallery temp revert

--- src/cljs/photosure/gallery.cljs
+++ src/cljs/photosure/gallery.cljs
@@ -15,7 +15,12 @@

 (def app-state
   (atom
-    {:photos []
+   {:photos [(photo "images/gallery/a.jpg" ["left"])
+             (photo "images/gallery/b.jpg" ["center"])
+             (photo "images/gallery/cpleblow3.jpg" [])
+             (photo "images/gallery/cpleblow4.jpg" [])
+             (photo "images/gallery/cpleblow5.jpg" [])
+             (photo "images/gallery/cpleblow6.jpg" [])]
      :curr [0 1 2]}))

 (defn img-loaded [photo]
@@ -62,28 +67,18 @@

     om/IWillMount
     (will-mount [_]
-      (util/edn-xhr
-       {:method :get
-        :url "api/cms/gallery/img"
-        :on-complete (fn [_]
-                       (let [photos (apply vector
-                                           (map #(photo (str "images/gallery/" %) []) _))]
-                         (om/update! app :photos photos))
-                       (om/update! app [:photos 0 :pos] ["left"])
-                       (om/update! app [:photos 1 :pos] ["center"])
-                       (om/update! app [:photos 2 :pos] ["right"]))})
-
-      (let [slide-chan (om/get-state owner :slide-chan)]
+      (let [len (count (:photos app))
+            slide-chan (om/get-state owner :slide-chan)]
         (go (loop []
               (let [cmd (<! slide-chan)]
                 (do
                   (if (= cmd "next")
                     (do (om/update! app [:photos (get (:curr @app) 2) :pos] [])
                         (om/transact! app :curr
-                                      (fn [_] (apply vector (map #(mod (dec %) (count (:photos @app))) _)))))
+                                      (fn [_] (apply vector (map #(mod (dec %) len) _)))))
                     (do  (om/update! app [:photos (get (:curr @app) 0) :pos] [])
                          (om/transact! app :curr
-                                       (fn [_] (apply vector (map #(mod (inc %) (count (:photos @app))) _))))))
+                                       (fn [_] (apply vector (map #(mod (inc %) len) _))))))

                   (om/set-state! owner :anim-in-progress true)
                   (om/update! app [:photos (get (:curr @app) 0) :pos] ["left"])


Make sure edit input value is up to date

--- src/cljs/retroboard/client.cljs
+++ src/cljs/retroboard/client.cljs
@@ -319,9 +319,10 @@

 ;;;DRAGGING

-(defn begin-edit [owner]
+(defn begin-edit [owner cur-value]
   (set! (.-height (.-style (om/get-node owner "input")))
         (+ 15 (.-clientHeight (om/get-node owner "text"))))
+  (om/set-state! owner :edit-text cur-value)
   (om/set-state! owner :editing true))

 (defn editable [data owner {:keys [edit-key on-edit element wrap-class input-type] :as opts}]
@@ -329,7 +330,7 @@
     om/IInitState
     (init-state [_]
       {:editing false
-       :edit-text (get data edit-key)})
+       :edit-text nil})
     om/IDidUpdate
     (did-update [this prev-props prev-state]
       (when (and (om/get-state owner :editing)
@@ -344,7 +345,7 @@
         (dom/div #js {:className wrap-class}
                  (element #js {:style (display (not editing))
                                :ref "text"
-                               :onClick #(begin-edit owner)}
+                               :onClick #(begin-edit owner text)}
                           text)
                  ((or input-type dom/textarea)
                   #js {:className "edit-content-input"


Set the name attribute when defining functions

--- src/cljx/revue/interpreter.cljx
+++ src/cljx/revue/interpreter.cljx
@@ -198,16 +198,19 @@
      (assoc state :form nil :value (rest form))
      ;; Definitions
      define
-     (let [[box new-store] (mem/new-box nil store)]
+     (let [[box new-store] (mem/new-box nil store)
+           name (nth form 1)]
        (assoc state
          :form (nth form 2)
-         :env (assoc env (nth form 1) box)
+         :env (assoc env name box)
          :store new-store
-         :cont `((::define ~box) ~@cont)))
+         :cont `((::define ~name ~box) ~@cont)))
      ::define
      (assoc state
        :form nil
-       :store (mem/box-set! value (nth form 1) store))
+       :store (mem/box-set! (if (instance? Proc value)
+                              (assoc value :name (nth form 1))
+                              value) (nth form 2) store))
      ;; Sequence
      begin
      (cond
@@ -332,7 +335,7 @@
   [states]
   (map recursively-remove-global-vars-in states))

-(def *internal-ops* #{::eval-args ::collect-arg ::eval-proc})
+(def ^:dynamic *internal-ops* #{::eval-args ::collect-arg ::eval-proc})

 (defn remove-internal-forms
   "Removes all forms that don't evaluate user code."


Code cleanup

Code cleanup

To make it a bit more readable

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -189,6 +189,12 @@

+
+
+
+
+
+
 (defn get-count [db-table  where   params]
                                                (:cnt (sql-1 (str
                                                   "select count (id) as CNT from "
@@ -196,6 +202,12 @@
                                                   (if (-> where count pos?) (str "where " where " "))
                                                   )
                                                  params)))
+
+
+
+
+
+

@@ -232,7 +244,19 @@

+
+
+
 (def coils-tables-trigger-version "1")
+
+
+
+
+
+
+
+
+

@@ -273,6 +297,18 @@

           )
 )
+
+
+
+
+
+
+
+
+
+
+
+

 (defn make-admin-table []
@@ -304,6 +340,12 @@

   )
   )
+
+
+
+
+
+

@@ -343,6 +385,12 @@

   )
   )
+
+
+
+
+
+

@@ -391,6 +439,12 @@

+
+
+
+
+
+
 (defn make-log-table-update-trigger-function []
     (let [coils-trigger-fn-exists-result      (korma.core/exec-raw
                                                   ["select exists(select * from pg_proc where proname = 'trigger_function_afterUpdate');" []]
@@ -428,6 +482,14 @@

+
+
+
+
+
+
+
+
 (defn make-log-table-delete-trigger-function []
     (let [coils-trigger-fn-exists-result      (korma.core/exec-raw
                                                   ["select exists(select * from pg_proc where proname = 'trigger_function_afterDelete');" []]
@@ -458,6 +520,10 @@
             )
         )
     )
+
+
+
+

@@ -544,7 +610,10 @@

-
+; ----------------------------------------------------------------
+; This is called whenever there has been an update of a realtime
+; query.
+; ----------------------------------------------------------------
 (defn update-query-in-cache [query]
   (let [
         record-count       (get-count   (get query :db-table)  (get query :where)   (get query :params))
@@ -562,9 +631,17 @@
         result-id-vector   (into [] (map :id results))

         existing-query     (get @cached-queries   query)
+
+        clients            @(:clients @existing-query)
         ]
     (do
+      (println (str "    " ))
+      (println (str "    update-query-in-cache" ))
       (println (str "    " query))
+      (println (str "    clients: " clients))
+      (do (for [client clients]
+        (println (str "    Client: " client))
+        ))

       (if (not existing-query)
         (swap! cached-queries assoc  query (atom {:clients  (atom #{})})))
@@ -583,6 +660,13 @@

+
+
+
+
+
+
+
 ; ----------------------------------------------------------------
 ; When the client application running in the web browser needs to be
 ; updated in real time then the server needs to know which
@@ -610,6 +694,12 @@
       (println "")

       )))
+
+
+
+
+
+

@@ -841,6 +931,11 @@

+
+
+
+
+
 ; ----------------------------------------------------------------
 ; On the server check every 1 second for record changes on the
 ; database. If a record changes then send the log entry details to
@@ -888,6 +983,13 @@

+
+
+
+
+
+
+
 ; ----------------------------------------------------------------
 ; Whenever a web client wants to know if the data it is showing
 ; needs to be updated it sends a request to this server side


minor fix in English translation

minor fix in English translation

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -99,7 +99,7 @@
    :here-is-your-passphrase               "Here is your passphrase, *write this down and keep this safe!* You will need it to recover your account."
    :written-down                          "Make sure you had securely written it down"
    :phone-number-required                 "Tap here to enter your phone number & I'll find your friends"
-   :shake-your-phone                      "Find a bug or have a suggestion? Just ~shake~ your phone!"
+   :shake-your-phone                      "Found a bug or have a suggestion? Just ~shake~ your phone!"
    :intro-status                          "Chat with me to setup your account and change your settings!"
    :intro-message1                        "Welcome to Status\nTap this message to set your password & get started!"
    :account-generation-message            "Gimmie a sec, I gotta do some crazy math to generate your account!"


add running instructions in the form of comments in core_test.clj

--- test/duratom/core_test.clj
+++ test/duratom/core_test.clj
@@ -8,6 +8,22 @@
              [io :as io]]
             [clojure.string :as str])
   (:import (clojure.lang Agent)))
+;====================================
+;; start the `default` VM:
+;$ docker-machine start default
+
+;; switch to `default` when using any docker commands
+;$ eval $(docker-machine env default)
+
+;; start up the specified containers
+;$ docker-compose up -d
+
+;; run tests
+; lein test OR selectively in repl
+
+;; shutdown the containers
+;$ docker-compose down
+;====================================

 (defonce docker-default-machine-ip
   ;; `localhost` which works on Ubuntu simply won't work on MacOS.
@@ -20,8 +36,8 @@
                   str/trim-newline
                   not-empty)
           (catch Throwable _))
-        ;; per https://devilbox.readthedocs.io/en/latest/howto/docker-toolbox/find-docker-toolbox-ip-address.html
-        "192.168.99.100")))
+        ;; perhaps docker-machine is not involved
+        "localhost")))

 (defn- common*
   [dura exists? async?]


fix bug due to hardwired value

fix bug due to hardwired value

--- dada-core/src/main/clojure/org/dada/core/JoinModel.clj
+++ dada-core/src/main/clojure/org/dada/core/JoinModel.clj
@@ -144,26 +144,25 @@

 (defn update-lhs
   "return new mutable state and events in response to notifications from the left hand side model"
-  [[old-lhs-index old-rhs-indeces] insertions alterations deletions ^Getter lhs-pk-getter ^Metadata$VersionComparator lhs-version-comparator rhs-i-to-lhs-getters join-fn]
+  [[old-lhs-index old-rhs-indeces] insertions alterations deletions ^Getter lhs-pk-getter ^Metadata$VersionComparator lhs-version-comparator rhs-i-to-lhs-getters join-fn initial-rhs-refs]
   (debug ["update-lhs" rhs-i-to-lhs-getters])
-  (let [initial-rhs-refs [[nil][nil nil]]] ;TODO - parameterise
-    (reduce-lhs
-     (reduce-lhs
-      [old-lhs-index old-rhs-indeces nil nil nil]
-      (concat insertions alterations)
-      lhs-pk-getter
-      initial-rhs-refs
-      lhs-version-comparator
-      rhs-i-to-lhs-getters
-      join-fn
-      false)
-     deletions
-     lhs-pk-getter
-     initial-rhs-refs
-     lhs-version-comparator
-     rhs-i-to-lhs-getters
-     join-fn
-     true)))
+  (reduce-lhs
+   (reduce-lhs
+    [old-lhs-index old-rhs-indeces nil nil nil]
+    (concat insertions alterations)
+    lhs-pk-getter
+    initial-rhs-refs
+    lhs-version-comparator
+    rhs-i-to-lhs-getters
+    join-fn
+    false)
+   deletions
+   lhs-pk-getter
+   initial-rhs-refs
+   lhs-version-comparator
+   rhs-i-to-lhs-getters
+   join-fn
+   true))

 ;;--------------------------------------------------------------------------------

@@ -264,7 +263,8 @@
       i-to-rhs-model-and-lhs-getters))

     (debug ["post-init: watching lhs:" lhs-model])
-    (let [^Metadata lhs-metadata (.getMetadata lhs-model)
+    (let [initial-rhs-refs (apply vector (map (fn [[k vs]] (apply vector (map (fn [v] nil) vs))) rhs-model-to-lhs-fks))
+	  ^Metadata lhs-metadata (.getMetadata lhs-model)
 	  lhs-pk-getter (.getPrimaryGetter lhs-metadata)
 	  lhs-version-comparator (.getVersionComparator lhs-metadata)
 	  ^Data data
@@ -273,12 +273,12 @@
 	   (proxy [View] []
 	     (update [insertions alterations deletions]
 		     (let [[_ _ insertions alterations deletions]
-			   (swap! mutable update-lhs insertions alterations deletions lhs-pk-getter lhs-version-comparator i-to-lhs-getters join-fn)]
+			   (swap! mutable update-lhs insertions alterations deletions lhs-pk-getter lhs-version-comparator i-to-lhs-getters join-fn initial-rhs-refs)]
 		       (if (or insertions alterations deletions)
 			 (.notifyUpdate self insertions alterations deletions))))))]
       (swap! mutable update-lhs
 	     (map (fn [extant] (Update. nil extant))(.getExtant data))
-	     nil nil lhs-pk-getter lhs-version-comparator i-to-lhs-getters join-fn) ;; TODO - deletions/extinct
+	     nil nil lhs-pk-getter lhs-version-comparator i-to-lhs-getters join-fn initial-rhs-refs) ;; TODO - deletions/extinct
       )))

 (defn -getData [^org.dada.core.JoinModel this]


fixes test

fixes test

--- test/gyptis/test/util.cljc
+++ test/gyptis/test/util.cljc
@@ -1,5 +1,6 @@
 (ns gyptis.test.util
   (:require [clojure.test :refer :all]
+            [clj-time.core]
             [gyptis.util :refer :all]))

 (deftest test->epoch-millis


Generate build-tool-only tags too in manifest

Used to have these in the old manually-maintained manifest, and they are handy for one-off commands and what not.

--- src/docker_clojure/manifest.clj
+++ src/docker_clojure/manifest.clj
@@ -14,7 +14,9 @@
           (docker-tag {:omit-jdk? true} variant)
           (docker-tag {:omit-build-tool? true} variant)
           (docker-tag {:omit-build-tool-version? true} variant)
-          (docker-tag {:omit-distro? true} variant))
+          (docker-tag {:omit-distro? true} variant)
+          (docker-tag {:omit-jdk? true, :omit-distro? true
+                       :omit-build-tool-version? true} variant))
         vec
         sort)))


Fix error when exporting non-blank config [GAWB-2667] (#981)

--- src/cljs/main/broadfcui/page/method_repo/method/exporter.cljs
+++ src/cljs/main/broadfcui/page/method_repo/method/exporter.cljs
@@ -56,7 +56,7 @@
 (react/defc MethodExporter
   {:get-initial-state
    (fn [{:keys [props]}]
-     {:preview-config (some-> (:initial-config props) config->id+snapshot)})
+     {:preview-config (:initial-config props)})
    :render
    (fn [{:keys [props state this]}]
      (let [{:keys [method-name dismiss]} props
@@ -97,11 +97,11 @@
                  {:configs configs
                   :style {:body-row (fn [{:keys [row]}]
                                       {:borderTop style/standard-line :alignItems "baseline"
-                                       :background-color (when (= preview-config (config->id+snapshot row))
+                                       :background-color (when (= (config->id+snapshot preview-config) (config->id+snapshot row))
                                                            (:tag-background style/colors))})}
                   :make-config-link-props
                   (fn [config]
-                    {:onClick #(swap! state assoc :preview-config (config->id+snapshot config))})})
+                    {:onClick #(swap! state assoc :preview-config config)})})
           :right (if preview-config
                    [Preview {:preview-config preview-config}]
                    [:div {:style {:position "relative" :backgroundColor "white" :height "100%"}}


Make this test a bit more robust to deal with the speed of CI.

--- integration-tests/apps/jobs/test/jobs/cron.clj
+++ integration-tests/apps/jobs/test/jobs/cron.clj
@@ -2,7 +2,8 @@
   (:use clojure.test
         jobs.helper)
   (:require [immutant.jobs      :as job]
-            [immutant.messaging :as msg]))
+            [immutant.messaging :as msg])
+  (:import java.util.concurrent.atomic.AtomicInteger))

 (defmacro with-job [action & body]
   `(try
@@ -65,9 +66,13 @@
                (job/unschedule "singleton-true")))))

 (deftest reloading-ns-should-not-break-unschedule
-  (let [q (random-queue)]
-    (with-job #(msg/publish q "ping")
+  (let [q (random-queue)
+        aint (AtomicInteger.)]
+    (with-job (fn [] (msg/publish q "ping")
+                (.incrementAndGet aint))
       (is (msg/receive q :timeout 10000))
       (require '[immutant.jobs :as job] :reload-all)
       (job/unschedule "a-job")
-      (is (not (msg/receive q :timeout 5000))))))
+      (let [curval (.get aint)]
+        (Thread/sleep 5000)
+        (is (= curval (.get aint)))))))


Fixes deselection on click

Fixes deselection on click

--- src/front/ui/widgets/tasks.cljs
+++ src/front/ui/widgets/tasks.cljs
@@ -115,11 +115,12 @@
     (reset! key-handler #(utils/key-code %
                                          :escape close))
     (reset! handler (fn [e]
-                      (when (and @editing
-                                 (not (has-as-parent? (.-target e)
-                                                      (.getElementById js/document
-                                                                       (str "todo-" (:id task))))))
-                        (save))))
+                      (when-not (has-as-parent? (.-target e)
+                                                (.getElementById js/document
+                                                                 (str "todo-" (:id task))))
+                        (if @editing
+                          (save)
+                          (reset! selected-task nil)))))
     (when (empty? (:name task))
       (edit))
     (reagent/create-class


include path in NaN line exceptions

include path in NaN line exceptions

--- src/io/cyanite/input/carbon.clj
+++ src/io/cyanite/input/carbon.clj
@@ -19,7 +19,7 @@
       (throw (ex-info "invalid carbon line: missing fields" {:line line}))

       (re-find #"(?i)nan" metric)
-      (throw (ex-info "invalid carbon line: NaN metric" {:line line})))
+      (throw (ex-info (str "invalid carbon line: NaN metric for path:" path) {:line line})))
     (let [metric (try (Double. metric)
                       (catch NumberFormatException e
                         (throw (ex-info "invalid metric" {:metric metric}))))