This file contains 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
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
set-window-option -g mode-keys vi | |
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" |
This file contains 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
//Copy and paste in your console | |
/** Calls a reducing function recursively in each item of the array. | |
If the item is an array, it gets reduced - otherwise, the item is returned. | |
*/ | |
function flatten(maybeArray){ | |
if(Array.isArray(maybeArray)){ | |
const initialValue = [] | |
return maybeArray.reduce( | |
(accumulator,current) => accumulator.concat( flatten(current) ), |
This file contains 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
let mapleader = "\<Space>" | |
" Some servers have issues with backup files, see #649 | |
set nobackup | |
set nowritebackup | |
" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable | |
" delays and poor user experience | |
set updatetime=300 |
This file contains 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
#svim: searches for an expression in a git repo and edits each result in a tab | |
function svim() { | |
RES="$(git grep -l "$1" | wc -l)" | |
CONF_MSG="Do you wish to edit these ${RES} results? (y/n)" | |
read -p "${CONF_MSG}" choice; | |
case "$choice" in | |
y|Y ) vim -p `git grep -l "$1"`;; | |
n|N ) echo "exiting";; | |
* ) echo "exiting"; | |
esac |
This file contains 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
type MultiValue | |
= StringValue String | |
| IntegerValue Int | |
--... add other possibilities here | |
myList : List MultiValue | |
myList = | |
[ StringValue "a" |
This file contains 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
import pandas as pd | |
data = pd.DataFrame([ | |
["Team A",1,0], | |
["Team B",0,1]], | |
columns=["Team","Attribute A","Attribute B"]) | |
pd.get_dummies(data) | |
#Output will be: | |
# Attribute A Attribute B Team_Team A Team_Team B |
This file contains 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
//Extract SVG: three lines of JavaScript that allow you to extract the contents | |
//of a SVG <object> tag into your DOM | |
//After the extraction you are able to select the inner elements of the SVG with CSS and JS | |
//It replaces the original <object> tag with its raw SVG | |
//el: a DOM element | |
//eg. el = document.querySelector('#elementId') | |
//extractSvg(el) | |
//You might also place an onload attribute in your object to force its extraction when possible |