Skip to content

Instantly share code, notes, and snippets.

@danielsz
danielsz / pushState.cljs
Last active July 15, 2016 15:13
PushState (via Html5History from google closure) with secretary, a client-side routing library for clojurescript. Allows to map absolute urls with routes without the hash-bang hackery.
(def history (Html5History.))
(.setUseFragment history false)
(.setPathPrefix history "")
(.setEnabled history true)
(let [navigation (listen history EventType/NAVIGATE)]
(go
(while true
(let [token (.-token (<! navigation))]
(secretary/dispatch! token)))))
@scottdw
scottdw / stats.clj
Created June 20, 2012 14:07
Some helper functions in Clojure for statistics
(ns stats)
(defn mode [vs]
(let [fs (frequencies vs)]
(first (last (sort-by second fs)))))
(defn quantile
([p vs]
(let [svs (sort vs)]
(quantile p (count vs) svs (first svs) (last svs))))
@jwreagor
jwreagor / EmacsKeyBinding.dict
Created March 20, 2014 18:41
Global Emacs Key Bindings for OS X
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
* BEWARE:
* This file uses the Option key as a meta key. This has the side-effect
* of overriding Mac OS keybindings for the option key, which generally