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 com.aa.nexus.eql.interceptor-spike | |
"See: | |
https://gist.github.com/tmoerman/c4c863c00e5364932ad209f921d9e7d2" | |
(:require | |
[clojure.string :as str] | |
[clojure.test :refer :all] | |
[com.wsscode.pathom3.connect.indexes :as pci] | |
[com.wsscode.pathom3.connect.operation :as pco] | |
[com.wsscode.pathom3.connect.runner :as pcr] |
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 get-case-ident | |
[props] | |
(let [case-id? string?] | |
(cond | |
(-> props :nexus.case.image-annotation/id merge/nilify-not-found case-id?) [:nexus.case.image-annotation/id (:nexus.case.image-annotation/id props)] | |
(-> props :nexus.case.test-case/id merge/nilify-not-found case-id?) [:nexus.case.test-case/id (:nexus.case.test-case/id props)] | |
:else (log/error "Cannot derive a valid ident. Invalid props." props)))) | |
(defsc AddState [_ _] | |
{:query [:nexus.case.image-annotation/id |
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 combine-latest | |
"Accepts a collection of channels, an optional selector function f and an option output | |
channel. Returns a channel with the latest values of the input values combined by the | |
selector function. If no selector function is specified, a vector will be returned. | |
The output channel closes when any of the input channels closes. | |
Inspired by http://rxmarbles.com/#combineLatest" | |
([chs] (combine-latest (chan) vector chs)) | |
([f chs] (combine-latest (chan) f chs)) | |
([out f chs] | |
(assert some? chs) |
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 nil->keyword [x] (if (nil? x) :nil x)) | |
(defn nil-safe [f] (comp nil->keyword f)) | |
(defn lift | |
[f] | |
(fn [x] | |
(cond | |
(instance? Throwable x) x | |
(nil? x) :nil |
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 c (chan)) | |
(defn exception? [x] (instance? Exception x)) | |
(defn throwable? [x] (instance? Throwable x)) | |
(-> c | |
(->> (map*< #(/ 5 %)) | |
(split (complement throwable?))) | |
(-< (->> (first) | |
(map*< (fn [x] (prn ":) " x))) |
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 apply-all | |
" | |
=[in]=>(effect) | |
" | |
[effect in] | |
(go-loop [] | |
(if-let [v (<! in)] | |
(do | |
(effect v) | |
(recur))))) |
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 toggled | |
"Add a toggle to an input channel. | |
The ctrl channel accepts truthy, falsy or :toggle values. | |
The toggle value in the loop determines whether the input value is piped | |
to the output channel or not. | |
_____ | |
=[in]===>| | | |
| alt |=[out]=> | |
=[ctrl]=>| | |
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 scraps | |
(:require [clojure.core.async :refer [go timeout alts! chan <! >! put! <!!] :as async] | |
[org.httpkit.client :as http])) | |
;; sometimes yields nil | |
(def c (chan)) | |
(defn http-get [url c] | |
(http/get url (fn [r] (put! c r))) |
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
You have a knack for prose my friend, but your science is just no good. | |
Example 1, I assume you wouldn’t marry your sister, right? Why would that be? Because you do not want to | |
procreate with genes that are too similar to yours. What does offspring of very similar parents have more | |
chance of having? Genetic defects. Where do you think the term “Hill Billy” come from? | |
Example 2, it has been shown that the sense of smell is still important for humans for selecting a mate, | |
because smell discloses particularities about your immune system’s genes. Which mates do people (and | |
animals as well) prefer according to smell? That’s right, mates with a different genetic makeup. Why? | |
because difference in genes strengthen your body’s defence systems against parasites and diseases. |
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
My news aggregation service kept pushing this article in my face. | |
I decided to make a contribution. | |
#1 #2 #3 #4 #5 #8 | |
TIKTAALIK | |
Flat headed animal, 375 million years old, transitional form between primitive fish and amphibians | |
- http://www.youtube.com/watch?v=x2xyrel-2vI#t=2604 | |
- http://en.wikipedia.org/wiki/Tiktaalik | |
ARCHAEOPTERYX |
NewerOlder