Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| # First install tmux | |
| brew install tmux | |
| # For mouse support (for switching panes and windows) | |
| # Only needed if you are using Terminal.app (iTerm has mouse support) | |
| Install http://www.culater.net/software/SIMBL/SIMBL.php | |
| Then install https://bitheap.org/mouseterm/ | |
| # More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| (ns miner.roman | |
| (:require [clojure.test :refer :all])) | |
| ;; inspired by | |
| ;; http://www.jayway.com/2012/08/04/a-decimal-to-roman-numeral-converter-in-just-a-few-lines/ | |
| (def roman-map {1000 "M" 900 "CM" 500 "D" 400 "CD" | |
| 100 "C" 90 "XC" 50 "L" 40 "XL" | |
| 10 "X" 9 "IX" 5 "V" 4 "IV" 1 "I"}) |
| ;; Big thanks to Christophe Grand - https://groups.google.com/d/msg/clojure/L1GiqSyQVVg/m-WJogaqU8sJ | |
| (defn scaffold [iface] | |
| (doseq [[iface methods] (->> iface .getMethods | |
| (map #(vector (.getName (.getDeclaringClass %)) | |
| (symbol (.getName %)) | |
| (count (.getParameterTypes %)))) | |
| (group-by first))] | |
| (println (str " " iface)) | |
| (doseq [[_ name argcount] methods] | |
| (println |
| (ns net.cgrand.decay | |
| "Exponentially decaying lists. See http://awelonblue.wordpress.com/2013/01/24/exponential-decay-of-history-improved/ | |
| for background and http://clj-me.cgrand.net/2013/02/12/decaying-lists-log-scale-for-lists/ for documentation") | |
| ;; PRNG, formulas straight from java.util.Random javadoc | |
| (defn- seed ^long [^long n] | |
| (bit-and (unchecked-multiply n 0x5DEECE66D) | |
| (unchecked-dec (bit-shift-left 1 48)))) | |
| (defn- next-seed ^long [^long seed] |
| ; Stumbling towards Y (Clojure Version) | |
| ; | |
| ; (this tutorial can be cut & pasted into your IDE / editor) | |
| ; | |
| ; The applicative-order Y combinator is a function that allows one to create a | |
| ; recursive function without using define. | |
| ; This may seem strange, because usually a recursive function has to call | |
| ; itself, and thus relies on itself having been defined. | |
| ; | |
| ; Regardless, here we will stumble towards the implementation of the Y combinator. |
| ;; I wrote this in the Eurostar on my way back from the last lambdanext.eu clojure course. | |
| (ns comprehensions | |
| (:refer-clojure :exclude [for doseq]) | |
| (:require [clojure.core.reducers :as r])) | |
| ;; borrowed from clojure.core | |
| (defmacro ^{:private true} assert-args | |
| [& pairs] | |
| `(do (when-not ~(first pairs) |
| (ns schema->gen | |
| "Functions for generating test data from schemas." | |
| (:require [four.stateful :as four] | |
| [re-rand :refer [re-rand]] | |
| [schema.core :as sch] | |
| [simple-check.generators :as gen])) | |
| (defn ^:private re-randify-regex | |
| "schema requires ^$ while re-rand forbids them" | |
| [re] |
| (in-ns 'eclj.core) | |
| (defprotocol Fn | |
| :on-interface clojure.lang.Fn | |
| "Marker interface indicating invokeables that are explictly functions") | |
| (defprotocol IFn | |
| :on-interface clojure.lang.IFn | |
| (^{:on :invoke} -invoke | |
| [this] |
| (require '[clojure.core.async :as a]) | |
| (def xform (comp (map inc) | |
| (filter even?) | |
| (dedupe) | |
| (flatmap range) | |
| (partition-all 3) | |
| (partition-by #(< (apply + %) 7)) | |
| (flatmap flatten) | |
| (random-sample 1.0) |