This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Adapted from http://stackoverflow.com/a/8079681 | |
(defonce scrollbar-width | |
(let [inner (.createElement js/document "p") | |
outer (.createElement js/document "div")] | |
(doto (.-style inner) | |
(aset "width" "100%") | |
(aset "height" "500px")) | |
(doto (.-style outer) | |
(aset "position" "absolute") | |
(aset "top" "0px") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClojureScript:bugs-web.formatters> (def a (atom {})) | |
#<Atom: {}> | |
ClojureScript:bugs-web.formatters> (swap! a assoc :a 2 :b 3) | |
{:a 2, :b 3} | |
ClojureScript:bugs-web.formatters> (require '[reagent.core :as r]) | |
ClojureScript:bugs-web.formatters> (def r (r/atom {})) | |
#<Atom: {}> | |
ClojureScript:bugs-web.formatters> (def rc (r/cursor [:x] r)) | |
#<Cursor: [:x] #<Atom: {}>> | |
ClojureScript:bugs-web.formatters> (swap! rc assoc :y 3 :z 4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns factorial) | |
(defn factorials | |
"Generates an infinite sequence of factorials." | |
([] | |
(map first (factorials 1 2))) | |
([product counter] | |
(cons [product counter] | |
(lazy-seq (factorials (* product counter) (inc counter)))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"" This file needs to be at ~/.vim/after/ftplugin/clojure.vim | |
set lispwords+=as->,binding,bound-fn,case,catch,cond->,cond->>,condp,def,definline,definterface,defmacro,defmethod,defmulti,defn,defn-,defonce,defprotocol,defrecord,defstruct,deftest,deftest-,deftype,doseq,dotimes,doto,extend,extend-protocol,extend-type,fn,for,if,if-let,if-not,if-some,let,letfn,locking,loop,ns,proxy,reify,set-test,testing,when,when-first,when-let,when-not,when-some,while,with-bindings,with-in-str,with-local-vars,with-open,with-precision,with-redefs,with-redefs-fn,with-test,fact,facts,defproject,defroutes,context,GET,POST,PUT,UPDATE,DELETE,ANY,go-loop,go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-option -g default-command "reattach-to-user-namespace -l bash" # <- supposed to sort it globally, but doesn't always work for me | |
# Smart pane switching with awareness of vim splits | |
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L" | |
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D" | |
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U" | |
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R" | |
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l" | |
bind k confirm kill-session |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns coins) | |
(def heads (repeat 50 :H)) | |
(def tails (repeat 50 :T)) | |
(def flip {:H :T :T :H}) | |
(defn permutation [n] | |
[(concat (take n heads) (drop n tails)) | |
(concat (drop n heads) (take n tails))]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-option -g default-command "reattach-to-user-namespace -l bash" | |
# Smart pane switching with awareness of vim splits | |
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L" | |
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D" | |
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U" | |
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R" | |
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in `ls -1 ~/.vim/colors`; do | |
echo colorscheme $(echo $f | awk -F'.' '{print $1}') >> ~/.vimrc | |
echo ";; $(echo $f | awk -F'.' '{print $1}')" >> example.clj | |
vim example.clj | |
echo "that was $f" | |
sed '$d' ~/.vimrc > .vimrc.new | |
sed '$d' example.clj > example.new | |
mv .vimrc.new ~/.vimrc | |
mv example.new example.clj | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* 'p' pastes over lines rather than inserting new ones | |
* 'dd' doesn't work - it should call `evil-paredit-kill-line` | |
* can't map ad-hoc keybindings | |
* :e doesn't work from top-level of project, but level of current file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var d = document, body = d.querySelector('body'), popup = d.createElement('div'); | |
popup.className = 'call-centre-help'; | |
popup.style.visibility = 'hidden'; | |
popup.style.position = 'fixed'; | |
popup.style["z-index"] = 100000; | |
popup.style["background-color"] = "blue"; | |
popup.style.color = "white"; |