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
{ | |
"name": "Ultimate Workout Playlist", | |
"description": "From 538's Reporting http://fivethirtyeight.com/features/the-ultimate-workout-playlist/", | |
"tracks": [ | |
{ | |
"name": "Panda", | |
"artist": "Desiigner" | |
}, | |
{ | |
"name": "'Till I Collapse", |
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
#!/usr/bin/env python3 | |
import sys | |
import json | |
import re | |
import os | |
def find_date(doc_text): | |
""" | |
This may be fragile. Though im not sure what part of this wont be fragile... | |
Basically look for the key phrase that suggests when the meeting will be and extract the date |
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 test_end_to_end(ccs_host): | |
content = "I am the batman and I fight the joker" | |
content_id = "contentOne" | |
sub_content_id = "subcontent" | |
near_matcher_id = "nearMatcher" | |
batman_id = "batmanId" | |
joker_id = "jokerId" | |
batman_name = "batmanMatcher" | |
joker_name = "jokerMatcher" | |
field = "document" |
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
class TestEvent(unittest.TestCase): | |
name = "Invention of the telegraph" | |
event_id = 1 | |
description = "Samuel Morse patents his telegraph" | |
event_time = datetime(1840, month=6, day=20) | |
event_object = HistoricalEvent( | |
event_id, | |
name, |
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 json | |
from dateutil import parser | |
class HistoricalEvent(object): | |
def __init__(self, event_id, name, description, event_time): | |
""" | |
:type id: int | |
:type name: str | |
:type description: str | |
:type event_time: datetime.datetime |
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
bachmann@jabberwocky ~ python | |
Python 2.7.9 (default, Dec 15 2014, 10:34:27) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> dog = u"I am\u00A06011000990139424\u00A0creditCard" | |
>>> type(dog) | |
<type 'unicode'> | |
>>> dog.encode('base64') | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> |
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 flask import Flask, url_for, redirect | |
from flask_dance.consumer import OAuth2ConsumerBlueprint | |
app = Flask(__name__) | |
app.secret_key = "<ISHOULDBESOMETHING>" | |
batman_example = OAuth2ConsumerBlueprint( | |
"batman-example", __name__, | |
client_id="<CLIENT_ID>", | |
client_secret="<SECRET>", | |
base_url="https://graph.facebook.com", |
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
package main | |
import "fmt" | |
func main() { | |
defer fmt.Println("world") | |
fmt.Println("hello") | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 os import path | |
import sys | |
from wordcloud import WordCloud | |
d = path.dirname(__file__) | |
# Read the whole text. | |
text = open(path.join(d, sys.argv[1])).read() | |
wordcloud = WordCloud().generate(text) | |
wordcloud.to_file(path.join(d, "repo.png")) |