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
### Keybase proof | |
I hereby claim: | |
* I am adambard on github. | |
* I am adambard (https://keybase.io/adambard) on keybase. | |
* I have a public key whose fingerprint is D7B0 3610 4BA0 86AA 366A 2733 2E89 85DE 39A5 2FFC | |
To claim this, I am signing this object: |
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
// Chart.redraw | |
redraw: function (animation) { | |
var chart = this, | |
//... | |
series = chart.series, | |
//... | |
; | |
// ...<snip>... |
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 csv | |
from collections import defaultdict | |
with open('/Users/adam/Downloads/languages-2014.csv', 'r') as f: | |
results_2014 = [row for row in csv.reader(f)][1:] | |
with open('/Users/adam/Downloads/languages-2013.csv', 'r') as f: | |
results_2013 = [row for row in csv.reader(f)][1:] | |
with open('/Users/adam/Downloads/languages-2012.csv', 'r') as f: |
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
(ns parsley.core | |
(:require [net.cgrand.parsley :as p])) | |
(def parse (p/parser {:main :blat*} :blat #{["{{" #"[a-zA-Z_\-]*" "}}"]})) | |
(defmulti render-node (fn [node _] (:tag node))) | |
; Pull out the middle bit and look it up in the context | |
(defmethod render-node :blat [node context] | |
(get context (nth (:content node) 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
(ns redditlater.analysis | |
(:import | |
java.util.Date | |
java.util.Calendar | |
java.util.TimeZone | |
java.util.SimpleTimeZone | |
) | |
(:require | |
[somnium.congomongo :as mongo] | |
[redditlater.reddit-api :as api] |
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 random | |
from collections import deque | |
class Card(object): | |
def __init__(self, cost): | |
self.cost = cost | |
def __eq__(self, other): | |
return isinstance(other, self.__class__) and self.cost == other.cost | |
def __cmp__(self, other): |
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
(ns hearthstone-stats | |
(:require [clojure.data.json :as json] | |
[clojure.java.io :as io] | |
[clojure.string :as s])) | |
(defn get-results [] | |
(json/read-str (slurp "results.json") :key-fn keyword)) | |
(def uncounted-cards #{"Reinforce", "Lesser Heal", "Shapeshift", "The Coin", "Armor Up!", "Totemic Call", "Steady Shot", "Life Tap", "Dagger Mastery", "Fireblast"}) |
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
from base import * | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
PROJECT_DIR = "/path/to/project/directory/" | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. |
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
""" | |
A simpler pivot table for non-python people. | |
Pythonisms present: | |
1. You can iterate over a list of tuples using `for ... in` and map each tuple to a variable. | |
2. Dicts exist and are great. | |
3. Iterating over a dict returns the key. | |
4. Attempting to access a variable that doesn't exist in a dict raises a KeyError. |
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 find_largest_contiguous_region(countsarray): | |
""" | |
Find the contiguous regions in countsarray using the modified | |
flood count algorithm described in get_flood_count | |
""" | |
Q = countsarray.copy() | |
points_checked = [] | |
rows, cols = Q.shape |
OlderNewer