This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn rotate | |
"rotate a 2D matrix 90 degrees, it's ok if it's not a perfect square" | |
[mat] | |
(loop [remaining (map reverse mat) | |
result []] | |
(if (every? empty? remaining) | |
result | |
(recur (map rest remaining) | |
(conj result (remove nil? (mapv first remaining))))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def search-term (atom "")) | |
(defn input [model on-change] | |
(let [external-model (atom @model) | |
internal-model (atom (or @external-model ""))] | |
(fn [model on-change] | |
;; this is taken from recom - http://bit.ly/1SZ1OXn | |
(when (not= @external-model @model) | |
(.log js/console "changed to " @model) | |
(reset! external-model @model) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; this is very much a gist, and it can be tweaked | |
;; ;; NOTIFICATIONS ---------- | |
;; if (typeof Notification !== 'undefined') { | |
;; alert('Please us a modern version of Chrome, Firefox, Opera or Safari.'); | |
;; return; | |
;; } | |
;; Notification.requestPermission(function (permission) { | |
;; if (permission !== 'granted') return; |
NewerOlder