Skip to content

Instantly share code, notes, and snippets.

View Olical's full-sized avatar
🧙‍♂️
(magic)

Oliver Caldwell Olical

🧙‍♂️
(magic)
View GitHub Profile
@Olical
Olical / 20-synaptics.conf
Last active November 1, 2018 07:01
Some configuration for Arch Linux on a Dell XPS 13 9350
Section "InputClass"
Identifier "touchpad"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "3"
Option "TapButton3" "2"
Option "VertEdgeScroll" "on"
Option "VertTwoFingerScroll" "on"
Option "HorizEdgeScroll" "on"
@Olical
Olical / git-auto-complete.sh
Created June 17, 2011 15:34
Git branch / tag/ remote / command terminal completion. Drop it into your bash profile
_complete_git() {
if [ -d .git ]; then
branches=`git branch -a | cut -c 3-`
tags=`git tag`
remotes=`git remote`
commands="add bisect branch checkout clone commit diff fetch grep init log merge mv pull push rebase reset rm show status tag stash pop"
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "${branches} ${tags} ${remotes} ${commands}" -- ${cur}) )
fi
}
@Olical
Olical / fireplace-refresh.vim
Created April 18, 2018 10:58
Vim bindings for vim-fireplace that act like cider-refresh
autocmd FileType clojure nnoremap <buffer> <silent> <localleader>rx :Eval (do (bounce.system/stop!) (clojure.tools.namespace.repl/set-refresh-dirs "src/clj" "src/cljc") (clojure.tools.namespace.repl/refresh :after 'bounce.system/start!))<cr>
autocmd FileType clojure nnoremap <buffer> <silent> <localleader>rX :Eval (do (bounce.system/stop!) (clojure.tools.namespace.repl/clear) (clojure.tools.namespace.repl/set-refresh-dirs "src/clj" "src/cljc") (clojure.tools.namespace.repl/refresh-all :after 'bounce.system/start!))<cr>
@Olical
Olical / scheme.vim
Created April 15, 2018 20:39
Some MIT Scheme bindings intended for Neovim
function! scheme#connect()
vnew
let s:repl_term_id = termopen('mit-scheme')
normal! G
endfunction
function! scheme#eval_top_form()
let l:save_clipboard = &clipboard
set clipboard=
let l:save_reg = getreg('s')
@Olical
Olical / LICENSE.txt
Created June 28, 2012 09:33 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@Olical
Olical / cljs_namespace_tools.cljs
Created March 6, 2018 12:17
ClojureScript (node) to discover namespaces in a directory
(ns cljs-namespace-tools
(:require [clojure.tools.namespace.parse :as parse]
[cljs.tools.reader.reader-types :as reader-types]
[cljs-node-io.core :as io]
[cljs-node-io.fs :as fs]
[cljs.test :as t]))
(defn path-kind [path]
(cond
(fs/file? path) :file
@Olical
Olical / tree.cljc
Created September 16, 2017 11:18
Using clojure.spec to parse trees
(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
Olical / lzfn.clj
Created September 4, 2017 19:01
A function macro that yields the EXACT same function reference if the arguments and body LOOK the same.
;; 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#
fn#
(let [new-fn# (fn ~@forms)]
@Olical
Olical / compiled.js
Created June 1, 2011 20:53
Playing with Google closure
var h=void 0,i=null,n,o=this;function p(){}
function aa(a){var b=typeof a;if(b=="object")if(a){if(a instanceof Array)return"array";else if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if(c=="[object Window]")return"object";if(c=="[object Array]"||typeof a.length=="number"&&typeof a.splice!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("splice"))return"array";if(c=="[object Function]"||typeof a.call!="undefined"&&typeof a.propertyIsEnumerable!="undefined"&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if(b=="function"&&typeof a.call=="undefined")return"object";return b}function q(a){return aa(a)=="array"}function ba(a){var b=aa(a);return b=="array"||b=="object"&&typeof a.length=="number"}function r(a){return typeof a=="string"}function s(a){return aa(a)=="function"}function ca(a){a=aa(a);return a=="object"||a=="array"||a=="function"}function t(a){return a[da]||(a[da]=++ea)}var da="closure_uid_"+Math.floor(Math.random()*214748
@Olical
Olical / rvm.fish
Last active February 6, 2017 13:18
Changes to rvm.fish 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 rvm.fish.XXXXXXXXXX)
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')