Skip to content

Instantly share code, notes, and snippets.


Oliver Caldwell Olical

View GitHub Profile
Olical /
Created Aug 2, 2020
Conjure school without installing Conjure!
# Try an interactive Conjure tutorial without installing Conjure!
# All you need is curl and an up to date nvim.
curl -fL | sh
Olical / repair.clj
Created Oct 15, 2019
Repair translated Markdown -> AsciiDoc files from my blog
View repair.clj
(require '[clojure.string :as str]
'[clojure.edn :as edn])
(for [file (fs/list-dir "posts")
:when (str/ends-with? (str file) ".md.adoc")]
(let [[_ date slug] (re-find #"(\d\d\d\d\-\d\d\-\d\d)\-([\w\-\d]+)\.md\.adoc" (str file))
title (:title (edn/read-string (slurp (fs/file "posts" (str date "-" slug ".md")))))]
(spit (fs/file "posts" (str slug ".adoc"))
(str "= " title "\nOliver Caldwell\n" date "\n\n" (slurp file)))))
Olical /
Last active Oct 7, 2019
Using a super alpha version of Conjure - Clojure socket prepl in Neovim

Conjure alpha preview

Neovim Clojure tooling over prepl

This is the legacy Rust implementation that I've replaced with Clojure. Check out the master branch for the main Clojure version. The old source can be found on the legacy-rust-implementation branch.

I've been working on [Conjure][] for a while now and using it day to day at work. It's coming along but I still have a todo list that stretches off the screen. This is mostly "nice to haves", not essential features. I don't want to release it until I've completed my main list and I'm happy with the level of polish.

This gist covers how to set up the current super alpha version (v0.3.0) in your own Neovim so you can give it a go and maybe give me some feedback. Here's the caveats:

Olical / fireplace-refresh.vim
Created Apr 18, 2018
Vim bindings for vim-fireplace that act like cider-refresh
View fireplace-refresh.vim
autocmd FileType clojure nnoremap <buffer> <silent> <localleader>rx :Eval (do (bounce.system/stop!) ( "src/clj" "src/cljc") ( :after 'bounce.system/start!))<cr>
autocmd FileType clojure nnoremap <buffer> <silent> <localleader>rX :Eval (do (bounce.system/stop!) ( ( "src/clj" "src/cljc") ( :after 'bounce.system/start!))<cr>
Olical / scheme.vim
Created Apr 15, 2018
Some MIT Scheme bindings intended for Neovim
View scheme.vim
function! scheme#connect()
let s:repl_term_id = termopen('mit-scheme')
normal! G
function! scheme#eval_top_form()
let l:save_clipboard = &clipboard
set clipboard=
let l:save_reg = getreg('s')
Olical / cljs_namespace_tools.cljs
Created Mar 6, 2018
ClojureScript (node) to discover namespaces in a directory
View cljs_namespace_tools.cljs
(ns cljs-namespace-tools
(:require [ :as parse]
[ :as reader-types]
[cljs-node-io.core :as io]
[cljs-node-io.fs :as fs]
[cljs.test :as t]))
(defn path-kind [path]
(fs/file? path) :file
Olical / tree.cljc
Created Sep 16, 2017
Using clojure.spec to parse trees
View tree.cljc
(ns bonsai.tree
(:require #?(:clj [clojure.spec.alpha :as s]
:cljs [cljs.spec.alpha :as s])))
(s/def ::element (s/or :string string?
:element (s/cat :name keyword?
:attrs (s/? (s/map-of keyword? any?))
:children (s/* ::element))))
(s/conform ::element [:p])
Olical / lzfn.clj
Created Sep 4, 2017
A function macro that yields the EXACT same function reference if the arguments and body LOOK the same.
View lzfn.clj
;; Wasn't sure on a name, but this'll do.
(def fn-cache (atom {}))
(defmacro lzfn [& forms]
`(let [fn-hash# (hash '~forms)
fn# (get @fn-cache fn-hash#)]
(if fn#
(let [new-fn# (fn ~@forms)]
Olical /
Last active Feb 6, 2017
Changes to so it doesn't make spacemacs error.
function rvm --description='Ruby enVironment Manager'
# run RVM and capture the resulting environment
set --local env_file (mktemp -t
bash -c 'source ~/.rvm/scripts/rvm; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv > /dev/null 2>&1
# apply rvm_* and *PATH variables from the captured environment
and grep '^rvm\|^[^=]*PATH\|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/s/:/" "/g; s/^/set -xg /; s/=/ "/; s/$/" ;/; s/(//; s/)//' | source
# needed under fish >= 2.2.0
and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
Olical / fib.rkt
Last active Sep 27, 2016
A fast, recursive, typed fibonacci program written in Racket.
View fib.rkt
#lang typed/racket
(: fib (-> Number Number))
(define (fib n)
(fib-iter 0 1 n))
(: fib-iter (-> Number Number Number Number))
(define (fib-iter a b n)
(if (= n 0) a
(fib-iter b (+ a b) (- n 1))))
You can’t perform that action at this time.