This file contains 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 stop-worry.core | |
(:require ["react" :as react :rename {createElement $}] | |
["react-dom" :as dom] | |
[goog.object :as obj] | |
[cljs.core.async :as async])) | |
(extend-type object | |
ILookup | |
(-lookup | |
([o k] (obj/get o (name k))) |
This file contains 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 react.helper) | |
(defmacro defc [name argv & body] | |
`(def ~name (react.helper/component (str '~(get-in &env [:ns :name]) "/" (name '~name)) (fn ~argv ~@body)))) |
This file contains 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 example.core | |
(:require [react.helper :refer-macros [defc]] | |
[cljsjs.react.dom] | |
[goog.object :as obj])) | |
(enable-console-print!) | |
(extend-type object | |
ILookup | |
(-lookup |
This file contains 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 react.helper | |
#?(:cljs (:require [cljsjs.react] | |
[cljsjs.create-react-class]))) | |
#?(:cljs | |
(defn- react-factory [display-name render] | |
(js/React.createFactory | |
(js/createReactClass | |
#js {:displayName display-name | |
:shouldComponentUpdate |
This file contains 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
clojure -Sdeps '{:deps {clj-http {:mvn/version "3.10.1"}}}' -e '(use (quote clj-http.client)) (get "http://google.com")' |
This file contains 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 batch [in out max-time max-count] | |
(let [lim-1 (dec max-count)] | |
(async/go-loop [buf [] t (async/timeout max-time)] | |
(let [[v p] (async/alts! [in t])] | |
(cond | |
(= p t) | |
(do | |
(async/>! out buf) | |
(recur [] (async/timeout max-time))) |
This file contains 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
{:paths ["/"] | |
:deps {}} |
This file contains 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 tinylog.core | |
(:require [clj-http.client :as http] | |
[cheshire.core :as json] | |
[clojure.core.async :as async])) | |
(defprotocol Logger | |
(log [this msg])) | |
(defn map* [f logger] | |
(reify Logger |
This file contains 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 example.log) | |
(defprotocol Logger | |
(log [this msg])) | |
(defn map* [f logger] | |
(reify Logger | |
(log [this msg] (log logger (f msg))))) | |