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
(require '[clojure.java.shell :refer [sh]] | |
'[clojure.string :as string]) | |
(let [out (:out (sh "ifconfig")) | |
wifi-device "wlp0s20f3" |
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
(require 'package) ;; You might already have this line | |
;;instructions at setting up a clojure/clojurescript development environment at http://lambdakids.stigmergy.systems/2018/6/6/hello-world.blog | |
(add-to-list 'package-archives (cons "melpa-stable" "https://stable.melpa.org/packages/") t) | |
(add-to-list 'load-path "~/.emacs.d/lisp") | |
;;download doremi at https://www.emacswiki.org/emacs/DoReMi | |
(load "doremi.el") | |
(load "doremi-cmd.el") |
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 red.cube | |
(:require [cljsjs.three])) | |
(defn draw-cube [] | |
(let [scene (js/THREE.Scene.) | |
camera (js/THREE.PerspectiveCamera. 75 (/ js/window.innerWidth js/window.innerHeight) 0.1 1000) | |
renderer (js/THREE.WebGLRenderer. #js{:antialias true}) | |
geometry (js/THREE.BoxGeometry. 1 1 1) | |
material (js/THREE.MeshBasicMaterial. #js{:color "#433F81"}) | |
cube (js/THREE.Mesh. geometry material) |
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
(require-macros '[cljs.core.async.macros :refer [go go-loop]]) | |
(require '[cljs.core.async :refer [put! <! >! chan pub sub unsub]]) | |
(defonce message-bus (chan)) | |
(defonce message-publication (pub message-bus (fn [msg] | |
(if (vector? msg) | |
(first msg) | |
:no-topic)))) | |
(def s1 (chan)) |
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 q [& params] | |
"wrapper around d/q so that you don't have to pass in the database everytime" | |
(let [query (first params) | |
query+conn (conj [query] | |
@db) | |
variable-bindings (rest params) | |
params2 (vec (concat query+conn variable-bindings))] | |
(apply d/q params2))) | |
(defn transact! [datoms] |
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
import com.cognitect.transit.Keyword | |
import com.cognitect.transit.impl.KeywordImpl | |
implicit class ClojureKeyword(val sc:StringContext) extends AnyVal{ | |
def k(args: Any*):KeywordImpl = { | |
val s = sc.raw(args.toSeq : _*) | |
new KeywordImpl(s) | |
} | |
} |
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 with-db-id [m] | |
(let [m-with-db-id (into m {:db/id (temp-id)}) | |
result (for [[k v] m-with-db-id :let [type-v (type v)]] | |
(if (or (= type-v clojure.lang.PersistentArrayMap) | |
(= type-v clojure.lang.PersistentHashMap)) | |
(let [v-with-db-id (into v {:db/id (temp-id)})] | |
{k (with-db-id v-with-db-id)}) | |
(if (or (= type-v clojure.lang.IteratorSeq) | |
(= type-v clojure.lang.PersistentHashSet)) | |
{k (map #(with-db-id %) v)} |