I hereby claim:
- I am eneroth on github.
- I am eneroth (https://keybase.io/eneroth) on keybase.
- I have a public key ASAcj6_a7ptkxlPrJD0OE87QcZzU8sBMesZE5fUb5UH-7wo
To claim this, I am signing this object:
;; Rendera en låda | |
;; --------------- | |
(defn command-box | |
[] | |
[:input#commandbox {}]) ;; "commandbox" är IDt | |
(render-component [command-box] (get-element "body")) | |
;; Lyssna på events fran elementet | |
;; ------------------------------- |
(let [grunka #(mate (rand-nth fittest) (rand-nth fittest)) | |
pryl (repeatedly num-matings grunka)] | |
(scores goal (mutate-population pryl))) |
(defn add [a b] | |
(+ a b)) | |
(let [add-1 (partial add 1)] | |
(println (add-1 6)) | |
(println (add-1 12))) |
var Timer = React.createClass({ | |
getInitialState: function() { | |
return {secondsElapsed: 0}; | |
}, | |
tick: function() { | |
this.setState({secondsElapsed: this.state.secondsElapsed + 1}); | |
}, | |
componentDidMount: function() { | |
this.interval = setInterval(this.tick, 1000); | |
}, |
I hereby claim:
To claim this, I am signing this object:
;; Load config | |
(defn load-config [config-path] | |
(let [ch (chan)] | |
(go | |
(let [{:keys [succeeded data]} (<! (path/resolve config-path)) | |
abs-path data] | |
(if-not succeeded | |
(failure ch data (str "load-config: couldn't resolve path '" config-path "'")) | |
(let [{:keys [succeeded data]} (<! (file/read abs-path :utf-8)) | |
config-content data] |
(defn safe-seq | |
[thing] | |
(if (seqable? thing) | |
(seq thing) | |
true)) | |
(defprotocol StripNil | |
(strip-nil [data] | |
"Recursively strips values that are nil from a datastructure. |
(defn- process-one | |
"Takes a channel and a function. Expects vectors of [index arguments] | |
on the channel. Takes from the channel, and applies the function | |
to the arguments part of the vector. Returns an output-channel, | |
on which the index and the result of the function application is returned." | |
[in-ch function] | |
(let [out-ch (chan)] | |
(go | |
(loop [item (<! in-ch)] | |
(if item |
(def brackets {\{ \} | |
\[ \] | |
\( \)}) | |
(defn checker [stack char] | |
(if (some #{char} (keys brackets)) ;; Is the character an opening bracket? | |
(conj stack char) | |
(let [closing-char (get brackets (last stack))] | |
(if (= closing-char char) |
(defn- deep-merge | |
"Takes a collection of maps and deep merges them. I.e... | |
[{:a {:b 1}} | |
{:a {:c 2}}] | |
... will be merged into ... | |
[{:a {:b 1 | |
:c 2}}] |