Skip to content

Instantly share code, notes, and snippets.

View green-coder's full-sized avatar
🌱

Vincent Cantin green-coder

🌱
View GitHub Profile
(ns repl-sessions.demo-2021-07
(:require [lambdaisland.witchcraft :as wc]
[lambdaisland.witchcraft.cursor :as c]
[lambdaisland.witchcraft.events :as e]
[lambdaisland.witchcraft.worlds :as worlds]))
;; First start the server, if you want a clean slate you can create
;; a "superflat" world, otherwise you'll get a more typically generated world.
(wc/start! {;;:server-port 4567
;;:config-dir "/tmp/config"
[{:title ":clojureD 2020",
:id "PLaSn8eiZ631lrDFmUTBH9LFGzAxc3tvU4",
:items
({:title
"clojureD 2020: Lightning Talks by Mikkel Gravgaard, Daniel Slutsky, Daniel Janus and Arne Brasseur",
:id "fVtawjGbvOQ",
:duration "1363"}
{:title
"clojureD 2020: \"From Lazy Lisper to Confident Clojurist\" by Alexander Oloo",
:id "j57UbYFbI-U",
(ns interaction.dom-stuff
(:require [plas.thicc :as thicc]))
(def state (atom {:count 1}))
;; (conj! (thicc/el-by-id "app")
;; (thicc/dom [:<>
;; [:h1 "Count is " (thicc/reatom :count state)]
;; [:button {:on-click #(swap! state update :count inc)} "+1"]]))
@roman01la
roman01la / clojurescript-repl-workflow.md
Last active October 22, 2022 12:07
ClojureScript REPL Workflow

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

@cldwalker
cldwalker / spike-day-02-03-20.md
Last active December 29, 2023 04:52
GraalVM dive in Clojure at work

Spike

I looked into the state of GraalVM and Clojure and wrote some small work-related scripts.

GraalVM Build Tools

@roman01la
roman01la / index.md
Last active January 7, 2020 09:03
Abusing constants table in ClojureScript's compiler

Abusing constants table in ClojureScript's compiler

In React wrapper library UIx that I'm working on there's defui macro that compiles Hiccup directly into React's VirtualDOM. Apart from doing that the macro also hooks into the compiler to hoist constant parts of VirtualDOM across components and namespaces, so that those parts will be essentially interned (cached).

Here's an example of two components defined in different namespaces where both of them share a part of the structure.

(ns foo.core
  (:require [uix.core.alpha :refer [defui]]))
@pesterhazy
pesterhazy / clj_to_js.md
Last active February 26, 2024 20:18
ClojureScript Do's and Don'ts: clj->js

ClojureScript Do's and Dont's: clj->js

You should prefer

#js["tag" #js{"k1" v1, "k2" v2}]

over

@mfikes
mfikes / tree-seq.clj
Last active May 22, 2020 21:03
Directly-reducible PoC in Clojure
(defn nth' [coll n]
(transduce (drop n) (completing #(reduced %2)) nil coll))
(defn tree-seq'
[branch? children root]
(eduction (take-while some?) (map first)
(iterate (fn [[node pair]]
(when-some [[[node' & r] cont] (if (branch? node)
(if-some [cs (not-empty (children node))]
[cs pair]
@reborg
reborg / rich-already-answered-that.md
Last active February 23, 2024 13:09
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@ramalho
ramalho / RethinkDB-why-we-failed.md
Created January 19, 2017 14:46
RethinkDB: why we failed
layout title
post
RethinkDB: why we failed

Posted on Github by Slava Akhmechet

When we [announced][shutdown-announcement] that RethinkDB is shutting down, I promised to write a post-mortem. I took some time to process the experience, and I can now write about it clearly.