Skip to content

Instantly share code, notes, and snippets.

;; use spec to define stateful protocols inspired by UBF(b)
;; https://ubf.github.io/ubf/ubf-user-guide.en.html
(require '[clojure.spec.alpha :as s]
'[clojure.core.async :as async])
(defn ubfish
"Takes a protocol definition and four channels. Checks for protocol
violations while copying from-server to-client and from-client
to-server."
@didibus
didibus / user.clj
Created January 29, 2020 04:20
A Clojure user.clj file which lets you lazy load certain namespace at the REPL
(def safe-requires
"List of namespaces to require and refer when inside user ns at load time.
Can be given an initialization body to execute after having been required.
To do so, wrap the lib spec in a vector, and all elements after the lib
spec vector will be evaled after the lib spec has been required."
'[[clojure.repl :as repl :refer (source apropos dir pst doc find-doc)]
[clojure.java.javadoc :as javadoc :refer (javadoc)]
[clojure.pprint :as pprint :refer (pp pprint)]
[clojure.stacktrace :as stacktrace :refer (e)]
@wtaysom
wtaysom / bel-eve-vr.md
Last active January 24, 2024 03:25
A Review of Paul Graham's Bel, Chris Granger's Eve, and a Silly VR Rant

Hello Friends,

This elf begging to climb onto the web for Christmas began as a personal email, a review of Paul Graham's little Lisp Bel. He sprouted arms, legs, and in gingerstyle ran away. Arms for symbols, legs for conses: these primitives are the mark a Lisp — even more so than the parenthesis. What do we get when we remove these foundation stones: naming and pairing?

No pairs. No cons. No structure. Unordered. Chaos. Eve, a beautifully incomplete aspect oriented triple store. No need for legs when you can effortlessly transport to your destination. Lazy. Pure. Here and now, a retrospective.

No symbols. No names. No variables. Combinators. Forth. No need for arms when you can effortlessly push and pop your stack. No words. A world without words. Virtual worlds. Virtual reality. Space. Time. Motion. Action. Kinetic Programming, a proposal.

I apologize in advance. Checking my pocketwatch, I see I haven't t

@ertugrulcetin
ertugrulcetin / clojure-clojurescript-shadow-cljs-aws-elasticbeanstalk-circleci.md
Last active February 22, 2024 04:54
Clojure, ClojureScript and Shadow-cljs - Deploying to Elastic Beanstalk using CircleCi 2
@jdf-id-au
jdf-id-au / transit-connection.cljc
Last active September 10, 2023 09:32
Sketch for connecting henryw374/time-literals to transit
(ns transit-connection
"Connect time-literals to transit."
(:require [time-literals.read-write]
#?(:cljs [java.time :refer [Period
LocalDate
LocalDateTime
ZonedDateTime
OffsetTime
Instant
OffsetDateTime
@jclosure
jclosure / echo_server.el.md
Last active June 30, 2023 16:12
Create a simple tcp server to accept input on a socket in elisp

Accept input such as s-expressions, forms, text for buffer input, commands, etc..

;;; echo-server.el --- -*- lexical-binding: t -*-
;;
;; Copyright (C) 2016-2017 York Zhao <[email protected]>

;; Author: York Zhao <[email protected]>
;; Created: June 1, 2016
;; Version: 0.1
@robert-stuttaford
robert-stuttaford / notes.md
Last active March 18, 2024 13:52
Datomic 0.9.5927 observations and questions

Query basics

{:db/ident       :meta/tag
 :db/valueType   :db.type/tuple
 :db/tupleAttrs  [:meta/tag-namespace :meta/tag-key :meta/tag-value] ;; all unique strings
 :db/cardinality :db.cardinality/one
 :db/unique      :db.unique/identity}

Then

(ns grain-fills.lazy-path
(:require [clojure.datafy :as datafy :refer [datafy nav]]
[clojure.core.protocols :as p]
[clojure.java.io :as io]
[clojure.set :as set]))
(defn navigate-file [this k v]
(let [f (:clojure.datafy/obj (meta this))]
(io/file f v)))
@aroemers
aroemers / app.clj
Last active January 15, 2021 20:25
Component-lite
(ns app
(:require [lifecycle :refer [combine parallel]]))
(defn components [app-config]
(combine (parallel (users-db/component)
(tasks-db/component))
(rest-api/component app-config)))
@robey
robey / qemu-linux.md
Created May 17, 2019 19:30
install a qemu virtual machine on linux

install qemu on host machine & launch it

sudo apt install qemu-system-x86
sudo apt install libsdl2-dev

qemu-img create -f qcow2 test.qcow2 16G

qemu-system-x86_64 -enable-kvm -m 2048 -boot d
    -nic user,model=virtio