Skip to content

Instantly share code, notes, and snippets.

View jaredgrady's full-sized avatar

Jared Grady jaredgrady

View GitHub Profile
@jaredgrady
jaredgrady / bin_search.py
Last active April 10, 2017 15:35
Binary search a list of ints. Recursive implementation in Python.
def bin_search(L, a):
if (len(L) == 1):
return "NO"
mid = len(L) // 2
if (a < L[mid]):
return bin_search(L[:mid], a)
elif (a > L[mid]):
return bin_search(L[mid:], a)
@jaredgrady
jaredgrady / battle-dex.ts
Last active June 29, 2018 01:45
battle-dex.ts
/**
* Pokemon Showdown Dex
*
* Roughly equivalent to sim/dex.js in a Pokemon Showdown server, but
* designed for use in browsers rather than in Node.
*
* This is a generic utility library for Pokemon Showdown code: any
* code shared between the replay viewer and the client usually ends up
* here.
*