Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

adam-james adam-james-v

🏠
Working from home
View GitHub Profile
@adam-james-v
adam-james-v / images-during-clojure-dev.org
Created Jul 18, 2022
Ways to Show Images in Emacs during Clojure Dev.
View images-during-clojure-dev.org

CIDER-show

Cider-show depends on CIDER’s ability to display inline images. You have to enable this feature:

M-x cider-repl-toggle-content-types

Run that command in a CIDER REPL buffer to enable the feature.

Or, permanently enable the setting by placing this somewhere in your emacs init config:

@adam-james-v
adam-james-v / export-md-on-save-org-mode.el
Created Apr 22, 2022
Elisp function that calls Pandoc's org to markdown exporter. Useful for org+clerk literate programming
View export-md-on-save-org-mode.el
;; You can use this function to export your current .org file as a .md file
;; The function requires Pandoc to be installed, so make sure you've got it!
;; Why use this instead of org's built in markdown exporter?
;; If you're a fan of both org mode and NextJournal's Clerk, you can use this to
;; effectively have Clerk render your .org files as you write them.
;; The built-in markdown exporter does not correctly annotate code blocks
;; with ```clojure \n ... \n```, which prevents Clerk from seeing and evaluating
@adam-james-v
adam-james-v / ob-babashka.el
Last active Sep 9, 2022
a quick change of ob-clojurescript to try use Babashka.
View ob-babashka.el
;;; ob-babashka.el --- org-babel functions for ClojureScript evaluation -*- lexical-binding: t; -*-
;; Author: Adam James Vermeer
;; Maintainer: Adam James Vermeer
;; Created: 25 June 2021
;; Keywords: literate programming, reproducible research, babashka, clojure, scripting
;; Homepage: https://gist.github.com/adam-james-v/f4d2b75a70b095d14a351a1eff96b4b0
;; Package-Requires: ((emacs "24.4") (org "9.0"))
;; This file is modified from [[https://github.com/emacsmirror/ob-clojurescript/blob/master/ob-clojurescript.el][ob-clojurescript]]
@adam-james-v
adam-james-v / literate-clojure-emacs-config.org
Created Apr 4, 2021
A minimum-viable emacs config. for literate programming with Clojure.
View literate-clojure-emacs-config.org

Emacs Config

;;

This is a ‘minimum viable config’ built for the purpose of literate programming with Clojure / Clojurescript. It uses MELPA to download and install a few packages that I consider necessary for a good Clojure dev. experience, though that’s of course only my opinion. I use CIDER, a robust and popular REPL tool. It could arguably be substituted for inf-clojure, but I haven’t tried that myself.

This config does assume that you already have emacs installed and that you have at least a cursory understanding of how to navigate and use it. Or, at the very least know a few keywords to search as you try learn things. Emacs can be a daunting tool (I don’t even know most of it myself yet, honestly), but you can do the most critical things without too much difficulty and a bit of patience.

@adam-james-v
adam-james-v / qblock.cljc
Last active Jul 13, 2022
Code for a mario Question Block Model (Clojure compiled to openscad)
View qblock.cljc
;; code related to a youtube video:
;; https://youtu.be/3euk0-JF_tc
(ns qblock.main
(:require [clojure.string :as st]
[scad-clj.model :refer :all]
[scad-clj.scad :refer [write-scad]]))
(fn! 30)
@adam-james-v
adam-james-v / hydroponic-design.cljc
Last active Feb 12, 2021
Design File for a DIY hydroponics system. This uses clojure and scad-clj to compile an OpenSCAD script.
View hydroponic-design.cljc
;; code related to https://youtu.be/EU0_I-1ROok
(ns hydro.design
(:require [clojure.string :as st]
[scad-clj.model :refer :all]
[scad-clj.scad :refer [write-scad]]))
(def parameters
{:tube-p {:l 34
:id 5
@adam-james-v
adam-james-v / vidwiz.clj
Last active Jun 21, 2022
Clojure/babashka script to help automate some of my video editing pipeline
View vidwiz.clj
#!/usr/bin/env bb
(ns vidwiz.main
"This is a prototype script for automating a portion of my video editing using ffmpeg."
(:require [clojure.java.shell :refer [sh]]
[clojure.string :as st]
[cheshire.core :refer [parse-string]]))
;; util
(defn get-extension
@adam-james-v
adam-james-v / hc-main.cljc
Last active Mar 15, 2021
Minimal implementation of a Hiccup Compiler
View hc-main.cljc
;; source code related to the project shown in this video:
;; https://youtu.be/_XiEc0g2wL8
;; author: adam-james
(ns hc.main)
(defn hiccup?
[item]
(and (vector? item)
(keyword? (first item))))