Skip to content

Instantly share code, notes, and snippets.

(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})
{
"application": {
"name": "Firefox",
"osVersion": "Linux 5.8.0-43-generic #49~20.04.1-Ubuntu SMP Fri Feb 5 09:57:56 UTC 2021",
"version": "88.0a1",
"buildID": "20210303215027",
"distributionID": "",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0",
"safeMode": false,
"updateChannel": "nightly",
(ns foo.bar)
(defn add-numbers [& numbers]
(apply + numbers))
(ns foo.bar)
(defn add-numbers [& numbers]
(apply + numbers))
/* Styling for Puget :html-classes / lambdaisland/deep-diff2 */
code .class-delimiter { color: #a3685a;}
code .class-name { color: #a3685a;}
code .nil { color: #4d4d4c;}
code .boolean { color: #4d4d4c;}
code .number { color: #4271ae;}
code .character { color: #a3685a;}
code .string { color: #3e999f;}
code .keyword { color: #4271ae;}
(ns defwrapper
(:require [clojure.string :as str]))
(set! *warn-on-reflection* true)
(defn class-methods [^Class class]
(seq (.getMethods class)))
(defn constructors [^Class klazz]
(.getDeclaredConstructors klazz))