Skip to content

Instantly share code, notes, and snippets.

View eyeseast's full-sized avatar

Chris Amico eyeseast

View GitHub Profile
@eyeseast
eyeseast / gist:9572554
Created March 15, 2014 19:30
Some random text, generated from inaugural addresses, as I start into the NLTK book.
Fellow - Citizens , there are vacant chairs . It had not passed , and
poetry , and , as I believe that our future shall belong to a
developing menace , but because it happens to be made by the same time
freedom from alarm on the 3d of July . In conclusion , I spoke to us
from the hearts of my constant aim to observe a careful discretion not
thereby to discharge an immense public debt already incurred and to
such actual expenditures as the manufactures of our revenue laws , the
States and the Union of
@eyeseast
eyeseast / freire.json
Created March 20, 2014 18:38
The Paolo Freire Charter School draws students from these six districts.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eyeseast
eyeseast / readme.md
Created March 31, 2014 02:31
Loader scripts, worst practices

Things we do wrong

We write giant, do-everything functions. One function to rule them all.

We write code first, then document it later. We don't document what fieldnames we're expecting, which means we have to reverse-engineer our own code in a year when we have to do this again.

We don't write tests. Instead, we test imports with live data, in a live database.

Since we didn't write tests, we didn't test that the import works when run twice, which means we get duplicates.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eyeseast
eyeseast / enrollment.html
Created August 22, 2014 22:54
Enrollment.xls (but really HTML)
<html
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
>
<head>
<title>Title</title>
<style>
<!--table
@eyeseast
eyeseast / make.md
Last active August 29, 2015 14:05
How to make make...

Using [Massachusetts school enrollment data][data] as an example:

  1. Loop through a list of years, downloading a spreadsheet for each one.

  2. Each spreadsheet is a weird Excel-as-HTML format, so I need to process each with a Python script to convert to CSV format.

  3. I only want Boston schools, not the whole state, so I need to filter each file using [csvgrep][]

  4. Run the resulting files through another Python script to load them into a database using [dataset][]

---------------------------------------------------------------------------
ProgrammingError Traceback (most recent call last)
<ipython-input-32-462a0d0628c1> in <module>()
----> 1 trip.save()
/Users/chrisamico/code/python/rome/lib/python2.7/site-packages/django/db/models/base.pyc in save(self, force_insert, force_update, using, update_fields)
588
589 self.save_base(using=using, force_insert=force_insert,
--> 590 force_update=force_update, update_fields=update_fields)
591 save.alters_data = True
@eyeseast
eyeseast / countdown.py
Created September 29, 2014 01:30
Showing a kid how programming works
#!/usr/bin/env python
import sys
import os
import time
def countdown(message='Happy New Year!'):
for count in range(10, 0, -1):
print count
os.system('say %s' % count)
time.sleep(.3)
@eyeseast
eyeseast / design.md
Created May 28, 2015 18:42
Design principles

An incomplete list of principles I try to stick to when designing news experiences and interactive applications:

Everything needs a path in and a path out.

Let a user folow their curiosity, without hitting a dead end. There should always be somewhere to go next.

Questions to answer for every view: Why am I here? What can I do here?

@eyeseast
eyeseast / names.py
Created July 29, 2015 13:30
Name combinations
"""
A little python to compare possible baby names, using lists of possible first and middle names
"""
first = [...]
middle = [...]
def combinations(first, middle):
for i in first:
for j in middle: