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 | |
if has("gui_running") | |
set guifont=Source\ Code\ Pro\ for\ Powerline:h12 | |
set linespace=3 | |
endif | |
set rtp+=~/.vim/bundle/vundle |
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
// Minesweeper.cc | |
// Evan Sebastian <[email protected]> | |
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
int count9(vector<vector<char> >& mine, int i, int j) { | |
int c = 0; | |
int w = (int)mine[0].size(); |
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
// Crypt Kicker | |
// Evan Sebastian <[email protected]> | |
#include <cstdio> | |
#include <iostream> | |
#include <stack> | |
#include <string> | |
#include <sstream> | |
#include <set> | |
#include <vector> |
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
module Main where | |
import Data.Char | |
import Data.Map | |
-- Shunting - Yard algorithm for Reverse Polish Notation | |
data Token = Number Int | ParenOpen | ParenClose | |
| AddOp | MulOp | DivOp | SubOp | |
deriving (Show, Eq) |
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
data Tree a = Leaf | |
| Node Integer (Tree a) a (Tree a) | |
deriving (Show, Eq) | |
foldTree :: [a] -> Tree a | |
foldTree [] = Leaf | |
foldTree xs = Node height | |
(foldTree $ take half xs) | |
(xs !! half) | |
(foldTree $ drop (half + 1) xs) |
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
-- Try to guess what divide does! | |
divide:: (Integral a) => [a] -> [[a]] | |
divide = f1 . f2 where | |
f1 = foldr f3 [] | |
f2 = map (:[]) | |
f3 x acc | |
| null acc = x : acc | |
| (head x * head (head acc)) > 0 = (x ++ head acc) : tail acc | |
| otherwise = x : acc |
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
TARGET=TARGET_NAME | |
CC=clang++ | |
CFLAG=-Wall -O3 -g -DNDEBUG | |
SRC=$(shell find . -name *.cpp) | |
OBJ=${SRC:.cpp=.o} | |
all: $(OBJ) | |
./$(TARGET) $(TARGET).input $(TARGET).output | |
diff $(TARGET).output $(TARGET).model |
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 sys | |
DEBUG = True | |
INFINITY = 99999 | |
def debug(var): | |
if DEBUG: | |
sys.stderr.write(repr(var) + "\n") | |
def make_adjacent(graph, people, paper): |
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
def ugly_pascal_triangle(level): | |
table = [] | |
for row in range(level): | |
for col in range(level): | |
if row == 0: | |
table.append([]) | |
if col == 0 or row == col: | |
table[row].append(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
import Control.Monad.State.Lazy | |
import Control.Monad.Error | |
import Control.Monad.Identity | |
import Control.Applicative | |
import Data.Char | |
-- Begin parser | |
type Parser a = StateT String (ErrorT String Identity) a |
OlderNewer