Skip to content

Instantly share code, notes, and snippets.


Chris Vest chrisvest

View GitHub Profile
View .vimrc
syntax on
set background=dark
" Return cursor to the previous position when this file was open last
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
filetype plugin indent on
View gist:128317
module Rpn
import qualified Data.Map as Map
data Operator a = Unary (a -> a)
| Binary (a -> a -> a)
| Ternary (a -> a -> a -> a)
| Quaternary (a -> a -> a -> a -> a)
| Reductive ([a] -> a)
View clj
# Runs clojure.
# With no arguments, runs Clojure's REPL.
# Arguments starting with -J are unpack and passed to the JVM.
# Arguments -cp and -classpath are treated specially so we correctly
# build a classpath.
# If rlwrap is found, the java invocation is wrapped in it.
# For other arguments, the first is treated as a script name, the rest
# passed as command-line arguments.
View clj
if [ "-c" = "$1" ]; then
mkdir -p classes
java -cp .:classes:$CLOJURE_JAR -Dclojure.compile.path=classes clojure.lang.Compile "$2"
View gist:552253
; Generate random output from input seed-text, using a Markov chain.
MAXGEN = 10000
NONWORD = "\n"
prefix := HEAD
statetab = HashMap with-factory: (= Vector)
to start
View gist:906624
Install Caliper
$ mvn package && ./benchmark stormpot.benchmark.PartitionSelect
Compare ModuloAtomicCount with ModuloIdentityHashNewObject
- you may subtract ModuloConst from both if you want, or
ModuloIdentityHashThread from ModuloIdentityHashNewObject,
to remove a bit of the overhead.
View chrisvest-4clojure-solution28.clj
;; chrisvest's solution to
(fn squash [xs]
(if (sequential? xs)
(mapcat squash xs)
(list xs)))
View chrisvest-4clojure-solution29.clj
;; chrisvest's solution to
(fn [s] (apply str (filter #(Character/isUpperCase %) s)))
View chrisvest-4clojure-solution30.clj
;; chrisvest's solution to
(fn [xs]
(reduce (fn [v x] (if (= x (last v)) v (conj v x))) [] xs))
View chrisvest-4clojure-solution31.clj
;; chrisvest's solution to
#(partition-by identity %)
You can’t perform that action at this time.