did some edits of my own on quick tour

did some edits of my own on quick tour

--- src/tutorial/untangled_tutorial/A_Quick_Tour.cljs
+++ src/tutorial/untangled_tutorial/A_Quick_Tour.cljs
@@ -160,11 +160,11 @@
   - The render refresh story is mostly automatic, and where it isn't, it
   is completely abstracted from the UI structure to ease developer reasoning.

-  If you're coming from Om Next, realize that Untangled is *not* a competing project. Untangled is a set of
+  If you're coming from Om Next, you should know that Untangled is *not* a competing project. Untangled is a set of
   thin libraries that
-  provide default implementations of all of the artifacts you'd normally have to write to make an Om Next application. In
-  many cases Untangled is required to 'make a call' about how to do something. When it does, our documentation tries to
-  discuss the relative merits and costs.
+  provide default implementations of all of the artifacts you'd normally have to write to make a full-stack
+   Om Next application. In many cases Untangled is required to 'make a call' about how to do something.
+   When it does, our documentation tries to discuss the relative merits and costs.

   The name 'Untangled' is *not* meant to be a commentary on Om Next, but instead on the general state of web
   development circa 2016. Om Next and Untangled are two layers of a solution that makes things
@@ -172,8 +172,8 @@

   ## Om Next Components can use Stock React components

-  The first major strength is that Om Next integrates with stock React components. So, if you already
-  understand React you already have a head start. If you know nothing of React, you should eventually
+  The first major strength is that Om Next (and therefore Untangled) integrates with stock React components. So, if you already
+  understand React then you already have a head start. If you know nothing of React, you should eventually
   read more about it. For now, we'll cover everything you need to know.

   ## The Rendering Model
@@ -200,10 +200,10 @@
   this database, and can be queried to create arbitrary UI trees for display.

   A given item in this database can be shown in as many places on the UI as makes sense. The fact that the database
-  is *normalized* means that changing the item once in the database will result in all displayed versions being
-  refreshed easily.
-
-  The model manipulation thus maintains the desired local reasoning model (to entries in database tables). You write
+  is *normalized* means that changing the item once in the database will result in being able to refresh all displayed versions
+  easily.
+
+  The model manipulation thus maintains the desired local reasoning model (of entries in database tables). You write
   functions that know how to manipulate specific 'kinds' of things in the database, and think nothing of the UI.

   For example, say we have a counter that we'd like to represent with this data structure:
@@ -218,9 +218,9 @@
   (dc/mkdn-pprint-source increment-counter)
   "

-  and think about that counter as a complete abstract thing (and write clojure specs for it, etc.).
-
-  The Untangled database table for counters looks something like this:
+  and think about that counter as a complete abstract thing (and write tests and clojure specs for it, etc.).
+
+  The Untangled database table for counters then looks something like this:

   ```
   { :counter/by-id { 1 { :counter/id 1 :counter/n 1 }
@@ -228,37 +228,37 @@
                      ...}}
   ```

-  A table is just an entry in the database that, by convention, includes a namespace and name to indicate the kind of
-  thing in the table and how it is indexed. The value of the table is just a map whose keys are the IDs, and values
-  are the entries.
+  A table is just an entry in the database (map) that, by convention, is keyed with a keyword whose  namespace indicates
+  the kind of thing in the table, and whose name indicates how it is indexed. The k-v pairs in the table are the keys
+  (of the implied index) and the values of the actual data.

   The general app state is held in a top-level atom. So, updating any object in the database generally takes the
   form:

   ```
-  (swap! state update-in [:table/key id] operation)
+  (swap! app-state-atom update-in [:table/key id] operation)
   ```

   or in our example case:

   ```
-  (swap! state update-in [:counter/by-id 1] increment-counter)
-  ```
-
-  NOTE: You still need to know *where* to put this code.
+  (swap! app-state-atom update-in [:counter/by-id 1] increment-counter)
+  ```
+
+  NOTE: You still need to know *where* to put this code, and how to find/access the `app-state-atom`.

   ## Mutations as Abstract Transactions

   In Untangled, you don't do model twiddling on the UI. There is a clear separation of concerns for several good
   reasons:

-  - It generally pays not to mix your low-level logic with UI.
+  - It generally pays not to mix your low-level logic with the UI.
   - The concept of an abstract mutation can isolate the UI from networking, server interactions, and async thinking.
   - Abstract mutations give nice auditing and comprehension on both client and server.

-  The main UI entry point to affecting a change is the `om/transact!` function. This function lets you submit
-  an abstract sequence of modifications that you'd like to make, and isolates the UI author from the details of
-  implementing that model/remote behavior.
+  The main UI entry point for affecting a change is the `om/transact!` function. This function lets you submit
+  an abstract sequence of operations that you'd like to accomplish, and isolates the UI author from the details of
+  implementing that behavior (and of even having to know things like 'will that happen locally or on the server?').

   The concrete artifacts you'll see in Untangled code are the invocation of the `transact!`, and the implementation
   of the operations listed in the transaction:
@@ -267,9 +267,12 @@
   (om/transact! this `[(counter/increment {:id ~id})])
   ```

-  in the above transaction, we must use Clojure syntax quoting so that we can list an abstract muation (looks like
+  in the above transaction, we must use Clojure syntax quoting so that we can list an abstract muation (which looks like
   a function call, but is not) and parameters that themselves are derived from the environment (in this case
-  an id).
+  an id). If you're not a Clojure(script) programmer, we understand that the above expression looks a little scary. The
+  '`' means 'treat the following thing literally', and the '~' means 'don't treat this thing literally'. It's a way
+  of keeping the compiler from treating the increment as a function while still being able to embed `id` from the local
+  execution environment.

   The concrete implementation of the mutation on the model side looks like this:

@@ -281,14 +284,16 @@
   ```

   This looks a little hairy at first until you notice the primary guts are just what we talked about earlier in
-  the model manipulation: it's just an update-in.
+  the model manipulation: it's just an `update-in`.

   The wrapping is a pretty consistent pattern: the app state and parameters are passed into a multimethod, which is
   dispatched on the symbol mentioned in the `transact!`. The basics are:

-  - You key on a symbol instead of writing a function with that symbol name
+  - You key on a symbol instead of writing a function with that symbol name (this is what gives an abstraction that
+  is already 'network ready')
   - You return a map
-  - The `:action` key indicates a function to run as an optimistic update to the browser database
+  - The `:action` key of that map specifies a function to run to accomplish the optimistic update to the browser database. The
+  use of a thunk (function) here is what helps isolate asynchronous internals and networking from synchronous abstract reasoning.

   When you want to interact with a server, you need merely change it to:

@@ -305,11 +310,12 @@
   At first this seems like a bit of overkill on the boilerplate until you realize that there are a number of things
   being handled here:

-  - Local optimistic updates
-  - Automatically plumbed server interactions
-  - Use of the same symbol for the operation on the client and server
-  - Operations in the UI and on the server are identical in appearance
-  - Consistent implementation of model interactions on the client and server
+  - Sychronous *reasoning* about most aspects of the application.
+  - Local optimistic (immediate) updates (through `:action`)
+  - Automatically plumbed server interactions (triggered through `:remote` at transaction time)
+  - Use of the same abstract symbol for the operation on the client and server.
+  - Operations in the UI and on the server are identical in appearance.
+  - Consistent implementation pattern for model manipulations on the client and server.
   - The operations 'on the wire' read like abstract function calls, and lead to easy auditing and reasoning, or
   even easy-to-implement CQRS architectures.

@@ -334,19 +340,20 @@
   could have labels, owners, purposes, etc.
   - Ident : Represents the table/ID of the database data for the component. This is a function that, given an example
   of a counter, will return a vector that has two elements: the table and the ID of the entry. This is used
-  to assist in auto-normalization of the browser database.
+  to assist in auto-normalization of the browser database, and also with UI refreshes of components that display the
+  same data.
   - Object/render : This is the (pure) function that outputs what a Counter should look like on the DOM

   The incoming data from the database comes in via `om/props`, and things like callbacks come in via a mechanism known
   as the 'computed' data (e.g. stuff that isn't in the database, but is generated by the UI, such as callbacks).

-  A `defui` generates a React Component. In order to render an instance of a Counter, we must make an element
+  A `defui` generates a React Component (class). In order to render an instance of a Counter, we must make an element
   factory:
   "
   (dc/mkdn-pprint-source ui-counter)
   "
   If more than one of something can appear in the UI as siblings, you must specify a `:keyfn` that helps React
-  distinguish the DOM elements. You can ignore that for now.
+  distinguish the DOM elements.

   The most important point is that you can reason about `Counter` in a totally local way.

@@ -354,35 +361,38 @@

   Lets assume we want to display some arbitrary number of counters together in a panel. We can encode that (and the
   element factory) as:
+
   "
   (dc/mkdn-pprint-source CounterPanel)
   (dc/mkdn-pprint-source ui-counter-panel)
   "
+
   Note the mirroring again between the initial state and the query. The initial state provides an initial model
-  of what should be in the database, and the query indicates which bits of that state are required for the
-  current component.
+  of what should be in the database *for the component at hand*, and the query indicates which bits of that state are
+  required for that same local component.

   In this case the query contains a map, which is the query syntax for a JOIN. You can read this query as
   'Query for :counters, which is a JOIN on Counter'. Note that since initial state is setting up a vector
   of counters, the implied result will be a to-many JOIN. The cardinality of JOINS is derived from the structure
   of the actual database, NOT the query.

-  Again, the Ident just says where the state for these goes in the database (the table and ID).
-
-  The render is very similar to Counter. Assume the queried data will appear in props, pull it out, and
+  The join is necessary because this component will be rendering Counter components. The panel should not need to
+  know anything concrete about the implementation of Counter: only that it has a query, initial state, and a way
+  to render.
+
+  The render is very similar to Counter's. The queried data will appear in props: pull it out, and
   then render it. Note the use of `ui-counter`, which is the DOM element factory for `Counter`.

-  Finally, the callback is interesting. The counter has the 'Increment' button, but we've connected that from the
+  Finally, we include a callback. The counter has the 'Increment' button, but we've connected that from the
   counter UI back through to an implementation of a callback via 'computed' properties. This is a common pattern. In
-  this simple example the callback structure was added to demonstrate what it looks like, not because we actually
-  needed it (the `transact!` could have been placed in Counter).
+  this simple example the callback structure was added to demonstrate what it looks like. One could argue that the
+  counter could update itself (while maintaining local reasoning).

   The implementation of the `counter/inc` mutation was shown earlier.

   There are many important points to make here, but we would like to stress the fact that the UI has no idea
-  how counters are implemented, if that logic includes server interactions, etc. There is no callback madness
-  around processing the results. There is no XhrIO mixed into the UI, nor a controller you have to write to
-  accomplish anything.
+  *how* counters are implemented, *if* that logic includes server interactions, etc. There are no nested callbacks
+  of callbacks, no XhrIO mixed into the UI, and interestingly: no need for controller at all!

   A simple pattern of updating an abstraction in a database is all you need.

@@ -405,14 +415,14 @@
   - We compose in another component we've yet to discuss (which sums all counters). We'll talk more about that shortly

   There should be no surprises here. It is the same pattern all over again, except Root does not need an `Ident`, since
-  it need not live in a database table. The data for root can just be a standalone map entry (as can other things...there
-  is no rule that absolutely everything lives in tables. Top-level entries for other data structures are also useful).
+  it need not live in a database table. The data for root can just be a standalone map entry (as can other things. There
+  is *no rule that absolutely everything* lives in tables. Top-level entries for other data structures are also useful).

   ### Starting up the App

-  Normally you create an Untangled application and mount it on a DIV in your real HTML DOM. Since we're in devcards
-  we have a helper to do that, and it accepts the same basic parameters as `make-untangled-app`, but mounts it on a
-  devcard:
+  Normally you create an Untangled application and mount it on a DIV in your real HTML DOM. We'll cover that later in the
+  Guide. Here we're in devcards and we have a helper to do that. It accepts the same basic parameters as
+  `make-untangled-app`, but mounts the resulting application in a devcard:

   ```
   (defcard SampleApp
@@ -443,7 +453,7 @@

   You'll need to understand a bit more about the structure of the database to completely understand this code, but you
   see it is really quite simple: pull `:all-counters` from the database, and put them on the panel according to the
-  (known via Ident) location of the panel data in the database.
+  location (known via Ident) of the panel data in the database.

   ### Server Implementation


Add meta tag

Add meta tag

--- mern_utils/src/mern_utils/view.cljs
+++ mern_utils/src/mern_utils/view.cljs
@@ -23,9 +23,13 @@
 (defn render-script [src]
   (str "<script>" src "</script>\n"))

+(defn list-meta [meta-data]
+  (map #(vector :meta {:property (:property %) :content (:content %)}) meta-data))
+
 (defsnippet page "public/template.html" [:html]
   [data & {:keys [scripts]}]
   {[:head :> :title] (content (:title data))
+   [:head] (append (list-meta (:meta-data data)))
    [:body :> :content] (content (:content data))
    [:body] (append [:div (for [src scripts]
                            ^{:key (gstring/hashCode (pr-str src))}


Une solution à l'exercice "Robot Name" de Exercism dans la track Clojure

--- exercism/clojure/robot-name/src/robot_name.clj
+++ exercism/clojure/robot-name/src/robot_name.clj
@@ -1,13 +1,32 @@
-(ns robot-name)
+(ns robot-name
+  (:require [clojure.string :as str]))

-(defn robot [] ;; <- arglist goes here
-  ;; your code goes here
-)
+(def existing-robot-names (atom #{}))

-(defn robot-name [robot] ;; <- arglist goes here
-      ;; your code goes here
-)
+(defrecord Robot [name])

-(defn reset-name [robot] ;; <- arglist goes here
-  ;; your code goes here
-)
+(defn generate-random-string [size alphabet]
+  (str/join (repeatedly size #(rand-nth (shuffle (random-sample 0.5  alphabet))))))
+
+(defn generate-random-int-as-string [size int-max]
+  (str/join (repeatedly size #(str (rand-int int-max)))))
+
+(defn generate-random-robot-name [prefix-size suffix-size]
+  (str
+   (generate-random-string prefix-size "ABCDEFGHIJKLMNOPKRSTUVWXYZ")
+   (generate-random-int-as-string suffix-size 10)))
+
+(defn generate-robot-name []
+  (loop [robot-name (generate-random-robot-name 2 3)]
+    (if (contains? (deref existing-robot-names) robot-name)
+      (recur (generate-random-robot-name 2 3))
+      (do (swap! existing-robot-names conj robot-name) robot-name))))
+
+(defn robot []
+  (Robot.  (atom (generate-robot-name))))
+
+(defn robot-name [robot]
+  (deref (:name robot)))
+
+(defn reset-name [robot]
+  (reset! (:name robot) (generate-robot-name)))


Don't use assoc-in/update-in where assoc/update will do

--- src/asciinema/player/vt.cljc
+++ src/asciinema/player/vt.cljc
@@ -251,7 +251,7 @@
              :next-print-wraps false
              :origin-mode origin-mode
              :auto-wrap-mode auto-wrap-mode)
-      (update-in [:cursor] merge cursor)))
+      (update :cursor merge cursor)))

 (defn set-mode [vt intermediate param]
   (match [intermediate param]
@@ -320,7 +320,7 @@

 (defn execute-hts [{{:keys [x]} :cursor :keys [width] :as vt}]
   (if (< 0 x width)
-    (update-in vt [:tabs] conj x)
+    (update vt :tabs conj x)
     vt))

 (defn execute-ri [{:keys [top-margin] {y :y} :cursor :as vt}]
@@ -530,9 +530,9 @@
 (defn execute-ctc [{{:keys [x]} :cursor :keys [width] :as vt}]
   (let [n (get-param vt 0 0)]
     (condp = n
-      0 (if (< 0 x width) (update-in vt [:tabs] conj x) vt)
-      2 (update-in vt [:tabs] disj x)
-      5 (update-in vt [:tabs] empty)
+      0 (if (< 0 x width) (update vt :tabs conj x) vt)
+      2 (update vt :tabs disj x)
+      5 (update vt :tabs empty)
       vt)))

 (defn execute-ech [{{:keys [x y]} :cursor :keys [width char-attrs] :as vt}]
@@ -550,8 +550,8 @@
 (defn execute-tbc [{{:keys [x]} :cursor :as vt}]
   (let [n (get-param vt 0 0)]
     (condp = n
-      0 (update-in vt [:tabs] disj x)
-      3 (update-in vt [:tabs] empty)
+      0 (update vt :tabs disj x)
+      3 (update vt :tabs empty)
       vt)))

 (defn execute-sm [vt]
@@ -563,13 +563,13 @@
     (reduce #(reset-mode %1 intermediate %2) vt (get-params vt))))

 (defn reset-attrs [vt]
-  (update-in vt [:char-attrs] empty))
+  (update vt :char-attrs empty))

 (defn set-attr [vt attr-name value]
   (assoc-in vt [:char-attrs attr-name] value))

 (defn unset-attr [vt attr-name]
-  (update-in vt [:char-attrs] dissoc attr-name))
+  (update vt :char-attrs dissoc attr-name))

 (defn execute-sgr [vt]
   (let [params (or (seq (get-params vt)) [0])]
@@ -648,7 +648,7 @@
   vt)

 (defn replace-char [line x cell]
-  (assoc-in line [x] cell))
+  (assoc line x cell))

 (defn insert-char [line x cell]
   (vec (concat
@@ -702,7 +702,7 @@
     vt))

 (defn clear [vt input]
-  (update-in vt [:parser] merge {:intermediate-chars [] :param-chars []}))
+  (update vt :parser merge {:intermediate-chars [] :param-chars []}))

 (defn collect [vt input]
   (update-in vt [:parser :intermediate-chars] conj input))


improve startup

improve startup

--- src/ceres_collector/core.clj
+++ src/ceres_collector/core.clj
@@ -46,11 +46,19 @@
   (timbre/set-config! [:shared-appender-config :spit-filename] (:logfile @server-state))
   (info "Starting twitter collector...")
   (when (:init? @server-state) (init-mongo))
-  (info @server-state)
   (let [{{:keys [follow track credentials]} :app} @server-state]
-    (start-filter-stream follow track pipeline/start credentials))
+    (start-filter-stream
+     follow
+     track
+     #_(fn [status]
+       (do
+         (debug "STATUS - " (str "@" (get-in status [:user :screen_name])) ":"  (:text status))
+         (pipeline/start status)))
+     pipeline/start
+     credentials))
   (when (:backup? @server-state)
     (start-scheduler (:backup-folder @server-state))))
+

 (comment


same structure for mobile and not mobile

--- src/clj/just_married/css.clj
+++ src/clj/just_married/css.clj
@@ -28,14 +28,9 @@

 (def ^:private common-grid-options
   {:display "grid"
-   :grid-gap "5px"})
-
-(def ^:private grid-config
-  {:desktop (merge common-grid-options {:grid-template-columns "550px auto"
-                                        :grid-template-rows "auto auto auto auto auto"})
-
-   :mobile (merge common-grid-options {:grid-template-columns "auto"
-                                       :grid-template-rows "auto auto auto auto auto auto"})})
+   :grid-gap "5px"
+   :grid-template-columns "auto"
+   :grid-template-rows "auto auto auto auto auto"})

 (def ^:private navbar-grid-config
   {:desktop {:background-color (:dark-red COLOR-PALLETTE)
@@ -80,7 +75,7 @@
    [:a:hover {:text-decoration "none"}]])

 (def main-page
-  [[:.container (:desktop grid-config)]
+  [[:.container common-grid-options]
    [:h3 {:color (:dark-red COLOR-PALLETTE)}]
    [:body {:color (:navy COLOR-PALLETTE)
            :font-family (:alex-brush FONT-FAMILIES)}]
@@ -95,26 +90,12 @@

    [:.button__add-to-calendar {:background-color (:dark-red COLOR-PALLETTE)
                                :color (:white COLOR-PALLETTE)}]
-   [:.find-us {:grid-column 1
-               :grid-row 2}]
-
-   [:.timeline {:grid-column 2
-                :grid-row 2}]

    [:.timeline__time {:padding-right "10px"
                       :font-weight "bolder"}]

    [:.timeline__icon {:width "22px"
                       :padding-right "5px"}]
-
-   #_[:.rvsp {:grid-column 1
-              :grid-row 3}]
-
-   [:.accommodation {:grid-column 1
-                     :grid-row 4}]
-
-   [:.gift {:grid-column 1
-            :grid-row 5}]

    [:.bank_table {:font-family (:open-sans FONT-FAMILIES)}]

@@ -173,7 +154,8 @@
    [:app {:background-color (:marsala COLOR-PALLETTE)}]
    ;; maybe the image containing the rest should actually be an element
    ;; by itself?
-   [:.countdown__internal {:text-align "center"}]
+   [:.countdown__internal {:text-align "center"
+                           :width "500px"}]

    ;; countdown settings
    [:.timer {;:background-color (:marsala COLOR-PALLETTE)
@@ -239,7 +221,7 @@
                :max-device-width max-width-mobile}

               [:.navbar__container (:mobile navbar-grid-config)]
-              [:.container (:mobile grid-config)]
+              [:.container common-grid-options]
               ;; should I simply change the layout
               ;; entirely moving with everything on the same column??
               [:.timeline {:grid-column 1


select current value in select-field

select current value in select-field

--- src/clj_money/web/shared.clj
+++ src/clj_money/web/shared.clj
@@ -198,4 +198,10 @@
   [:div.form-group
    [:label {:for attribute} (humanize attribute)]
    [:select.form-control {:id attribute :name attribute}
-    (map #(vector :option {:value (:value %)} (:caption %)) options)]])
+    (map #(vector :option {:value (:value %)
+                           :selected (if (= (attribute model)
+                                            (:value %))
+                                       true
+                                       nil)}
+                  (:caption %))
+         options)]])


Fix bug in perform-genetic-operators

Fix bug in perform-genetic-operators

Because the assoc was only being performed when the child wasn't
oversized, and because revert-too-big-child doesn't always set the
:genetic-operator, it was previously possible to produce children with
no :genetic-operator.

--- src/clojush/pushgp/breed.clj
+++ src/clojush/pushgp/breed.clj
@@ -107,12 +107,11 @@
         child (perform-genetic-operator-list operator-vector
                                              (assoc first-parent :parent-uuids (vector (:uuid first-parent)))
                                              population location rand-gen argmap)]
-    (if (> (count (:genome child))
-           (/ max-points 4)) ; Check if too big
-      (revert-too-big-child first-parent child argmap)
-        (assoc child
-               :genetic-operators operator
-               ))))
+    (conditional-thread
+     (assoc child :genetic-operators operator)
+     #(when (> (count (:genome %))
+                (/ max-points 4))
+      (revert-too-big-child first-parent % argmap)))

 (defn breed
   "Returns an individual bred from the given population using the given parameters."


Move position of app-state tab

Move position of app-state tab

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -394,15 +394,16 @@
                                           [:div.nav
                                             [:button {:class (str "tab button " (when (= @selected-tab :traces) "active"))
                                                       :on-click #(reset! selected-tab :traces)} "Traces"]
+                                            [:button {:class (str "tab button " (when (= @selected-tab :app-state) "active"))
+                                                      :on-click #(reset! selected-tab :app-state)} "app-state"]
                                             [:button {:class (str "tab button " (when (= @selected-tab :subvis) "active"))
-                                                      :on-click #(reset! selected-tab :subvis)} "SubVis"]
-                                            [:button {:class (str "tab button " (when (= @selected-tab :app-state) "active"))
-                                                      :on-click #(reset! selected-tab :app-state)} "app-state"]]]
+                                                      :on-click #(reset! selected-tab :subvis)} "SubVis"]]]
                                         (case @selected-tab
                                           :traces [render-trace-panel]
+                                          :app-state [app-state/render-state db/app-db]
                                           :subvis [subvis/render-subvis traces
-                                                    [:div.panel-content-scrollable]]
-                                          :app-state [app-state/render-state db/app-db])]]]))})))
+                                                    [:div.panel-content-scrollable]])]]]))})))
+
 (defn panel-div []
   (let [id    "--re-frame-trace--"
         panel (.getElementById js/document id)]


Refactor render-traces

Refactor render-traces

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -279,9 +279,9 @@
                                       [:button {:class (str "tab " (when (= @selected-tab :subvis) "active"))
                                                 :on-click #(reset! selected-tab :subvis)} "SubVis"]
                                       (case @selected-tab
-                                        :traces [render-traces]
+                                        :traces [render-trace-panel]
                                         :subvis [subvis/render-subvis traces]
-                                        [render-traces])]]]))})))
+                                        [render-trace-panel])]]]))})))

 (defn panel-div []
   (let [id    "--re-frame-trace--"


Detect re-frame-trace views via 'devtools outer'

This is more reliable than looking for the namespace, as reagent does not attempt to keep namespace information when compiled with Closure, whereas "devtools outer" is hard-coded as the :display-name for the panel's container and survives compilation/optimization.

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -120,7 +120,7 @@
   (let [rendering? (= (:op-type trace) :render)]
     (if-not rendering?
       true
-      (not (str/includes? (get-in trace [:tags :component-path] "") "day8.re_frame.trace")))
+      (not (str/includes? (get-in trace [:tags :component-path] "") "devtools outer")))

     #_(if-let [comp-p (get-in trace [:tags :component-path])]


Fixes and updates for temporal code and tests.

--- dev-resources/src/cmr/opendap/dev.clj
+++ dev-resources/src/cmr/opendap/dev.clj
@@ -15,6 +15,7 @@
     [cmr.opendap.components.core]
     [com.stuartsierra.component :as component]
     [org.httpkit.client :as httpc]
+    [ring.util.codec :as codec]
     [trifl.java :refer [show-methods]]
     [xml-in.core :as xml-in])
   (:import


:jetty wants a number for the port

:jetty wants a number for the port

--- src/ephemeris_api/config.clj
+++ src/ephemeris_api/config.clj
@@ -15,4 +15,5 @@
     (configurable [:type]
                   (keyword (env :ephemeris-api-type)))
     (configurable [:http :host] (env :ephemeris-api-host))
-    (configurable [:http :port] (env :ephemeris-api-port))))
+    (configurable [:http :port]
+                  (Integer. (env :ephemeris-api-port)))))


Fix scheduling to be periodic

Fix scheduling to be periodic

--- src/gamlor/rochla/winbox.clj
+++ src/gamlor/rochla/winbox.clj
@@ -88,7 +88,16 @@
         app (create-app config aws)
         ]
     (log/info "Start with config " config)
-    (.schedule scheduler ^Runnable (fn [] (p/terminate-old-boxes app)) 10 TimeUnit/MINUTES)
+    (.scheduleAtFixedRate
+      scheduler ^Runnable
+    (fn []
+      (log/info "Maintenance Loop started")
+      (p/terminate-old-boxes app)
+      (log/info "Old boxes terminated")
+      (p/reserve-machine app)
+      (log/info "Allocated new machines if needed")
+      )
+      5 5 TimeUnit/MINUTES)
     (p/reserve-machine app)
     (start-app-server app))
   )


move option handling to generate

move option handling to generate

--- src/github_changelog/cli.clj
+++ src/github_changelog/cli.clj
@@ -31,8 +31,9 @@
 (defn- read-config [file]
   (edn/read-string (slurp file)))

-(defn- generate [file last since]
-  (let [all-tags (changelog (read-config file))
+(defn- generate [file options]
+  (let [{:keys [last since]} options
+        all-tags (changelog (read-config file))
         filtered-tags (if since (filter #(newer? (:version %) since) all-tags) all-tags)
         tags (if last (take last filtered-tags) filtered-tags)]
     (format-tags tags)))
@@ -45,13 +46,13 @@

 (defn -main [& args]
   (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)
-        {:keys [help last since]}                  options]
+        {:keys [help]}                             options]
     (cond
       help               (exit 0 (usage summary))
       (empty? arguments) (exit 1 (usage summary))
       errors             (exit 1 (error-msg errors)))

     (doseq [config-file arguments]
-      (println (generate config-file last since)))
+      (println (generate config-file options)))

     (exit 0 nil)))


Fixed FressianReader reading of floats / doubles

--- src/longshi/fressian/js.cljs
+++ src/longshi/fressian/js.cljs
@@ -214,9 +214,16 @@
 (extend-type bs/ByteInputStream
   p/FressianReader
   (read-float! [bis]
-    (bsp/read-float! bis))
+    (let [code (bsp/read! bis)]
+      (case code
+        ((.-FLOAT codes)) (bsp/read-float! bis)
+      (throw (js/Error. (str "Expected float got (" code ")"))))))
   (read-double! [bis]
-    (bsp/read-double! bis))
+    (let [code (bsp/read! bis)]
+      (case code
+        ((.-DOUBLE_0 codes)) 0.0
+        ((.-DOUBLE_1 codes)) 1.0
+        ((.-DOUBLE codes)) (bsp/read-double! bis))))
   (read-int! [bis]
     (let [code (bsp/read! bis)]
       (case code


Add an intervening layer between virtual folder and particular handler for a "domain"

--- src/main/clojure/cascade.clj
+++ src/main/clojure/cascade.clj
@@ -140,6 +140,20 @@
   [path]
   (generic-asset-handler (file-asset path)))

+(defn asset-dispatch-handler
+  "Internal dispatcher for asset requests. Returns the response from the handler, or nil if
+no handler matches the name.
+dispatch
+    Maps keywords for the asset domain (eg., :file) to the handler
+name
+    Keyword used to locate handler
+path
+    String path passed to the handler.
+  "
+  [dispatch name path]
+  (let [handler (dispatch name)]
+    (and handler (handler path))))
+
 (defn initialize-assets
   "Initializes asset handling for Cascade. This sets an application version (a value incorporated into URLs, which
 should change with each new deployment. Named arguments:
@@ -152,7 +166,8 @@
   [application-version & {:keys [virtual-folder public-folder file-extensions]
                           :or {virtual-folder "assets"
                                public-folder "public"}}]
-  (let [root (str "/" virtual-folder "/" application-version)]
+  (let [root (str "/" virtual-folder "/" application-version)
+        dispatch {:file file-handler}]
     (reset! asset-configuration
       {:application-version application-version
        :expiration (now-plus-ten-years)
@@ -162,8 +177,8 @@
        :file-extensions (merge mime-type/default-mime-types file-extensions)})
     (printf "Initialized asset access at virtual folder %s\n" root)
     (wrap-exception-handling
-      (GET [(str root "/file/:path") :path #".*"]
-        [path] (file-handler path)))))
+      (GET [(str root "/:domain/:path") :path #".*"]
+        [domain path] (asset-dispatch-handler dispatch (keyword domain) path)))))

 (defn wrap-html
   "Ring middleware that wraps a handler so that the return value from the handler (a seq of DOM nodes)


Consider cost when option values are equal

--- src/obb_rules/ai/common.cljc
+++ src/obb_rules/ai/common.cljc
@@ -30,7 +30,7 @@
 (defn eval-board
   "Evaluates a board for a given player"
   [board player]
-  (let [scores (evaluator/eval-game board)]
+ (let [scores (evaluator/eval-game board)]
     (eval-scores player scores)))

 (defn- build-target
@@ -183,7 +183,8 @@
   "Sorts a collection of options based on the value"
   [option]
   (if option
-    (- (option :value))
+    (let [cost-factor (/ (- laws/max-action-points (:cost option)) 10)]
+      (- (+ (option :value) cost-factor)))
     0))

 (defn option-value-cost-sorter


lein-release plugin: preparing 0.1.14 release

--- re_db/project.clj
+++ re_db/project.clj
@@ -1,4 +1,4 @@
-(defproject re-db "0.1.13"
+(defproject re-db "0.1.14"
   :description "in-memory javascript key-value store inspired by Datomic and DataScript"
   :url "https://www.github.com/braintripping/re-view/tree/master/re_db"
   :license {:name "Eclipse Public License"


Unified style

Unified style

--- src/rpi_challenger/views.clj
+++ src/rpi_challenger/views.clj
@@ -123,5 +123,5 @@

 (defn overall-scores-page
   []
-  (layout {:title "Overall scores"
+  (layout {:title "Overall Scores"
            :main (overall-scores)}))


Fix bug w/ minimum value on slider going to zero for non-freemium plans

--- frontend/components/org_settings.cljs
+++ frontend/components/org_settings.cljs
@@ -401,7 +401,7 @@
                 [:div.container-picker
                  [:p "More containers means faster builds and lower queue times."]
                  [:div.container-slider
-                  (let [min (+ (pm/freemium-containers plan) (pm/paid-plan-min-containers plan))
+                  (let [min (max 1 (+ (pm/freemium-containers plan) (pm/paid-plan-min-containers plan)))
                         max (if (< selected-containers 80)
                               80
                               (let [num (+ 80 selected-containers)]


made domain more orthogonal

made domain more orthogonal

--- main/src/dda/pallet/dda_managed_ide/domain.clj
+++ main/src/dda/pallet/dda_managed_ide/domain.clj
@@ -18,6 +18,7 @@
   (:require
     [schema.core :as s]
     [dda.pallet.commons.secret :as secret]
+    [dda.config.commons.map-utils :as mu]
     [dda.pallet.dda-managed-vm.domain :as vm-domain]
     [dda.pallet.dda-managed-ide.domain.git :as git]
     [dda.pallet.dda-managed-ide.domain.atom :as atom]
@@ -32,11 +33,11 @@

 (def DdaIdeDomainConfig
   (merge
-    vm-domain/DdaVmUser
-    vm-domain/DdaVmBookmarks
-    {:vm-type (s/enum :remote :desktop :desktop-novbox)
-     :dev-platform (s/enum :clojure-atom :clojure-nightlight)
-     (s/optional-key :lein-auth) [RepoAuth]}))
+    vm-domain/DdaVmDomainConfig
+    {:dev-platform (hash-set (s/enum :clojure :devops))
+     :ide-platform (hash-set (s/enum :atom))
+     :user {:project-set (hash-set (s/enum :dda-pallet))
+            (s/optional-key :lein-auth) [RepoAuth]}}))

 (def RepoAuthResolved
   (secret/create-resolved-schema RepoAuth))


Updated yed url

Updated yed url

--- main/src/dda/pallet/dda_managed_ide/domain.clj
+++ main/src/dda/pallet/dda_managed_ide/domain.clj
@@ -107,7 +107,7 @@
                        :install-pgtools}
        :basics {:argo-uml {:version "0.34"}
                 :yed {:download-url
-                      "https://www.yworks.com/resources/yed/demo/yEd-3.19.1.1.zip"}}
+                      "https://www.yworks.com/resources/yed/demo/yEd-3.20.zip"}}
        :db {:dbvis {:version "10.0.25"}}}
       (when (contains? ide-platform :atom)
         {:atom (atom/atom-config vm-type contains-clojure? contains-devops?)})


Fix calc-size

Fix calc-size

--- src/whisper2cyanite/core.clj
+++ src/whisper2cyanite/core.clj
@@ -161,7 +161,7 @@
         points)
       (process-path [this path file])
       (fetch-data? [this]
-        false))))
+        true))))

 (defn- process-archive
   "Process an archive."


First delegate, create-wishlist-clicker

First delegate, create-wishlist-clicker

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -69,3 +69,8 @@
   (letrem [neu (update-wishlist wishlist)]
     (show-wishlist! neu)))

+; DELEGATES
+
+(defn create-wishlist-clicker []
+  (delegate $body "#create-wishlist" :click
+    create-wishlist-rem))


[exceptions] report dims mismatch when model and weights don't match

--- keras/src/think/cortex/keras/core.clj
+++ keras/src/think/cortex/keras/core.clj
@@ -336,6 +336,12 @@
                                              ;;We want: n-filters n-channels height width
                                              (do
                                                (println "Reshaping weights for" (:id desc))
+                                               (when-not (= (apply * (:dimensions weight-clj))
+                                                            (apply * keras-dims))
+                                                 (throw (ex-info "Dimensions for weights and model are not compatible!"
+                                                          {:cause       :wrong-dims
+                                                           :cortex-dims weight-clj
+                                                           :keras-dims  keras-dims})))
                                                (if (= 4 (count keras-dims))
                                                  (reshape-data weight-raw-data keras-dims [3 2 0 1])
                                                  ;;Simple transpose for linear layers as keras stores data in column major format.


This stopped the compilation.  Importer is still broken.

--- keras/src/think/cortex/keras/core.clj
+++ keras/src/think/cortex/keras/core.clj
@@ -365,7 +365,6 @@
                            (println "loading weights/bias for" (:id desc))
                            (let [weight-clj (hdf5/->clj weight-ds)
                                  weight-raw-data (:data weight-clj)
-                                 weight-shape (get-weight-shape desc weight-raw-data)
                                  weight-double-data (ensure-doubles weight-raw-data)]
                              (assoc desc
                                     :weights weight-double-data


systems-toolbox v0.3.10

systems-toolbox v0.3.10

--- Clojure-Websockets/MainApp/project.clj
+++ Clojure-Websockets/MainApp/project.clj
@@ -10,7 +10,7 @@
                  [com.taoensso/timbre "4.1.4"]
                  [com.taoensso/encore "2.20.0"]
                  [com.taoensso/carmine "2.12.0"]
-                 [matthiasn/systems-toolbox "0.3.8"]
+                 [matthiasn/systems-toolbox "0.3.10"]
                  [org.clojure/tools.namespace "0.2.11"]
                  [ch.qos.logback/logback-classic "1.1.3"]
                  [hiccup "1.0.5"]
@@ -34,8 +34,8 @@

   :plugins [[lein-cljsbuild "1.1.0"]
             [lein-figwheel "0.4.1" :exclusions [org.clojure/clojure org.codehaus.plexus/plexus-utils]]
-            [quickie "0.3.6" :exclusions [org.clojure/clojure org.codehaus.plexus/plexus-utils]]
-            [codox "0.8.13"]]
+            [quickie "0.4.1" :exclusions [org.clojure/clojure org.codehaus.plexus/plexus-utils]]
+            [codox "0.9.0"]]

   :figwheel {:server-port 3452
              :css-dirs    ["resources/public/css"]}


Removed more unused code

Removed more unused code

--- modules/menu/src/modular/menu.clj
+++ modules/menu/src/modular/menu.clj
@@ -6,7 +6,6 @@
    [modular.template :refer (TemplateModel)]
    [bidi.bidi :refer (path-for)]
    [hiccup.core :refer (html)]
-   ;;[cylon.core :refer (allowed-handler?)]
    [schema.core :as s]))

 (defprotocol MenuItems
@@ -20,7 +19,6 @@
          (filter (partial satisfies? MenuItems))
          (mapcat menu-items)
          (remove nil?)
-;;         (filter (partial show-menu-item? (:request context)))
          (sort-by :order)
          (group-by :parent)
          seq


hawk has been added as a development dependency to core

--- core/project.clj
+++ core/project.clj
@@ -35,6 +35,7 @@

   :profiles {:dev
              {:dependencies [[funcool/codeina            "0.5.0"]
+                             [hawk                       "0.2.11"]
                              [org.clojure/tools.nrepl    "0.2.13"]]}

              :uberjar


Save/load benchmark params.

Save/load benchmark params.

--- test/cavm/benchmark/core.clj
+++ test/cavm/benchmark/core.clj
@@ -14,10 +14,6 @@
   `(let [start# (. System (nanoTime))]
      ~expr
      (/ (double (- (. System (nanoTime)) start#)) 1000000.0)))
-
-(defn spy [msg x]
-  (println msg x)
-  x)

 (def dataset-map
   (into {} (map (fn [ds] [(:key ds) ds]) benchmark-data/datasets)))
@@ -134,9 +130,15 @@
   (doseq [{:keys [id result]} results]
     (println (report (:desc (test-map id)) result))) )

+(defn- mkdir [dir]
+  (.mkdirs (io/file dir))
+  (when (not (.exists (io/file dir)))
+    (str "Unable to create directory: " dir)))
+
 (def ^:private argspec
   [["-o" "--output FILE" "Output file" :default "bench.edn"]
    ["-h" "--help" "Show help"]
+   ["-l" "--load" "Load benchmark params from cache in ~/.benchmark"]
    ["-r" "--input FILE" "Read and print results from FILE"]
    ["-i" "--include TAG" "Run benchmarks with TAG (can be used multiple times)" :default [] :assoc-fn (fn [m k v] (update-in m [k] conj v))]])

@@ -158,9 +160,18 @@
         (:input options) (print-results (edn/read-string (slurp (:input options))))
         :else (let [xena (h2/create-xenadb dbfile)
                     results (atom [])]
+                (when-let [error (mkdir (io/file "." ".benchmark"))]
+                  (binding [*out* *err*]
+                    (println error)
+                    (System/exit 1)))
                 (doseq [{:keys [id desc params body]} (filter test-filter tests)]
-                  (let [params (params)
+                  (let [params (if (:load options)
+                                 (edn/read-string
+                                   (slurp (io/file "." ".benchmark" (name id))))
+                                 (params))
                         result (apply body xena params)]
+                    (when (not (:load options))
+                      (spit (io/file "." ".benchmark" (name id)) (pr-str params)))
                     (swap! results conj {:id id :result result})
                     (println (report desc result))))
                 (spit (:output options) (pr-str @results)))))


Cleanup.

Cleanup.

--- src/algebolic/expression/algebra.clj
+++ src/algebolic/expression/algebra.clj
@@ -36,32 +36,33 @@
       (recur op new-exp))))

 (defn- expand-expr
-  "Tries to expand an expression as much as possible, and transform it to a canonical form."
+  "Tries to expand an expression as much as possible, and transform it to a canonical form. Doesn't do very well
+  at the moment!"
+  ;; TODO: this doesn't really work at the moment.
   [expr]
   (match/match [expr]
-               ;; distribute plus and minus through times
-               [[:times a [:plus b c]]] [:plus [:times a b] [:times a c]]
-               [[:times [:plus a b] c]] [:plus [:times a c] [:times b c]]
-               [[:times a [:minus b c]]] [:minus [:times a b] [:times a c]]
-               [[:times [:minus a b] c]] [:minus [:times a c] [:times b c]]
-               ;; associative operations to the left
-               [[:plus a [:plus b c]]] [:plus [:plus a b] c]
-               [[:minus a [:minus b c]]] [:minus [:minus a b] c]
-               [[:times a [:times b c]]] [:times [:times a b] c]
-               ;; always move numbers to the left
-               [[:plus (a :guard not-number?) (b :guard number?)]] [:plus b a]
-               [[:minus (a :guard not-number?) (b :guard number?)]] [:minus b a]
-               [[:times (a :guard not-number?) (b :guard number?)]] [:times b a]
-               ;; reduce arithmetic operations on numbers
-               [[:plus (a :guard number?) (b :guard number?)]] (+ a b)
-               [[:minus (a :guard number?) (b :guard number?)]] (- a b)
-               [[:times (a :guard number?) (b :guard number?)]] (* a b)
-               ;; reduce trig operations on numbers
-               [[:cos (a :guard number?)]] (Math/cos a)
-               [[:sin (a :guard number?)]] (Math/sin a)
-               ;; leave everything else
-               [x] x
-               ))
+    ;; distribute plus and minus through times
+    [[:times a [:plus b c]]] [:plus [:times a b] [:times a c]]
+    [[:times [:plus a b] c]] [:plus [:times a c] [:times b c]]
+    [[:times a [:minus b c]]] [:minus [:times a b] [:times a c]]
+    [[:times [:minus a b] c]] [:minus [:times a c] [:times b c]]
+    ;; associative operations to the left
+    [[:plus a [:plus b c]]] [:plus [:plus a b] c]
+    [[:minus a [:minus b c]]] [:minus [:minus a b] c]
+    [[:times a [:times b c]]] [:times [:times a b] c]
+    ;; always move numbers to the left
+    [[:plus (a :guard not-number?) (b :guard number?)]] [:plus b a]
+    [[:minus (a :guard not-number?) (b :guard number?)]] [:minus b a]
+    [[:times (a :guard not-number?) (b :guard number?)]] [:times b a]
+    ;; reduce arithmetic operations on numbers
+    [[:plus (a :guard number?) (b :guard number?)]] (+ a b)
+    [[:minus (a :guard number?) (b :guard number?)]] (- a b)
+    [[:times (a :guard number?) (b :guard number?)]] (* a b)
+    ;; reduce trig operations on numbers
+    [[:cos (a :guard number?)]] (Math/cos a)
+    [[:sin (a :guard number?)]] (Math/sin a)
+    ;; leave everything else
+    [x] x))

 (defn expand-full
   "Tries to expand an expression as much as possible, and transform it to a canonical form."


open is the default

open is the default

--- src/caesium/magicnonce/secretbox.clj
+++ src/caesium/magicnonce/secretbox.clj
@@ -126,22 +126,30 @@
   ([msg key]
    (secretbox-nmr msg (random-nonce!) key)))

+(defn open-to-buf!
+  "Decrypts any secretbox message with a prefix nonce into the given buffer.
+
+  Analogous to [[caesium.crypto.secretbox/secretbox-open-easy-to-buf!]]."
+  [^bytes out ^bytes nonced-ctext ^bytes key]
+  (let [noncebuf (ByteBuffer/wrap nonced-ctext 0 s/noncebytes)
+        ctextlen (- (alength nonced-ctext) s/noncebytes)
+        ctextbuf (ByteBuffer/wrap nonced-ctext s/noncebytes ctextlen)]
+    (s/decrypt-to-byte-buf! out key noncebuf ctextbuf)))
+
+(defn open
+  "Decrypts any secretbox message with a prefix nonce.
+
+  Analogous to [[caesium.crypto.secretbox/secretbox-open-easy]]."
+  [^bytes nonced-ctext ^bytes key]
+  (let [out (byte-array (- (alength nonced-ctext) s/noncebytes s/macbytes))]
+    ))
+
 (defn decrypt-to-buf!
-  "Decrypts any secretbox message with a prefix nonce into the given buffer."
-  [out key nonced-ctext])
+  "Like [[open-to-buf!]], but with different argument order."
+  [out key nonced-ctext]
+  (open-to-buf! out nonced-ctext key))

 (defn decrypt
-  "Decrypts any secretbox message with a prefix nonce."
+  "Like [[open]], but with different argument order."
   [key nonced-ctext]
-
-(defn open-to-buf!
-  "Like [[decrypt-to-buf!]], but with different argument order;
-  analogous to [[caesium.crypto.secretbox/secretbox-open-easy-to-buf!]]."
-  [out nonced-ctext key]
-  (decrypt-to-buf! out key ctext))
-
-(defn open
-  "Like [[decrypt]], but with different argument order; analogous to
-  [[caesium.crypto.secretbox/secretbox-open-easy]]."
-  [nonced-ctext key]
-  (decrypt key ctext))
+  (open nonced-ctext key))


cleanup

cleanup

--- src/clj/ceres_analytics/measures.clj
+++ src/clj/ceres_analytics/measures.clj
@@ -97,32 +97,3 @@
       (let [sorted-cs (sort-by :ts sub-cs)]
         (reduce + #(t/in-seconds (t/interval (:ts %1) (:ts %2))))))
     (vals cs))))
-
-
-(comment
-
-  (-> (dynamic-expansion :assignments (t/date-time 2015 4) (t/date-time 2015 5))
-      vals
-      first
-      count)
-
-  (aprint (zipmap
-           (range 3 29)
-           (map
-            #(mc/count @db "messages" {:ts {$gt (t/date-time 2015 4 %)
-                                            $lt (t/date-time 2015 4 (inc %))}})
-            (range 3 29))))
-
-  (-> (dynamic-expansion :contacts (t/date-time 2015 4 3) (t/date-time 2015 4 29))
-      subset-size
-      aprint)
-
-  (-> (dynamic-expansion :unknown (t/date-time 2015 4 3) (t/date-time 2015 4 29))
-      lifetime
-      aprint)
-
-  (-> (dynamic-expansion :nodes (t/date-time 2015 4 3) (t/date-time 2015 4 29))
-      lifetime
-      aprint)
-
-  )


allow options in commodities/search

allow options in commodities/search

--- src/clj_money/models/commodities.clj
+++ src/clj_money/models/commodities.clj
@@ -109,11 +109,12 @@

 (defn search
   "Returns commodities matching the specified criteria"
-  [storage-spec criteria]
-  (with-storage [s storage-spec]
-    (->> criteria
-         (select-commodities s)
-         (map after-read))))
+  ([storage-spec criteria]
+   (search storage-spec criteria {}))
+  ([storage-spec criteria options]
+   (with-storage [s storage-spec]
+     (map after-read
+          (select-commodities s criteria options)))))

 (def update
   (update-fn {:spec ::existing-commodity


Refactor - add `$lesson-div-remove` function

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

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -628,6 +628,15 @@
                    notSelectedLessonGroups)))]
       (set! Lessons-Created-By-Draggable augmentedTTLessonInfoSeq))))

+(defn- $lesson-div-remove
+  "Removes the
 object of a lesson module, and replaces the former
+   columns occupied by its parent  with new  elements."
+  [$lessonDiv startTime endTime]
+  (let [$parentTd (parent $lessonDiv)]
+    (remove-attr $parentTd "colspan")
+    (.remove $lessonDiv)
+    (add-missing-td-elements-replacing-lesson $parentTd startTime endTime)))
+
 (defn- lesson-draggable-stop-evt-handler-maker
   "Returns a function used as the `stop` event handler for a draggable lesson."
   [moduleCode lessonType lessonGroup bgColorCssClass]
@@ -648,13 +657,9 @@
                                           :rowNum)))

       (doseq [augTTLessonInfo Lessons-Created-By-Draggable]
-        (let [$divElem  (:divElem augTTLessonInfo)
-              $parentTd (parent $divElem)]
-          ; TODO: This part of the code is the same as in the
-          ;       `remove-lesson-group-html` function. Refactor it.
-          (remove-attr $parentTd "colspan")
-          (.remove $divElem)
-          (add-missing-td-elements-replacing-lesson $parentTd augTTLessonInfo)))
+        (let [$divElem  (:divElem augTTLessonInfo)]
+          ($lesson-div-remove $divElem (:startTime augTTLessonInfo)
+                              (:endTime augTTLessonInfo))))

       (timetable-prune-empty-rows affectedDaysSet)
       (set! Lessons-Created-By-Draggable nil)
@@ -999,22 +1004,20 @@
 (defn- add-missing-td-elements-replacing-lesson
   "Adds  elements that were removed by the `add-module-lesson!` function
    to make way for the lesson."
-  [$parentTd ttLessonInfo]
-  (let [startTime (:startTime ttLessonInfo)
-        endTime   (:endTime ttLessonInfo)]
-    (loop [$currentTd $parentTd
-           timeIdx    (inc startTime)]
-      (if (>= timeIdx endTime)
-          nil
-          (let [[hourClass minuteClass]
-                (get-css-hour-minute-classes-for-time timeIdx)
-
-                $newTdElem
-                ($ "" (js-obj "class" (str hourClass " " minuteClass)))]
-            ; Insert after new  after the current
-            (insert-after $newTdElem $currentTd)
-            ; Then use the new  as the current  in the next iteration
-            (recur $newTdElem (inc timeIdx)))))))
+  [$parentTd startTime endTime]
+  (loop [$currentTd $parentTd
+         timeIdx    (inc startTime)]
+    (if (>= timeIdx endTime)
+        nil
+        (let [[hourClass minuteClass]
+              (get-css-hour-minute-classes-for-time timeIdx)
+
+              $newTdElem
+              ($ "" (js-obj "class" (str hourClass " " minuteClass)))]
+          ; Insert after new  after the current
+          (insert-after $newTdElem $currentTd)
+          ; Then use the new  as the current  in the next iteration
+          (recur $newTdElem (inc timeIdx))))))

 (defn- remove-lesson-group-html
   "Removes a lesson group for a module from the HTML timetable.
@@ -1035,15 +1038,8 @@
                  ttLessonInfo {:moduleCode moduleCode, :lessonType lessonType,
                                :lessonGroup lessonGroup, :startTime startTime,
                                :endTime endTime}
-                 $lessonDiv   (get ttRow ttLessonInfo)
-                 $parentTd    (parent $lessonDiv)]
-             ; Remove the `colspan` attribute of the parent  so it has
-             ; colspan=1
-             (remove-attr $parentTd "colspan")
-             ; Remove the HTML div elem
-             (.remove $lessonDiv)
-             ; Add the missing  elements
-             (add-missing-td-elements-replacing-lesson $parentTd ttLessonInfo)
+                 $lessonDiv   (get ttRow ttLessonInfo)]
+             ($lesson-div-remove $lessonDiv startTime endTime)
              (assoc ttLessonInfo :day day, :rowNum rowNum)))
          lessonInfoSeq)))

@@ -1223,7 +1219,7 @@
     ; restore the colspan of the source
     (remove-attr $sourceTd "colspan")
     ; fill in removed  for the source
-    (add-missing-td-elements-replacing-lesson $sourceTd augTTLessonInfo)
+    (add-missing-td-elements-replacing-lesson $sourceTd startTime endTime)
     ; remove sibling  for the destination  to make way for columns
     ; occupied by $divElem
     (doseq [$siblingTd (take (dec slotsOccupied) (.nextAll $destTd))]


fixes the build | fs / sg

fixes the build | fs / sg

--- src/cljs/conference_rating/core.cljs
+++ src/cljs/conference_rating/core.cljs
@@ -30,6 +30,9 @@
                     (session/put! :current-page #'add-conference/edit-conference-page))

 (secretary/defroute "/conferences/:id" [id]
+                    (reset! conference/displayed-conference nil)
+                    (reset! conference/display-ratings nil)
+                    (reset! conference/displayed-conference-list nil)
                     (backend/load-conference id #(reset! conference/displayed-conference %1))
                     (backend/load-conference-ratings id #(reset! conference/display-ratings %1))
                     (backend/load-conferences #(reset! conference/displayed-conference-list %1))


j/k now it does it for real to account for 5-digit fips codes

--- src/cljs/early_vote_site/server.cljs
+++ src/cljs/early_vote_site/server.cljs
@@ -8,10 +8,10 @@
 (defn election-url
   [db]
   (let [roles (get-in db [:user :roles])
-        fips-codes (get-in db [:user :fipsCodes])]
+        fips-code (first (get-in db [:user :fipsCodes]))]
     (if (contains? roles "super-admin")
       (str "http://localhost:4000/earlyvote/elections")
-      (str "http://localhost:4000/earlyvote/elections?fips=" (first fips-codes)))))
+      (str "http://localhost:4000/earlyvote/elections?fips=" (str (first fips-code) (second fips-code))))))

 (defn election-early-vote-sites-url [db]
   (str "http://localhost:4000/earlyvote/elections/"


Notify user if elm format isn't installed when trying format commands

--- src/lt/plugins/elm_light/format.cljs
+++ src/lt/plugins/elm_light/format.cljs
@@ -8,8 +8,31 @@
             [lt.objs.command :as cmd]
             [lt.objs.editor.pool :as pool]
             [lt.objs.editor :as editor]
+            [lt.objs.popup :as popup]
+            [lt.objs.platform :as platform]
             [clojure.string :as s])
   (:require-macros [lt.macros :refer [behavior]]))
+
+
+
+(defn handle-no-elm-format []
+  (notifos/done-working)
+  (console/log (.-PATH (.-env js/process)))
+  (popup/popup! {:header "We couldn't find elm-format in your path"
+                 :body (str "In order to formatting related commands, elm-format must be installed and on your system PATH."
+                            "(Check the console for PATH as seen from Light Table")
+                 :buttons [{:label "Install elm-format"
+                            :action (fn []
+                                      (platform/open "https://github.com/avh4/elm-format#installation-"))}
+                           {:label "ok"}]}))
+
+
+(defn verify-installed []
+  (if (.which clients/shelljs "elm-format")
+    true
+    (do
+      (handle-no-elm-format)
+      nil)))

@@ -59,14 +82,15 @@
 (behavior ::elm-format
           :triggers #{:elm.format}
           :reaction (fn [ed]
-                      (when-let [path (-> @ed :info :path)]
-                        (let [pos (editor/->cursor ed)
-                              [ok? res] (format-path (u/project-path path) path)]
-                          (if ok?
-                            (pool/reload ed)
-                            (handle-format-error res))
-                          (editor/move-cursor ed pos)
-                          (editor/center-cursor ed)))))
+                      (when (verify-installed)
+                        (when-let [path (-> @ed :info :path)]
+                         (let [pos (editor/->cursor ed)
+                               [ok? res] (format-path (u/project-path path) path)]
+                           (if ok?
+                             (pool/reload ed)
+                             (handle-format-error res))
+                           (editor/move-cursor ed pos)
+                           (editor/center-cursor ed))))))

 (defn- strip-module [expr]
   (->> (s/split-lines expr)
@@ -79,26 +103,28 @@
 (behavior ::elm-format-expression
           :triggers #{:elm.format-expression}
           :reaction (fn [ed]
-                      (let [pos (editor/->cursor ed)
-                            cwd (-> @ed :info :path u/project-path)]
-                        (when-let [{:keys [from to]} (sel/get-top-level-expr ed pos)]
-                          (let [[ok? res] (format-input cwd (editor/range ed from to))]
-                            (if ok?
-                              (editor/replace ed from to (strip-module res))
-                              (handle-format-error res))
-                            (editor/move-cursor ed pos))))))
+                      (when (verify-installed)
+                        (let [pos (editor/->cursor ed)
+                              cwd (-> @ed :info :path u/project-path)]
+                          (when-let [{:keys [from to]} (sel/get-top-level-expr ed pos)]
+                            (let [[ok? res] (format-input cwd (editor/range ed from to))]
+                              (if ok?
+                                (editor/replace ed from to (strip-module res))
+                                (handle-format-error res))
+                              (editor/move-cursor ed pos)))))))

 (behavior ::elm-format-buffer
           :triggers #{:elm.format-buffer}
           :reaction (fn [ed]
-                      (let [pos (editor/->cursor ed)
-                            [ok? res] (format-input (-> @ed :info :path u/project-path)
-                                                    (editor/->val ed))]
-                        (if ok?
-                          (do
-                            (editor/set-val-and-keep-cursor ed res)
-                            (editor/center-cursor ed))
-                          (handle-format-error res)))))
+                      (when (verify-installed)
+                        (let [pos (editor/->cursor ed)
+                              [ok? res] (format-input (-> @ed :info :path u/project-path)
+                                                      (editor/->val ed))]
+                          (if ok?
+                            (do
+                              (editor/set-val-and-keep-cursor ed res)
+                              (editor/center-cursor ed))
+                            (handle-format-error res))))))


Make result conversion in fast implementation configurable

--- src/main/clojure/conexp/fca/fast.clj
+++ src/main/clojure/conexp/fca/fast.clj
@@ -273,13 +273,20 @@

 ;;; Compute Concepts of Formal Contexts efficiently

+;; XXX: This does not yet apply to the external programs
+(def ^:dynamic *concepts-do-conversion*
+  "When set to anything true (the default), concepts will return proper concepts.
+  Otherwise, the function returns a list of pairs of BitSets.  This does not yet
+  apply to the :fcbo and :pcbo methods."
+  true)
+
 (defmulti concepts
   "Computes concepts with various algorithms, given as first
   argument. Default is :next-closure."
   {:arglists '([algorithm context] [context])}
   (fn [& args]
     (when-not (<= 1 (count args) 2)
-      (illegal-argument "Wrong number of args passed to c.c.algorithms.concepts."))
+      (illegal-argument "Wrong number of args."))
     (when (and (= 1 (count args))
                (not (context? (first args))))
       (illegal-argument "Argument of concepts is not a context."))
@@ -317,10 +324,12 @@
                                                                 incidence-matrix)
                                                        %)
                                      start))]
-    (map (fn [bitset]
-           [(to-hashset object-vector (a-prime bitset)),
-            (to-hashset attribute-vector bitset)])
-         intents)))
+    (if *concepts-do-conversion*
+      (map (fn [bitset]
+             [(to-hashset object-vector (a-prime bitset)),
+              (to-hashset attribute-vector bitset)])
+           intents)
+      intents)))

 ;;; Vychodil (:vychodil)
@@ -390,11 +399,14 @@
                                       empty-down-up
                                       0)
               (close! output))
-      (map (fn [pair]
-             [(to-hashset object-vector (first pair))
-              (to-hashset attribute-vector (second pair))])
-           (take-while (comp not nil?)
-                       (repeatedly #(<!! output)))))))
+      (if *concepts-do-conversion*
+        (map (fn [pair]
+               [(to-hashset object-vector (first pair))
+                (to-hashset attribute-vector (second pair))])
+             (take-while (comp not nil?)
+                         (repeatedly #(<!! output))))
+        (take-while (comp not nil?)
+                    (repeatedly #(<!! output)))))))

 ;;; In-Close (:in-close)
@@ -443,10 +455,12 @@
       (.set ^BitSet (.get As 0) 0 (int object-count))
       (.add Bs 0 (BitSet.))
       (in-close attribute-count incidence-matrix As Bs last 0 0)
-      (map (fn [A B]
-             [(to-hashset object-vector A),
-              (to-hashset attribute-vector B)])
-           As Bs))))
+      (if *concepts-do-conversion*
+        (map (fn [A B]
+               [(to-hashset object-vector A),
+                (to-hashset attribute-vector B)])
+             As Bs)
+        (map vector As Bs)))))

 ;;; Parallel-Close-by-One (:pcbo)


Indent

Indent

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -510,21 +510,21 @@
       [:p "To kick things off, you'll need to pick some projects to build:"]
       [:hr]
       [:div.org-repo-container
-      [:div.app-aside.org-listing
-       (om/build (if (feature/enabled? :bitbucket)
-        organization-listing-with-bitbucket
-        organization-listing)
-        {:user user
-         :settings settings
-         :repos repos
-         :tab tab})]
+       [:div.app-aside.org-listing
+        (om/build (if (feature/enabled? :bitbucket)
+                    organization-listing-with-bitbucket
+                    organization-listing)
+                  {:user user
+                   :settings settings
+                   :repos repos
+                   :tab tab})]
        [:div#project-listing.project-listing
-       [:div.overview
-        [:span.big-number "2"]
-        [:div.instruction "Choose a repo below and we will watch the repository for activity like commits and pull requests. We'll kick off the first build immediately and new builds will be initiated each time someone pushes commits."]]
-       (om/build repo-lists {:user user
-                             :repos repos
-                             :selected-org selected-org
-                             :osx-enabled? (get-in data state/org-osx-enabled-path)
-                             :selected-plan (get-in data state/org-plan-path)
-                             :settings settings})]]])))
+        [:div.overview
+         [:span.big-number "2"]
+         [:div.instruction "Choose a repo below and we will watch the repository for activity like commits and pull requests. We'll kick off the first build immediately and new builds will be initiated each time someone pushes commits."]]
+        (om/build repo-lists {:user user
+                              :repos repos
+                              :selected-org selected-org
+                              :osx-enabled? (get-in data state/org-osx-enabled-path)
+                              :selected-plan (get-in data state/org-plan-path)
+                              :settings settings})]]])))


Make the Pay Now button fixed

Make the Pay Now button fixed

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -387,6 +387,7 @@
         :failed-text "Failed"
         :on-click on-click-fn
         :kind :primary
+        :fixed? true
         :disabled? disabled?}
        text))))


groups-nav inbox counter now shows count of each inbox (not total)

--- src/chat/client/views/groups_nav.cljs
+++ src/chat/client/views/groups_nav.cljs
@@ -28,7 +28,14 @@
                                           (store/set-open-group! (group :id))
                                           (store/set-page! {:type :inbox}))}
                    (string/join "" (take 2 (group :name)))
-                   (let [cnt (count (get-in @store/app-state [:user :open-thread-ids]))]
+                   (let [cnt (->>
+                               (select-keys (data :threads) (get-in data [:user :open-thread-ids]))
+                               vals
+                               (filter (fn [thread]
+                                         (contains? (set (->> (thread :tag-ids)
+                                                              (map  (fn [tag-id]
+                                                                      (get-in @store/app-state [:tags tag-id :group-id]))))) (group :id))))
+                               count)]
                      (when (< 0 cnt)
                        (dom/span #js {:className "count"} cnt)))))
                (vals (data :groups))))


GAWB-1405: Fix duplicate tags when entering existing tag text (#760)

--- src/cljs/main/broadfcui/common/components.cljs
+++ src/cljs/main/broadfcui/common/components.cljs
@@ -702,8 +702,11 @@
    (fn [_]
      (fn [data]
        (clj->js {:results (map (fn [res]
-                                 (merge {"id" (res "tag")}
-                                        res))
+                                 (let [tag (res "tag")]
+                                   (merge {"id" tag
+                                           ;; text is needed to check equality with the typed input
+                                           "text" tag}
+                                          res)))
                                (js->clj data))})))
    :-template-result
    (fn [{:keys [props]}]


get ready for transfer code

get ready for transfer code

--- src/clj/morpheus/models/edge/base.clj
+++ src/clj/morpheus/models/edge/base.clj
@@ -190,9 +190,14 @@
                 :*direction* direction
                 :*group-props* (mb/schema-by-id sid)}]
               (when next-cid
-                (neb/read-lock-exec* next-cid
-                                     'morpheus.models.edge.base/extract-edges
-                                     direction sid))))))
+                (neb/read-lock-exec*
+                  next-cid
+                  'morpheus.models.edge.base/extract-edges
+                  direction sid filters))))))
+
+(defn neighbours [direction sid filters]
+  (with-cid-list
+    ))

 (defn count-edges [direction sid filters]
   (with-cid-list


add newline at the end of file #98

add newline at the end of file #98

--- src/clojure/nginx/clojure/session.clj
+++ src/clojure/nginx/clojure/session.clj
@@ -26,4 +26,4 @@
     nil))

 (defn shared-map-store [name]
-  (SharedMemoryStore. (delay (ClojureSharedHashMap. name))))+  (SharedMemoryStore. (delay (ClojureSharedHashMap. name))))


Fail if flyway could not be created.

Fail if flyway could not be created.

--- src/fhofherr/clj_db_util/migrations/flyway.clj
+++ src/fhofherr/clj_db_util/migrations/flyway.clj
@@ -17,7 +17,8 @@
           (.setDataSource flyway datasource)
           (.setDataSource flyway url user password))
         flyway)
-    (log/fatal "Neither datasource nor url, user, and password given!")))
+    (throw (IllegalArgumentException.
+             "Neither datasource nor url, user, and password given!"))))

 (defn- set-migrations-loc
   [flyway migration-loc]
@@ -26,7 +27,8 @@
     (do
       (.setLocations flyway (into-array String [migration-loc]))
       flyway)
-    (log/fatalf "Migraion loc '%s' is missing!" migration-loc)))
+    (throw (IllegalArgumentException.
+             (format "Migraion loc '%s' is missing!" migration-loc)))))

 (defn- set-schema
   [flyway schema]
@@ -44,8 +46,7 @@
           (convert-entries [[k v]] [(name k) (str v)])]
     (.setPlaceholders flyway (as-> {} $
                                  (add-schema $)
-                                 (into $ (map convert-entries placeholders))))
-    )
+                                 (into $ (map convert-entries placeholders)))))
   flyway)

 (defn- mk-flyway-callback
@@ -116,7 +117,7 @@
   [dialect {:keys [datasource url user password]} {:keys [schema
                                                           placeholders]
                                                    :as options}]
-  (some-> (Flyway.)
+  (-> (Flyway.)
     (set-datasource datasource url user password)
     (set-schema schema)
     (set-placeholders placeholders schema)
@@ -146,17 +147,15 @@

 (defn migrate
   [dialect db-spec options]
-  (if-let [fw (create-flyway dialect db-spec options)]
+  (let [fw (create-flyway dialect db-spec options)]
     (when (has-pending-migrations? fw)
       (do
         (.migrate fw)
-        db-spec))
-    (log/fatalf "Could not create flyway!")))
+        db-spec))))

 (defn clean
   [dialect db-spec options]
-  (if-let [fw (create-flyway dialect db-spec options)]
+  (let [fw (create-flyway dialect db-spec options)]
     (do
       (.clean fw)
-      db-spec)
-    (log/fatalf "Could not create flyway!")))
+      db-spec)))


change nrepl default to localhost only

change nrepl default to localhost only

can be changed back via :nrepl {:host "0.0.0.0"}

--- src/main/shadow/cljs/devtools/server/nrepl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl.clj
@@ -114,7 +114,7 @@
         ((apply comp (reverse middleware-stack)) server/unknown-op)

         {:keys [host port transport-fn]
-         :or {host "0.0.0.0"
+         :or {host "127.0.0.1"
               port 0}}
         merged-config


avoid lazy seqs in analyze

avoid lazy seqs in analyze

warnings would be missed since the seqs would be realized in emit

--- src/main/shadow/build/cljs_hacks.cljc
+++ src/main/shadow/build/cljs_hacks.cljc
@@ -462,7 +462,7 @@
           ;; (. thing (foo 1 2 3))
           member-seq?
           (let [[method & args] member
-                argexprs (map #(ana/analyze enve %) args)]
+                argexprs (mapv #(ana/analyze enve %) args)]
             (assoc ast :op :host-call
                        :prop method
                        :method method
@@ -482,7 +482,7 @@
           ;; (. thing foo)
           ;; (. thing foo 1 2 3)
           member-sym?
-          (let [argexprs (map #(ana/analyze enve %) member+)]
+          (let [argexprs (mapv #(ana/analyze enve %) member+)]
             (assoc ast :op :host-call
                        :prop member
                        :method member


remove prints

remove prints

--- src/onyx_java/utils/interop_utils.clj
+++ src/onyx_java/utils/interop_utils.clj
@@ -5,8 +5,6 @@
 ;;(required params, choice limitations, etc. not currently used.)

 (defn check-choices [choices value]
-    (println choices)
-    (println value)
     (if (boolean (some #{:all} (flatten choices))) value
         (if (some #{value} (flatten choices)) value "CHOICE-ERROR")))


[CS EN] Collapse two doseqs

[CS EN] Collapse two doseqs

--- src/vip/data_processor/output/xml.clj
+++ src/vip/data_processor/output/xml.clj
@@ -120,13 +120,12 @@
           counter (atom 0)]
       (.write out-file "<?xml version='1.0' encoding='UTF-8'?>\n")
       (.write out-file opening-tag)
-      (doseq [xml-node-fn xml-node-fns]
-        (let [xml-children (xml-node-fn ctx)]
-          (doseq [xml-child xml-children]
-            (swap! counter inc)
-            (when (zero? (mod @counter 1000))
-              (log/info "Wrote" @counter "XML nodes"))
-            (emit-element out-file xml-child))))
+      (doseq [xml-node-fn xml-node-fns
+              xml-child (xml-node-fn ctx)]
+        (swap! counter inc)
+        (when (zero? (mod @counter 1000))
+          (log/info "Wrote" @counter "XML nodes"))
+        (emit-element out-file xml-child))
       (.write out-file closing-tag)))
   ctx)


Add a voice rendering of the theme.

Add a voice rendering of the theme.

--- src/kolmogorov_music/geb.clj
+++ src/kolmogorov_music/geb.clj
@@ -14,6 +14,7 @@
                    (map coding/char->ascii)
                    (phrase [4 4 8])
                    (canon/canon #(where :pitch coding/ascii->midi %)))
+        theme2 (->> theme (with (->> (phrase [4 4 8] "GEB") (where :part (is :sample)))))
         bass (phrase [4 4 8] [-2 -1 0])
         bass2 (phrase (repeat 4 4) (cycle [3 0]))
         decoration (phrase (repeat 64 1/4) (cycle [7 8 9 11 7 6]))
@@ -24,9 +25,9 @@
         twiddle (with (phrase (repeat 32 1/2) (cycle [4 2 2 0 -1])) (phrase (repeat 64 1/4) (cycle [4 2 5 4 5 4 7 7])))]
     (->> bass
          (where :pitch (comp scale/lower scale/lower))
-         ;(with twiiddle)
-         ;(with decoration)
-         ;(with grind)
+      ;   (with twiddle)
+      ;   (with decoration)
+      ;   (with grind)
          (where :pitch (comp scale/B scale/minor))
          (with theme)
          (where :time (bpm 90))
@@ -39,7 +40,7 @@
   )

 ; Instrumentation
-(definst overchauffeur [freq 110 dur 1.0 vol 1.0]
+(definst overchauffeur [freq 110 dur 1.0 vol 0.5]
   (-> (sin-osc freq)
       (+ (* 1/3 (sin-osc (* 2.01 freq))))
       (+ (* 1/2 (sin-osc (* 3.01 freq))))
@@ -54,3 +55,13 @@
 (defmethod live/play-note :default
   [{midi :pitch seconds :duration}]
   (some-> midi midi->hz (overchauffeur seconds)))
+
+(defn book [initial]
+  (({\G (sample "samples/godel.wav" :start 3000)
+     \E (sample "samples/escher.wav")
+     \B (sample "samples/bach.wav")}
+    initial)))
+
+(defmethod live/play-note :sample
+  [{initial :pitch}]
+  (book initial))


add version TODO

add version TODO

--- test/com/billpiel/sayid/core_test.clj
+++ test/com/billpiel/sayid/core_test.clj
@@ -960,6 +960,8 @@
 x query selector funcs
   x special output
   x toggle output components
+- switch to earlier clojure version -- deps too
+  - get tests passing in all versions too
 - query output by line/column position -- for emacs plugin
 - cursors
    - bisect recording trees to find bugs


Fix gen tests

Fix gen tests

--- test/com/wsscode/pathom/gen_test.cljc
+++ test/com/wsscode/pathom/gen_test.cljc
@@ -5,7 +5,8 @@
             [clojure.test.check :as tc]
             [clojure.test.check.properties :as props]
             [clojure.spec.alpha :as s]
-            [fulcro.client.primitives :as fp]))
+            [fulcro.client.primitives :as fp]
+            [clojure.test.check.generators :as gen]))

 (def gen-env
   {::sgen/settings
@@ -48,8 +49,21 @@
   (is (= (sgen/query->props [[::fixed-number '_]])
          {::fixed-number 42}))

-  (is (true? (-> (tc/quick-check 100
-                   (props/for-all [query (s/gen ::spec.query/query)]
+  (is (true? (-> (tc/quick-check 20
+                   (props/for-all [query (spec.query/make-gen
+                                           {::spec.query/gen-property
+                                            (fn [_] (gen/elements (keys (::sgen/settings gen-env))))
+
+                                            ::spec.query/gen-ident-key
+                                            (fn [_] (gen/elements (keys (::sgen/settings gen-env))))
+
+                                            ::spec.query/gen-union-key
+                                            (fn [_] (gen/elements (keys (::sgen/settings gen-env))))
+
+                                            ::spec.query/gen-params
+                                            (fn [_] (gen/return {}))}
+
+                                           ::spec.query/gen-query)]
                      (sgen/query->props gen-env query)))
                  :result))))


Add tests for gen-add-key-from-url

Add tests for gen-add-key-from-url

--- test/comic_reader/sites/util_test.clj
+++ test/comic_reader/sites/util_test.clj
@@ -14,3 +14,20 @@
     (is (= ((gen-link->map str str) link)
            {:name "[n stuff]"
             :url "things"}))))
+
+(deftest gen-add-key-from-url-test
+  (is (= ((gen-add-key-from-url :foo #"^(.*)$") {:url "bar"})
+         {:url "bar"
+          :foo "bar"}))
+  (is (= ((gen-add-key-from-url :foo #"^(.+?)") {:url "bar"})
+         {:url "bar"
+          :foo "b"}))
+  (is (= ((gen-add-key-from-url :foo #"(ar)") {:url "bar"
+                                               :all 'other
+                                               :keys 'are
+                                               :still 'present})
+         {:url "bar"
+          :foo "ar"
+          :all 'other
+          :keys 'are
+          :still 'present})))


Fixed value caching bug

Fixed value caching bug

--- src/longshi/fressian/js.cljs
+++ src/longshi/fressian/js.cljs
@@ -247,7 +247,7 @@
       (if cache
         (if (should-skip-cache o)
           (p/write-as! bos tag o false)
-          (let [index (.old-index! (.-priority-cache bos) tag)]
+          (let [index (.old-index! (.-priority-cache bos) o)]
             (cond
               (== -1 index)
               (do


test hook

test hook

--- src/main/cawala/api/read.clj
+++ src/main/cawala/api/read.clj
@@ -6,7 +6,7 @@
                      :person/relation :friend}
                  2  {:db/id 2 :person/name "Sally" :person/age 22
                      :person/relation :friend}
-                 3  {:db/id 3 :person/name "Allie" :person/age 51
+                 3  {:db/id 3 :person/name "Allie" :person/age 52
                      :person/relation :enemy}
                  4  {:db/id 4 :person/name "Zoe" :person/age 32
                      :person/relation :friend}


Remove an unnessary use of (route) for only a single GET

--- src/main/clojure/cascade.clj
+++ src/main/clojure/cascade.clj
@@ -157,10 +157,9 @@
        :file-extensions (merge mime-type/default-mime-types file-extensions)})
     (printf "Initialized asset access at virtual folder %s\n" root)
     (wrap-exception-handling
-      (routes
-        (GET [(str root "/file/:path") :path #".*"]
-          [path]
-          (generic-asset-handler (file-asset path)))))))
+      (GET [(str root "/file/:path") :path #".*"]
+        [path]
+        (generic-asset-handler (file-asset path))))))

 (defn wrap-html
   "Ring middleware that wraps a handler so that the return value from the handler (a seq of DOM nodes)


Simplify expr

Simplify expr

--- util/clojure-cli/src/commcare_cli/app_host.clj
+++ util/clojure-cli/src/commcare_cli/app_host.clj
@@ -108,7 +108,7 @@
           (= command ":lang")
            (do (set-locale arg)
                :stay)
-          (string/starts-with? command ":today")
+          (= command ":today")
            (do (reset! today-date arg)
                :stay)
           (= command ":help")


change '() -> (list) for markdown slide

change '() -> (list) for markdown slide

--- src/monad/clojure/monoid.clj
+++ src/monad/clojure/monoid.clj
@@ -48,7 +48,7 @@
   "mconcat :: [m] -> m"
   (reduce mappend (mempty m) nest))

-(:value (mempty (List. '())))
+(:value (mempty (List. (list))))

 (:value (let [m (List. (list 1 2 3))
               n (List. (list 4 5 6))]
@@ -57,7 +57,7 @@
 (mappend (mappend (mempty (List. '())) (List. (list 1 2 3))) (List. (list 4 5 6)))

 (:value (let [nest (map ->List [(list 1 2 3) (list 4 5 6)])]
-          (mconcat (->List '()) nest)))
+          (mconcat (->List (list)) nest)))

 (defrecord Product [value]
   Monoid


remove slack api calling from api

remove slack api calling from api

--- src/open_company/lib/bot.clj
+++ src/open_company/lib/bot.clj
@@ -15,18 +15,6 @@
    :script   {:id KnownScripts :params {s/Keyword s/Str}}
    :receiver {:type (s/eq :channel) :id s/Str}
    :bot      {:token s/Str :id s/Str}})
-
-(defn slack-api [method params]
-  (-> (http/get (str "https://slack.com/api/" (name method))
-                {:query-params params :as :json})
-      (d/chain #(if (-> % :body :ok)
-                  %
-                  (throw (ex-info "Error after calling Slack API"
-                                  {:method method :params params
-                                   :response (select-keys % [:body :status])}))))))
-
-(defn get-im-channel [token user-id]
-  (-> @(slack-api :im.open {:token token :user user-id}) :body :channel :id))

 (defn strip-prefix
   "Remove potential prefixes from supplied `id`"
@@ -51,12 +39,8 @@
         bot (-> ctx :user :bot)]
     {:api-token   (:jwtoken ctx)
      :bot         bot
-     :script      {:id script-id
-                   :params (script-params ctx)}
-     :receiver    {:type :channel
-                   :id   (if (= \U (first rid))
-                           (get-im-channel (:token bot) rid)
-                           rid)}}))
+     :script      {:id script-id, :params (script-params ctx)}
+     :receiver    {:type :channel, :id rid}}))

 (defn send-trigger! [trigger]
   (s/validate BotTrigger trigger)


Add TODO note

Add TODO note

--- src/retouch/views/swipe.cljs
+++ src/retouch/views/swipe.cljs
@@ -43,6 +43,8 @@
                              percent-dragged (/ (- scroll-x
                                                    (@state :scroll-x-start))
                                                 width)
+                             ; TODO should switch away from delta-n
+                             ; instead, just based off direction and location when let go
                              delta-n (cond
                                        (< percent-dragged -1.35) -2
                                        (< percent-dragged -0.15) -1


Fix that damn docstring AGAIN

Fix that damn docstring AGAIN

--- src/useful/amalloy/debug.clj
+++ src/useful/amalloy/debug.clj
@@ -2,7 +2,7 @@

 (defmacro ?
   "A useful debugging tool when you can't figure out what's going on:
-  wrap a form with and-print, and the form will be printed alongside
+  wrap a form with ?, and the form will be printed alongside
   its result. The result will still be passed along."
   [val]
   `(let [x# ~val]


Updated to set default for all track types

--- src/video_server/encoder.clj
+++ src/video_server/encoder.clj
@@ -16,7 +16,7 @@
             [video-server.file :refer [file-type fullpath replace-ext video-filename]]
             [video-server.format :refer [video-dimension video-size video-width]]
             [video-server.util :refer :all]
-            [video-server.video :refer [audio-streams subtitle-streams video-stream web-playback?]])
+            [video-server.video :refer [audio-streams container-track subtitle-streams video-stream web-playback?]])
   (:import (java.io File)))

 (def ^:dynamic *fake-encode* false)
@@ -156,27 +156,30 @@
           (when-not (zero? (:exit exec))
             (log/warn "clearing subtitle tracks failed:" \newline cmd \newline exec)))))))

-(defn set-default-subtitles
-  "Sets the default subtitle track."
+(defn set-default-track
+  "Sets the default video, audio or subtitle track."
   [file track]
   (when (and (= (file-type file) :mkv) @mkvpropedit)
-    (log/debug "setting default subtitles")
     (let [info (video-info (io/file file))
           streams (:streams info)
+          default (container-track info track)
+          codec (:codec_type default)
           actions (atom [])]
-      (doseq [[index stream] (map-indexed vector streams)]
-        (let [value (if (= index track) 1 0)]
-          (when (and (= (:codec_type stream) "subtitle")
-                     (not= (-> stream :disposition :default) value))
-          (log/trace "changing default flag on subtitle track" (:index stream) "to" value)
-          (swap! actions conj
-                 "--edit" (str "track:s" (relative-track-index streams "subtitle" (:index stream)))
-                 "--set" (str "flag-default=" value)))))
+      (log/debug "setting default" codec "track" track)
+      (when (get-in default [:disposition :default])
+        (doseq [[index stream] (map-indexed vector streams)]
+          (let [value (if (= index track) 1 0)]
+            (when (and (= (:codec_type stream) codec)
+                       (not= (get-in stream [:disposition :default]) value))
+              (log/trace "changing default flag on track" (:index stream) "to" value)
+              (swap! actions conj
+                     "--edit" (str "track:" (first codec) (relative-track-index streams codec (:index stream)))
+                     "--set" (str "flag-default=" value))))))
       (when (seq @actions)
         (let [cmd ["mkvpropedit" file @actions]
               exec (exec cmd)]
           (when-not (zero? (:exit exec))
-            (log/warn "changing subtitle tracks failed:" \newline cmd \newline exec)))))))
+            (log/warn "changing default track failed:" \newline cmd \newline exec)))))))

 (def mkclean (delay (exec? "mkclean")))


Fixed bug where new, stable files were not getting processed

--- src/video_server/watcher.clj
+++ src/video_server/watcher.clj
@@ -35,16 +35,17 @@

 (defn stable?
   "Returns true if the file has has content and has not been modified
-  for at least thirty seconds."
+  for a reasonable duration."
   [file]
-  (and (pos? (.length file))
+  (and (.isFile file)
+       (pos? (.length file))
        (< (.lastModified file) (- (System/currentTimeMillis) stable-time))))

 (defn add-subtitles
   "Performs the initial scan for subtitles."
   [folder video]
   (doseq [file (.listFiles (:file folder) (subtitle-filter (:title video)))]
-    (log/info "adding subtitles" (str file))
+    (log/info "adding subtitle" (str file))
     (add-subtitle folder file video)))

 (defn add-images
@@ -83,7 +84,8 @@
       (add-images folder video))))

 (defn add-file
-  "Adds a newly discovered file to the library."
+  "Adds a newly discovered file to the library and queues it for
+  processing."
   [folder file]
   (log/info "adding file" (str file))
   (when-let [video (video-for-file folder file)]
@@ -91,7 +93,8 @@
   (cond
     (video? file) (add-video folder file)
     (subtitle? file) (add-subtitle folder file)
-    (image? file) (add-image folder file)))
+    (image? file) (add-image folder file))
+  (process-file folder file))

 (defn check-pending-files
   "Checks the pending files and adds the stable ones to the library."
@@ -100,10 +103,9 @@
     #_(log/trace "checking pending files")
     (doseq [file @pending-files]
       (try (when (stable? file)
-             (dosync (alter pending-files disj file))
-             (when (.exists file)
-               (add-file folder file)
-               (process-file folder file)))
+             (add-file folder file))
+           (when (or (stable? file) (not (.exists file)))
+             (dosync (alter pending-files disj file)))
            (catch Exception e (log/error e "adding pending file" (str file)))))))

 (defn add-pending-file


Added import

Added import

--- src/wishlistd/cljs/main.cljs
+++ src/wishlistd/cljs/main.cljs
@@ -1,7 +1,7 @@
 (ns wishlistd.client.main
   (:require [crate.core :as crate]
             [fetch.remotes :as remotes])
-  (:use [jayq.core :only [$ append empty find val delegate data]])
+  (:use [jayq.core :only [$ remove append empty find val delegate data]])
   (:use-macros [crate.macros :only [defpartial]]
                [fetch.macros :only [letrem]]))


Fixed order since it matters.

Fixed order since it matters.

--- src/wombats/sockets/game.clj
+++ src/wombats/sockets/game.clj
@@ -130,6 +130,25 @@
   [game-id chan-id]
   (:color (get-game-room-player game-id chan-id)))

+;; Broadcast functions
+
+(defn broadcast-arena
+  [game-id arena]
+  (let [channel-ids (get-game-room-channel-ids game-id)]
+    (doseq [channel-id channel-ids]
+      (send-message channel-id
+                    {:meta {:msg-type :frame-update}
+                     :payload arena}))))
+
+(defn broadcast-stats
+  [game-id stats]
+  (let [viewers (get-game-room-channel-ids game-id)]
+
+    (doseq [chan-id viewers]
+      (send-message chan-id
+                    {:meta {:msg-type :stats-update}
+                     :payload (vec stats)}))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Handlers
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -195,25 +214,6 @@
                                :color (get-player-color game-id chan-id)
                                :timestamp (str (l/local-now))}]
         (broadcast-game-message game-id formatted-message)))))
-
-;; Broadcast functions
-
-(defn broadcast-arena
-  [game-id arena]
-  (let [channel-ids (get-game-room-channel-ids game-id)]
-    (doseq [channel-id channel-ids]
-      (send-message channel-id
-                    {:meta {:msg-type :frame-update}
-                     :payload arena}))))
-
-(defn broadcast-stats
-  [game-id stats]
-  (let [viewers (get-game-room-channel-ids game-id)]
-
-    (doseq [chan-id viewers]
-      (send-message chan-id
-                    {:meta {:msg-type :stats-update}
-                     :payload (vec stats)}))))

 (defn create-socket-handler-map
   "Allows for adding custom handlers that respond to namespaced messages


Refine APIs

Refine APIs

--- src/zipping_checkin/core.clj
+++ src/zipping_checkin/core.clj
@@ -8,8 +8,9 @@

 (defroutes routes
   (GET "/users/register" {{:keys [name phone email]} :params}
-    (let [user-id (users/register-user name phone email)]
-      (str "registered: " name)))
+       (let [user-id (users/register-user name phone email)
+             user (users/query-user user-id)]
+         (str "registered: " user)))
   (GET "/users/unregister" {{:keys [user-id]} :params}
     (let [user (users/query-user user-id)]
       (users/unregister-user user-id)


Make name comparison case-insensitive

Make name comparison case-insensitive

--- src/bltool/core.clj
+++ src/bltool/core.clj
@@ -60,7 +60,7 @@

 (t/ann filter-games [BLGameList -> BLGameList])
 (defn- filter-games [bl-games new-games]
-  (let [same-name? (fn [x y] (= (:name x) (:name y)))
+  (let [same-name? (fn [x y] (some-> (:name x) (.equalsIgnoreCase (:name y))))
         new-game? (fn [game] (not-any? (partial same-name? game) bl-games))
         name-ok? (fn [game] (.contains (:name game) (:name *opts*)))]
     (cond->> new-games


(defn analyze) should conjugate canonical forms as the various possible present-tense inflections, e.g. "sleep"->present tense 1st,2nd, or 3rd plural.

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -758,10 +758,34 @@
      (concat
       (or analyzed analyzed-via-identity)

-     ;; also lookup the surface form itself, which
-     ;; might be either the canonical form of a word, or an irregular conjugation of a word.
-     (get lexicon surface-form)
-     ))))
+      ;; also lookup the surface form itself, which
+      ;; might be either the canonical form of a word, or an irregular conjugation of a word.
+
+      ;; In english, the canonical form of a verb looks the same as the 1st and 2nd person present tense,
+      ;; (regardless of number), and the same as the 3rd person plural present tense; e.g.:
+      ;; "sleep" is the canonical form, which is used in: "I sleep","you sleep","you all sleep",
+      ;; "they sleep","we sleep". The following causes canonical forms to be expanded to all of
+      ;; these. We don't want to simply leave it as an unconjugated, canonical form, as this
+      ;; will lead to a profusion of unintended parses (e.g. "sleep" will be treated as past, present, and
+      ;; future, when it is only meant as one of the above-described present forms.
+      (->> (get lexicon surface-form)
+           (mapcat (fn [entry]
+                     (map (fn [variant]
+                            (let [result
+                                  (unifyc entry variant)]
+                              (if (not (fail? result))
+                                result
+                                entry)))
+                          [{:synsem {:cat :verb
+                                     :infl :present
+                                     :subcat {:1 {:agr {:person :1st}}}}}
+                           {:synsem {:cat :verb
+                                     :infl :present
+                                     :subcat {:1 {:agr {:person :2nd}}}}}
+                           {:synsem {:cat :verb
+                                     :infl :present
+                                     :subcat {:1 {:agr {:number :sing
+                                                        :person :3rd}}}}}]))))))))

 ;; TODO: rewrite with recur or map or similar, rather than recursively.
 (defn exception-generator [lexicon]


Scale weight-matrix to have row sums with stdev 1.0

--- src/cortex/util.clj
+++ src/cortex/util.clj
@@ -38,11 +38,13 @@
     (m/emul sz (m/sub 1.0 sz))))

 (defn weight-matrix
-  [m n]
-  (let [n (long n)
-        m (long m)
-        stdev (/ 1.0 n)]
-    (m/scale! (rand/sample-normal [m n]) stdev)))
+  "Constructs a weight matrix with normally distributed random values. Weights are scaled so that
+   the element sums of each row are normally distributed with mean 0.0 and stdev 1.0"
+  ([m n]
+    (let [n (long n)
+          m (long m)
+          factor (Math/sqrt (/ 1.0 n))]
+      (m/scale! (rand/sample-normal [m n]) factor))))

 (defn mse-gradient-fn
   "Returns the MSE error gradient for a given output and target value"


Cleaned up trends functions a bit to handle cleaned ts

--- src/clj/forma/trends/analysis.clj
+++ src/clj/forma/trends/analysis.clj
@@ -158,13 +158,11 @@
   "returns a three-tuple with the trend coefficient, trend t-stat, and
   the hansen statistic for each period between `start-idx` (inclusive)
   and `end-idx` (inclusive)."
-  [freq start-idx end-idx spectral-ts reli-ts cofactor-ts]
-  (let [params [freq start-idx end-idx spectral-ts reli-ts]
-        clean-ts (apply clean-timeseries params)
-        cofactor-tele (lengthening-ts start-idx end-idx cofactor-ts)]
+  [freq start-idx end-idx spectral-ts cofactor-ts]
+  (let [cofactor-tele (take (count spectral-ts) cofactor-ts)]
     (map flatten
-         (transpose [(map hansen-stat (map i/matrix clean-ts))
-                     (map long-stats clean-ts cofactor-tele)]))))
+         (transpose [(map hansen-stat (map i/matrix spectral-ts))
+                     (map long-stats spectral-ts cofactor-tele)]))))

 (defn telescoping-short-trend
   "returns a vector of the short-term trend coefficients over time


fix Snatch and Grab bug when Runner declines to take a tag

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -566,8 +566,8 @@
                                                   {:msg (msg "take 1 tag to prevent " (:title c)
                                                              " from being trashed")
                                                    :effect (effect (tag-runner 1 {:unpreventable true}))}
-                                                  {:effect (trash state side c) :msg (msg "trash " (:title c))})
-                                                card nil))}
+                                                  {:effect (effect (trash c)) :msg (msg "trash " (:title c))})
+                                               card nil))}
                              card nil)))}}

    "Sub Boost"


change key for type filter option

change key for type filter option

--- src/clj_money/models/accounts.clj
+++ src/clj_money/models/accounts.clj
@@ -164,7 +164,7 @@
   ([storage-spec entity-id] (select-by-entity-id storage-spec entity-id {}))
   ([storage-spec entity-id options]
    (with-storage [s storage-spec]
-     (let [types (or (:include options)
+     (let [types (or (:types options)
                      (set account-types))]
        (->> (select-accounts-by-entity-id s entity-id)
             (map prepare-for-return)