Skip to content

Instantly share code, notes, and snippets.

@visibletrap
visibletrap / .vimrc.before
Created August 26, 2012 10:26
For using with janus on MacAir
let mapleader = ','
set gfn=Monaco:h13
(require '[clojure.reflect :as cr])
(cr/reflect java.lang.Math)
;{:bases #{java.lang.Object}, :flags #{:public :final}, :me ....
; If you want to list all the method names of given class do
(map :name (:members (cr/reflect java.lang.Math)))
;(round nextUp nextUp exp min cos acos max hypot ceil ulp ulp min floor
;cbrt getExponent IEEEremainder log10 min rint tanh copySign
;negativeZeroDoubleBits max sin negativeZeroFloatBits E max PI expm1
;cosh toDegrees signum signum sinh pow initRNG max round log
;(= (__ [1 2 3 4 5 6] 2) '((1 3 5) (2 4 6)))
;(= (__ (range 9) 3) '((0 3 6) (1 4 7) (2 5 8)))
;(= (__ (range 10) 5) '((0 5) (1 6) (2 7) (3 8) (4 9)))
(fn [coll n]
(sort-by first <
(map (fn [y] (filter #(= (mod % n) y) coll)) (range n))))
@visibletrap
visibletrap / min-path.clj
Created September 30, 2012 10:55
Finding min path with brute force
(defn min-path [ivec]
(letfn [(expand [in]
(loop [n 0 acc [[0]]]
(if (= n in)
acc
(recur
(inc n)
(reduce
concat
(#(map (fn [n] [(cons 0 n) (cons 0 (map inc n))]) %) acc))))))]
@visibletrap
visibletrap / gist:3897450
Created October 16, 2012 06:02 — forked from gcatlin/gist:1847248
Install specific version of Homebrew formula
brew update
brew versions FORMULA
cd `brew --prefix`
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions"
brew install FORMULA
brew switch FORMULA VERSION
git checkout -- Library/Formula/FORMULA.rb # reset formula
## Example: Using Subversion 1.6.17
#
@visibletrap
visibletrap / gist:4109142
Created November 19, 2012 05:45
VIM - save readonly file
:w !sudo tee %
@visibletrap
visibletrap / gist:4134190
Created November 23, 2012 05:59
What I miss from RubyMine when using VIM
- Command + b
- Grasp a word and search through project
- Go to gem directory from source file
- Auto save
@visibletrap
visibletrap / .vimrc.after
Created November 24, 2012 04:45
VIMRC for janus customization
set tags=~/.tags
set nonumber
set relativenumber
imap jk <esc>
imap kj <esc>
vmap <leader>F y :Ack <c-r>0<cr>
vmap > >gv
vmap < <gv
@visibletrap
visibletrap / .tmux.conf
Created November 27, 2012 13:43
TMUX config
set -g prefix C-a
bind-key a send-prefix
bind -n C-k send-keys -R \; clear-history
@visibletrap
visibletrap / .ackrc
Created November 28, 2012 13:55
Ack config file
--type-set=coffee=.coffee
--type-set=scss=.scss
--ignore-dir=tmp