Skip to content

Instantly share code, notes, and snippets.

(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"
[INFO] Scanning for projects...
[INFO]
[INFO] Using the MultiThreadedBuilder implementation with a thread count of 16
[INFO]
[INFO] ----------------------< net.glowstone:glowstone >-----------------------
[INFO] Building Glowstone 2021.7.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- scriptus:0.3.2:describe (default) @ glowstone ---
[INFO] Set property "describe" to "2fb6d6b"
(ns orc-battle.player
(:require [orc-battle.monster :as m]))
(defn init [] {:health 30
:agility 30
:strength 30})
(defn dead? [{health :health :or {health 0}}]
(<= health 0))
(ns repl-sessions.vaccines
(:require [clojure.data.csv :as csv]
[clojure.java.io :as io]
[time-literals.data-readers]
[time-literals.read-write]
[applied-science.waqi :as waqi]))
(time-literals.read-write/print-time-literals-clj!)
(extend-protocol csv/Read-CSV-From
[{: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 repl-sessions.vaccines
(:require [clojure.data.csv :as csv]
[clojure.java.io :as io]
[time-literals.data-readers]
[time-literals.read-write]
[applied-science.waqi :as waqi]))
(time-literals.read-write/print-time-literals-clj!)
(extend-protocol csv/Read-CSV-From
(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"]]))
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no">
<script type="application/clojurescript">
(defn loop [frame-time]
(js/requestAnimationFrame loop)
(run! (fn [i]
;;; -*- lexical-binding: t -*-
;; (when (not (server-running-p))
;; (server-start))
;; Enable copy-paste to/from x clipboard when running in a terminal
(set-frame-font "Iosevka Fixed SS14-22")
(global-linum-mode 1)
@plexus
plexus / lookup.clj
Created March 12, 2021 12:45
Doing key lookup in Clojure
;; If it's a record-like thing then we want to emphasize
;; that it's a key-lookup, so use (:key coll)
(:uri req)
(:email member)
;; Some collections behave more like functions, here use (coll key),
;; that way someone reading the code without context can understand it,
;; without having to know that it's really a map or set
(def allowed-role? #{:admin :mod})