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
class BasicObject | |
def to_donut | |
:donut | |
end | |
end | |
## Usage | |
3.to_donut #=> :donut | |
nil.to_donut #=> :donut |
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
{- | given two positions in a list, swap them. | |
if (at least) one of the positions is invalid, return Nothing. | |
Examples: | |
>>> swapL 0 2 [0..5] | |
Just [2,1,0,3,4,5] | |
>>> fmap (take 6) $ swapL 0 2 [0..] | |
Just [2,1,0,3,4,5] |
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
{-- | List the sub-sequences of conscutives elements in the list such that the | |
sum of the element is equal to the given number. | |
Examples: | |
>>> matchingSub 10 [1..5] | |
[[1,2,3,4]] | |
>>> matchingSub 2 $ replicate 3 1 | |
[[1,1],[1,1]] |
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
{-| Keep equal elements that are at the same position in both lists | |
Examples: | |
>>> keepEqual "hello" "world" | |
"l" | |
>>> keepEqual (repeat 1) [0..10] | |
[1] |
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"; |
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
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
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
(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" # <- 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 |