Skip to content

Instantly share code, notes, and snippets.

Chris Murphy chrismurrph

Block or report user

Report or block chrismurrph

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am chrismurrph on github.
  • I am cjmurphy (https://keybase.io/cjmurphy) on keybase.
  • I have a public key ASAKxuvtgC_nSO_Q9zXv4JzCe2pTIMq7Ege5DQ4lczb1Wgo

To claim this, I am signing this object:

View identities-and-stages-hof
(defn identities-and-stages-hof
"The data doesn't have a player-year so we create it now. Also the games need to be
unique on their own, as they are stored in their own table.
Also the simplification of the lines for stage :improved is handled here.
The work for :nyt stage can be done always as :naive doesn't use those keys."
[desired-labels {:keys [stage]}]
(fn [idx {:keys [pname year games max] :as player-year}]
(let [player-year-id (make-player-year-id pname year)
label {:pname pname :year year}
make-simple (fn [games n]
View fill-desired-labels
(let [st @state
desired-player-idents (->> (get st :player-year/by-id)
vals
(filter :ui/desired?)
(map :player-year-id)
(mapv (fn [id] [:player-year/by-id id])))]
(swap! state assoc-in [:desired-labels/by-id :singleton :items] desired-player-idents))
@chrismurrph
chrismurrph / replace.clj
Last active Nov 22, 2017
Search and replace for going to Fulcro 2.0
View replace.clj
(ns general.replace
(:require [clojure.string :as s]
[clojure.java.io :as io]
[clojure.pprint :as pp]))
(defn indexes-of [in-str find-str]
(loop [idx 0
indexes []]
(let [found-idx (s/index-of in-str find-str idx)]
(if found-idx
@chrismurrph
chrismurrph / gist:dccad0d583ca188255cf8b1ab046b676
Last active Nov 15, 2017
Dynamic generation of Fulcro Forms options
View gist:dccad0d583ca188255cf8b1ab046b676
;;-> In fh ns
;;
;; Can be used in a mutation to assoc-in new options
;;
(defn input-options [[table-name id :as ident] field]
[table-name id ::f/form :elements/by-name field :input/options])
(defn input-default-value [[table-name id :as ident] field]
[table-name id ::f/form :elements/by-name field :input/default-value])
(defn options-generator [data->list-fn item->option-fn list->selected-fn]
View component-factory.cljs
(ns training.component-factory
(:require-macros [re-com.core :refer [handler-fn]])
(:require [training.utils :as u]
[re-com.util :refer [deref-or-value px]]))
;;
;; A row is a {}. Each key of this {} will have a control as its value. Then also have an :id which we are going to
;; make the row number. The control when created will look like []. See my-checkbox below which is the actual control.
;;
(defn gen-table-row [create-control-fn column-keys row]
@chrismurrph
chrismurrph / index.html
Created Oct 29, 2015 — forked from cstorey/index.html
A trivial clojurescript paint program using Reagent and core.async. Greatly inspired by the RxJS paint example.
View index.html
<html>
<head>
<script src="out/goog/base.js" type="text/javascript"></script>
<script src="hello_world.js" type="text/javascript"></script>
<script type="text/javascript">goog.require("hello_world.core");</script>
</head>
<body>
</body>
<script type="text/javascript">hello_world.core.run()</script>
</html>
@chrismurrph
chrismurrph / views.cljs
Last active Oct 19, 2015
Trying to put a Reforms component into re-frame
View views.cljs
(ns training.views
(:require [re-frame.core :as re-frame]
[re-com.core :as re-com]
[reforms.reagent :include-macros true :as f]
[training.utils :as u]))
(def h-box re-com/h-box)
(def v-box re-com/v-box)
(def box re-com/box)
(def gap re-com/gap)
You can’t perform that action at this time.