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
| (ns user | |
| (:require [clojure.core.async :as async])) | |
| (defn now-millis [] | |
| (System/currentTimeMillis)) | |
| (defn throttled-chan | |
| "Returns a channel that will throttle attempts to take items according to the rate-limits. | |
| rate-limits should be a sequence of pairs of integers. The first item in each pair | |
| is describing how many items is possible to take, at most, from the input for the interval |
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
| (ns omnitech.shims) | |
| (defn- closest [selector] | |
| (this-as node | |
| (let [node-list (.querySelectorAll js/document selector) | |
| all (mapv #(aget node-list %) (range 0 (.-length node-list)))] | |
| (loop [node node] | |
| (let [parent (.-parentNode node)] | |
| (if (some #(= parent %) all) | |
| parent |
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
| (require '[clojure.string :as string]) | |
| (def blink | |
| (memoize | |
| (fn [times n] | |
| (if (zero? times) | |
| 1 | |
| (let [l (count n) | |
| l-half (bit-shift-right l 1) | |
| even? (= (+ l-half l-half) l)] |
OlderNewer