Skip to content

Instantly share code, notes, and snippets.

View jeremyjbowers's full-sized avatar

Jeremy Bowers jeremyjbowers

View GitHub Profile
@jeremyjbowers
jeremyjbowers / thanksgiving_2016.md
Last active November 25, 2015 02:56
Thanksgiving 2016

Pumpkin Pie

Ingredients

  • 1 c. light-brown sugar
  • 1 tbsp. cornstarch
  • 0.5 tsp. salt
  • 1 tsp. ground ginger
  • 1 tsp. ground cinnamon
  • pinch ground cloves
  • 1.5 c. fresh Pumpkin Puree or canned
@jeremyjbowers
jeremyjbowers / actions.py
Created November 24, 2015 21:47
Export to CSV for Django admin
import csv
from django.http import HttpResponse
def export_as_csv_action(description="Export selected objects as CSV file", fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'exclude' work like in django ModelForm
'header' is whether or not to output the column names as the first row
"""
def export_as_csv(modeladmin, request, queryset):
@jeremyjbowers
jeremyjbowers / rdio.csv
Created November 18, 2015 14:00
Every song in my favorites list of Rdio in alphabetical order.
We can't make this file beautiful and searchable because it's too large.
Name,Artist,Album,Track Number
""Can't Repeat The Past?"","Leonardo Dicaprio, Tobey Maguire","Music From Baz Luhrmann's Film The Great Gatsby (Deluxe Edition)","10"
""Gatsby Believed In The Green Light"","Tobey Maguire, Craig Armstrong","Music From Baz Luhrmann's Film The Great Gatsby (Deluxe Edition)","21"
""I Like Large Parties"","Elizabeth Debicki","Music From Baz Luhrmann's Film The Great Gatsby (Deluxe Edition)","7"
""In The Case Django, After You..."","Christoph Waltz, Jamie Foxx","Quentin Tarantino’s Django Unchained Original Motion Picture Soundtrack","4"
""In mir klingt ein Lied" (After Chopin Étude in E major, Op.10 No.3)","Joseph Calleja, BBC Concert Orchestra, Steven Mercurio","Amore","18"
""Net, tolko tot, kto znal" (None But The Lonely Heart); Op.6, No.6","Joseph Calleja, BBC Concert Orchestra, Steven Mercurio","Amore","17"
"#34","Dave Matthews Band","Under the Table and Dreaming (Expanded Edition)","12"
"#36","Dave Matthews Band","Live At Red Rocks 8.15.95","14"
"#41","Dave Matthews Band","Cras
@jeremyjbowers
jeremyjbowers / quiz.md
Last active November 5, 2015 01:07
Quiz questions for Week 9

1. Why do you think it's important to show empathy when we display data?

2. Google's Material Design uses our physical world to guide how it shows elements, e.g., depth and movement. How do you think this affects Google's products?

@jeremyjbowers
jeremyjbowers / classes_departments.py
Last active November 5, 2015 00:42
All classifications and departments.
CLASSES = [u'A&D Architectural Drawing', u'A&D Architectural Model', u'Media', u'Textile', u'Film (object)', u'Print', u'Performance', u'A&D Photograph', u'Multiple', u'Painting', u'Illustrated Book', u'Photography Research/Reference', u'A&D Mies van der Rohe Archive', u'Photograph', u'Installation', u'A&D Graphic Design', u'(not assigned)', u'Audio', u'Sculpture', u'Drawing', u'Collage', u'A&D Design', u'Video', u'Work on Paper', u'Periodical', u'Film']
DEPARTMENTS = [u'Photography', u'Fluxus Collection', u'Painting & Sculpture', u'Drawings', u'Prints & Illustrated Books', u'Architecture & Design', u'Media and Performance Art', u'Architecture & Design - Image Archive', u'Film']
@jeremyjbowers
jeremyjbowers / week8.md
Created October 29, 2015 01:50
This is unfinished, but I want y'all to have it.

Okay, first, let's add a route to your app.py. A route ties a URL path, in this case "/" which means "the base URL of my web site", to a function that renders and returns a template.

URL => function => template => response to the client

from flask import Flask, render_template, request
from models import Artwork

app = Flask(__name__)
@jeremyjbowers
jeremyjbowers / week6-2015.md
Last active October 14, 2015 23:58
Week 6: Setting up a virtualenv, installing software, connecting to a database, loading data, making queries.

Clear old app and start a new app.

  • Delete your web app.
  • Click "add a new web app"
  • Click "next"
  • Select "manual configuration"
  • Select Python 2.7
  • Click "next"

Set up a virtualenv.

  • Click "Consoles"
@jeremyjbowers
jeremyjbowers / amari.json
Created August 28, 2015 16:14
Wanna see these Amari as JSON? Of course you do.
[{"price": 74.99, "detail_url": "https://www.chambersstwines.com/Products/35902/achino-nv-amaro-elixir-di-china-1-l", "name": "Achino NV Amaro Elixir di China 1 L"}, {"price": 49.99, "detail_url": "https://www.chambersstwines.com/Products/35903/acossato-amaro-camomilla-1-l", "name": "Acossato Amaro Camomilla 1 L"}, {"price": 149.99, "detail_url": "https://www.chambersstwines.com/Products/35904/alpicella-amaro-32-herbs-1-l", "name": "Alpicella Amaro 32 Herbs 1 L"}, {"price": 59.99, "detail_url": "https://www.chambersstwines.com/Products/35905/americano-tom-amaro-rabarbaro-1-l", "name": "Americano Tom Amaro Rabarbaro 1 L"}, {"price": 59.99, "detail_url": "https://www.chambersstwines.com/Products/35907/barbieri-amaro-elixir-di-china-1-l", "name": "Barbieri Amaro Elixir di China 1 L"}, {"price": 59.99, "detail_url": "https://www.chambersstwines.com/Products/35908/blasius-amaro", "name": "Blasius Amaro"}, {"price": 49.99, "detail_url": "https://www.chambersstwines.com/Products/35909/bonomelli-amaro-elixir-camonmil
@jeremyjbowers
jeremyjbowers / citation.txt
Last active October 9, 2018 13:31
The Segal-Cover scores and confirmation votes of confirmed Supreme Court justices. Does not include candidates who were not confirmed. Reproduced from http://www.stonybrook.edu/commcms/polisci/jsegal/QualTable.pdf
Segal-Cover data updated and backdated by Jeffrey Segal in 2012. Originally published as Jeffrey Segal and Albert Cover, “Ideological Values and the Votes of Supreme Court Justices,” American Political Science Review 83:557-565 (1989)
Original data table here: http://www.stonybrook.edu/commcms/polisci/jsegal/QualTable.pdf
SCDB justice data updated by the Supreme Court Database at Washington University in St. Louis. Harold J. Spaeth, Lee Epstein, Andrew D. Martin, Jeffrey A. Segal, Theodore J. Ruger, and Sara C. Benesh. 2016 Supreme Court Database, Version 2015 Release 02. URL: http://Supremecourtdatabase.org
Original data table here: http://scdb.wustl.edu/documentation.php?var=justice