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
# make directory and change working directory to it | |
function mcd { | |
if [ $# -ne 1 ]; then | |
echo "Usage: mcd <directory-name>" | |
return | |
fi | |
mkdir $1 | |
cd $1 | |
} |
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
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'mattn/emmet-vim' |
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
vector<pair<int, int>> getThem() { | |
vector<pair<int, int>> v; | |
for (pair<int, int> x : theList) { | |
if (x.second == 4) { | |
v.push(x); | |
} | |
} | |
return v; |
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
vector<pair<int, int>> getThem() { | |
vector<pair<int, int>> v; | |
for (pair<int, int> x : theList) { | |
if (x.second == 4) { | |
v.push(x); | |
} | |
} | |
return v; |
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
vector<Cell> findCells(const vector<Cell>& gameBoard, const int FLAG_CODE) { | |
vector<Cell> cells; | |
for (Cell cell : gameBoard) { | |
if (cell.status == FLAG_CODE) { | |
cells.push_back(cell); | |
} | |
} | |
return cells; |
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
int hash(string input) { | |
int output = 5381; | |
// Less collisions than simply adding ASCII characters of value | |
// simple method: hash("tab") = hash("bat") | |
// this method: hash("tab") != hash("bat") | |
for (char c : input) { | |
output += (output << 5) + c; | |
} | |
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
vector<pair<int, int>> findCells(const vector<pair<int, int>>& gameBoard, const int FLAG_CODE) { | |
if (gameBoard.empty()) { | |
return vector<pair<int, int>> {}; | |
} | |
vector<pair<int, int>> cells; | |
for (pair<int, int> cell : gameBoard) { | |
if (cell.second == FLAG_CODE) { | |
cells.push_back(cell); |
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
alias extract='tar xvzf' |
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
function extract { | |
if [ -z "$1" ]; then | |
# display usage if no parameters given | |
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>" | |
else | |
if [ -f $1 ] ; then | |
# NAME=${1%.*} | |
# mkdir $NAME && cd $NAME | |
case $1 in | |
*.tar.bz2) tar xvjf ./$1 ;; |
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
# Functions. | |
# These are like aliases, but can take arguments | |
# All functions are in ~/.bash_functions for modularity | |
if [ -f ~/.bash_functions ]; then | |
. ~/.bash_functions | |
fi |