<commit_before>;; Copyright (c) 2011-2016 <NAME> <<EMAIL>>
;;
;; This file is part of Sinusoid.es.
;;
;; Sinusoid.es is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; Sinusoid.es is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with Sinusoid.es.  If not, see
;; <http://www.gnu.org/licenses/>.

(ns sinusoides.views.main
  (:require [sinusoides.routes :as routes]
            [sinusoides.views.sinusoid :as sinusoid]
            [sinusoides.views.addons :refer [css-transitions]]
            [clojure.string :as s]
            [reagent.core :as r]))

(defn main-view [sin]
  (r/with-let [gens [#(rand-nth ["What "
                                 "Who "
                                 "Where "
                                 "Why "])
                     #(rand-nth [" I"
                                 " you"
                                 " they"])
                     #(rand-nth [[" I " "am"]
                                 [" you " "are"]
                                 [" they " "are"]])]
               parts (r/atom ;; (vec (map apply gens))
                       ["What " " you" [" I " "am"]])
               randomize (fn []
                           (let [[idx gen] (rand-nth (map-indexed vector gens))]
                             (swap! parts #(assoc % idx (gen)))))
               interval (.setInterval js/window randomize 6000)

               transition {:transition-name "part"
                           :transition-enter-timeout 2000
                           :transition-leave-timeout 2000}]

    [:div#main-page.fixed-page
     [:div#barcode]
     [:a#barcode2 {:href (routes/todo)}]

     [:div#main-text (sinusoid/hovered sin)
      [css-transitions transition
        ^{:key (@parts 0)}
        [:div.part (@parts 0) " " [:a {:href (routes/do)} "do"]]]

      [css-transitions transition
       ^{:key (@parts 1)}
       [:div.part (@parts 1) " " [:a {:href (routes/think)} "think"]]]

      [css-transitions transition
       ^{:key (@parts 2)}
       [:div.part ((@parts 2) 0)<commit_msg>Make sure that the question changes on every step<commit_after>;; Copyright (c) 2011-2016 <NAME> <<EMAIL>>
;;
;; This file is part of Sinusoid.es.
;;
;; Sinusoid.es is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; Sinusoid.es is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; Affero General Public License for more details.
;;
;; You should have received a copy of the GNU Affero General Public
;; License along with Sinusoid.es.  If not, see
;; <http://www.gnu.org/licenses/>.

(ns sinusoides.views.main
  (:require [sinusoides.routes :as routes]
            [sinusoides.views.sinusoid :as sinusoid]
            [sinusoides.views.addons :refer [css-transitions]]
            [clojure.string :as s]
            [reagent.core :as r]))

(defn main-view [sin]
  (r/with-let [gens [#(rand-nth ["What "
                                 "Who "
                                 "Where "
                                 "Why "])
                     #(rand-nth [" I"
                                 " you"
                                 " they"])
                     #(rand-nth [[" I " "am"]
                                 [" you " "are"]
                                 [" they " "are"]])]

               parts (r/atom ;; (vec (map apply gens))
                      ["What " " you" [" I " "am"]])

               gen-new
               (fn [gen elem]
                 (first (first
                   (drop-while (fn [[a b]] (= a b))
                               (map vector (repeatedly gen) (repeat elem))))))

               randomize
               (fn []
                 (let [[idx gen] (rand-nth (map-indexed vector gens))]
                   (swap! parts #(assoc % idx (gen-new gen (% idx))))))

               interval (.setInterval js/window randomize 6000)

               transition {:transition-name "part"
                           :transition-enter-timeout 2000
                           :transition-leave-timeout 2000}]

    [:div#main-page.fixed-page
     [:div#barcode]
     [:a#barcode2 {:href (routes/todo)}]

     [:div#main-text (sinusoid/hovered sin)
      [css-transitions transition
        ^{:key (@parts 0)}
        [:div.part (@parts 0) " " [:a {:href (routes/do)} "do"]]]

      [css-transitions transition
       ^{:key (@parts 1)}
       [:div.part (@parts 1) " " [:a {:href (routes/think)} "think"]]]

      [css-transitions transition
       ^{:key (@parts 2)}
       [:div.part ((@parts 2) 0)
{'fraction_non_alphanumeric': 0.13208262270229296, 'fraction_numerical': 0.010991093424294107, 'mean_word_length': 1.6482689412945308, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3078889', 'n_tokens_mistral': 1565, 'n_tokens_neox': 1458, 'n_words': 481}