Skip to content

Instantly share code, notes, and snippets.

XMLHttpRequest cannot load http://google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource.
(ns some-app.core
(:require [reagent.core :as r]
[cljsjs.react-input-autosize]))
(def autosize-input (r/adapt-react-class "AutosizeInput"))
(defn editor [state]
[:div.editor
[autosize-input {:value "Hello"
:name "some-name"
(set-env!
:source-paths #{"src/cljs" "src/clj" "src/cljc"}
:resource-paths #{"resources" }
:dependencies '[[org.clojure/clojure "1.9.0-alpha17"]
[org.clojure/clojurescript "1.9.908"]
[adzerk/boot-cljs-repl "0.3.3"]
[adzerk/boot-cljs "2.1.2" :scope "test"]
[adzerk/boot-reload "0.5.1" :scope "test"]
[pandeiro/boot-http "0.8.3" :scope "test"]
@dimovich
dimovich / snippet.clj
Last active December 7, 2017 08:09
thi.ng/geom
(require '[thi.ng.geom.core :as g]
'[thi.ng.geom.core.vector :as v]
'[thi.ng.geom.spatialtree :as t])
(defn update-tree [tree]
(fn [agents]
(reduce
#(g/add-point % %2 %2)
(g/clear! tree) ;;works with (t/set-children tree nil)
agents)))
Raspberry Pi
https://www.amazon.com/CanaKit-Raspberry-Ultimate-Starter-Kit/dp/B01C6Q4GLE/
DHT22: Temperature and Humidity
https://www.arrow.com/en/products/sen0137/dfrobot
DS18B20: Temperature and Humidity
https://www.arrow.com/en/products/374/adafruit-industries
Power Relays
(re-frame/reg-event-db
:db/initialize-iota
(fn [db [_ v]]
(let [state (make-state)]
(assoc db :state state))))
(re-frame/reg-event-fx
:db/initialize-iota-mam
@dimovich
dimovich / upload.cljs
Created March 12, 2018 13:19 — forked from paultopia/upload.cljs
clojurescript read uploaded text file in browser (derived from https://mrmcc3.github.io/post/csv-with-clojurescript/ )
(ns upload-file.core
(:require [reagent.core :refer [render atom]]
[cljs.core.async :refer [put! chan <! >!]])
(:require-macros [cljs.core.async.macros :refer [go go-loop]]))
;; derived from https://mrmcc3.github.io/post/csv-with-clojurescript/
;; and based on reagent-frontend template.
;; dependencies from project.clj in addition to clojure, clojurescript, and reagent:
;; [org.clojure/core.async "0.2.395"]
(d/pull-many db '[*]
(apply sorted-set
(concat
(d/q '[:find [?e ...]
:in [?tag ...] $
:where
[?e :tags ?tag]]
search-tags
db)
(defn update-stats
"Take a collection of pages and update stats (fns)."
[pages & [fns]]
(let [fns (or fns [update-stat1 update-stat2 clean-page])
xform (apply comp (map (partial map) fns)) ;;create transducer from
;;collection of functions
in-chan (async/chan 1)
out-chan (async/chan 1)]
(async/onto-chan in-chan pages)
{:deps
{org.clojure/clojure {:mvn/version "1.10.0-alpha4"}
ring/ring-core {:mvn/version "1.6.3"}
metosin/reitit-core {:mvn/version "0.1.1-SNAPSHOT"}
metosin/reitit-ring {:mvn/version "0.1.1-SNAPSHOT"}
http-kit {:mvn/version "2.2.0"}}}
;;
;;├── deps.edn
;;├── public