<commit_before>(ns leipzig-live.views
  (:require
    [leipzig-live.actions :as action]
    [quil.core :as quil :include-macros true]
    [quil.middleware :as middleware]
    [reagent.core :as reagent]))

(quil/defsketch sketch
  :setup (constantly [{:time 0 :pitch 440}
                      {:time 1 :pitch 660}
                      {:time 2 :pitch 880}
                      {:time 3 :pitch 660}
                      {:time 4 :pitch 440}])
  :draw (fn [state]
          (quil/background 255)
          (doseq [{:keys [time pitch]} state]
            (quil/ellipse
              (-> time (* 100) (+ 17))
              (-> pitch - (* 0.25) (+ 300))
              30
              30)))
  :host "graph"
  :no-start true
  :middleware [middleware/fun-mode]
  :size [600 300])

(defn graph [handle! state]
  (reagent/create-class
    {:render (fn [] [:canvas#graph {:width 300 :height 300}])
     :component-did-mount sketch}))

(defn editor-did-mount [handle! _]
  (fn [this]
    (let [pane (.fromTextArea
                 js/CodeMirror
                 (reagent/dom-node this)
                 #js {:mode "clojure"})]
      (.on pane "change" #(-> % .getValue action/->Refresh handle!)))))
<commit_msg>Sketch the notes. There's an issue with redrawing.<commit_after>(ns leipzig-live.views
  (:require
    [leipzig-live.actions :as action]
    [quil.core :as quil :include-macros true]
    [quil.middleware :as middleware]
    [reagent.core :as reagent]))

(defn draw-graph [{:keys [music]}]
  (quil/sketch :setup (constantly music)
               :draw (fn [state]
                       (quil/background 255)
                       (doseq [{:keys [time pitch]} state]
                         (quil/ellipse
                           (-> time (* 100) (+ 17))
                           (-> pitch - (* 0.25) (+ 300))
                           30
                           30)))
               :host "graph"
               :no-start true
               :middleware [middleware/fun-mode]
               :size [600 300]))

(defn graph [handle! state]
  (reagent/create-class
    {:render (fn [] [:canvas#graph {:width 300 :height 300}])
     :component-did-update #(draw-graph state)}))

(defn editor-did-mount [handle! _]
  (fn [this]
    (let [pane (.fromTextArea
                 js/CodeMirror
                 (reagent/dom-node this)
                 #js {:mode "clojure"})]
      (.on pane "change" #(-> % .getValue action/->Refresh handle!)))))

{'fraction_non_alphanumeric': 0.14804241435562807, 'fraction_numerical': 0.03262642740619902, 'mean_word_length': 1.651891891891892, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6931178', 'n_tokens_mistral': 865, 'n_tokens_neox': 755, 'n_words': 198}