Skip to content

Instantly share code, notes, and snippets.

@saskali
saskali / balance_of_n.clj
Last active August 26, 2019 20:18
Balance of N - kata @socrates 2019
(ns balance-of-n.core-test
(:require [clojure.test :refer :all]))
(defn number->digits
([number] (number->digits number []))
([number result]
(if (< number 10)
(-> result (conj number) vec)
(number->digits (quot number 10)
(cons (mod number 10) result)))))
@saskali
saskali / roman_numerals.clj
Last active August 26, 2019 20:07
Roman Numerals - kata @socrates 2019
(ns roman-numerals.core-test
(:require [clojure.test :refer :all]))
(def roman-digit->arabic
{\I 1
\V 5
\X 10
\L 50
\C 100})
(ns simple.core
(:require [reagent.core :as reagent]
[re-frame.core :as rf]))
;; -- Domino 1 - Event Dispatch -----------------------------------------------
(defn dispatch-click
[]
(rf/dispatch [:click-count])) ;; send event `:click-count`
(ns color-sorting.core
(:require [reagent.core :as reagent]))
(def colors ["blue" "yellow" "green" "purple" "red"])
(def color-row (reagent/atom ["blue" "yellow" "green"]))
(def sorted-color-row (reagent.ratom/reaction (sort @color-row)))
(defn square [color]
[:svg {:style {:background color
(ns simple.core
(:require [reagent.core :as reagent]
[re-frame.core :as rf]
[clojure.string :as str]))
;; A detailed walk-through of this source code is provied in the docs:
;; https://github.com/Day8/re-frame/blob/master/docs/CodeWalkthrough.md
;; -- Domino 1 - Event Dispatch -----------------------------------------------