Skip to content

Instantly share code, notes, and snippets.

View jaidetree's full-sized avatar

jaide (formerly eccentric-j) jaidetree

View GitHub Profile
@jaidetree
jaidetree / Dockerfile
Last active March 1, 2021 06:34
A Dockerfile to install emacs and the latest doom. Expects user to mount over ~/.doom.d/ with a
FROM phusion/baseimage:18.04-1.0.0
RUN add-apt-repository ppa:kelleyk/emacs \
&& apt update \
&& apt install -y git emacs27 tmux vim sqlite3 wget
RUN git clone https://github.com/hlissner/doom-emacs.git ~/.emacs.d
# Might be needed if you want to pre-build the config but not required
# In which case run doom sync via shell
# COPY ./doom.d /root/.doom.d
@jaidetree
jaidetree / effective_questions.md
Last active February 26, 2021 00:07 — forked from mjlbach/effective_questions.md
Asking effective questions

Foreword

The open source community depends on the efforts of a small group of volunteers relative to the number of users. In order to make the most of contributors' time, here is some advice for asking “good questions”. This is largely paraphrased from this article by Eric Steven Raymond and Rick Moen, with edits for brevity and tone. If you have the time (and tolerance), I strongly recommend reading that article over this one. Let's start with the procedure.

The procedure

  1. Try to find an answer by searching the archives of the issue-tracker, IRC, matrix-room, discord, forum or mailing list you plan to post to.
  2. Try to find an answer by searching the Web.
  3. Try to find an answer by reading the manual.
  4. Try to find an answer by reading a FAQ.
  5. Try to find an answer by inspection or experimentation.
@jaidetree
jaidetree / dbg.org
Last active May 18, 2022 01:19
Clojure and ClojureScript dbg! macro from rust
@jaidetree
jaidetree / 2020-12-01.clj
Last active December 1, 2020 08:25
2020 Advent of Code
(defn find-sum
"O(n^2)"
[sum nums]
(set (for [x nums
y nums
:when (and (not= x y)
(= sum (+ x y)))]
(* x y))))
@jaidetree
jaidetree / config.el
Last active June 11, 2020 21:55
[WIP] My Eamcs Doom config
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Jay Zawrotny"
user-mail-address "jayzawrotny@gmail.com")
@jaidetree
jaidetree / spec-tree-example.clj
Last active June 1, 2020 03:09
A quick example to spec a tree-like data structure consisting of leafs, recursive nodes, and an empty list
(ns spec-intro.core
(:require
[clojure.spec.alpha :as s]))
(s/def ::tree (s/or
:empty (s/and coll? empty?)
:node (s/cat :left (s/? ::tree)
:right (s/? ::tree))
:leaf (complement coll?)))
@jaidetree
jaidetree / clojure-syntax.clj
Last active April 24, 2020 01:52
This covers most if not all of Clojure's syntax.
;; Comments
(comment (any-valid clojure-form :is fine?)) ; end of line comments
#_i-am-commented-out "but I am not"
;; Values
5 3 1/3 0.5 "hello" :keyword
;; Lists
[1 2 3] ;; Vector - Good for finite, short lists
'(1 2 3) ;; seq - Good for infinite, long lists
@jaidetree
jaidetree / 1_promise.cljc
Last active April 4, 2020 16:05
A WIP library of promise macros for ClojureScript
(ns cljs.promise
(:refer-clojure :exclude [resolve]))
(defmacro promise
"
Example:
(promise (resolve 5))
(promise (reject (js/Error. \"oops\")))
"
@jaidetree
jaidetree / replacer.clj
Created January 31, 2020 01:55
Use like `ack -g "filepattern" | clj -m replacer.replacer PATTERN REPLACEMENT` to interactively replace pattern in every file matching filepattern.
(ns replacer.replacer
(:require
[clojure.string :as s]
[clojure.java.io :as io]))
(defn get-files
[input]
(doall (line-seq (java.io.BufferedReader. input))))
(defn read-prompt
(ns project.swipe
(:require [bacon :as bacon]))
(defn do-when
[source f]
(if f (.doAction source f) source))
(defn bind-event
[event-name]
(fn [binder listener]