Starting with the most recent election look at the data files.
Document fields
- names
- types
- formatting conventions.
"""AP client that reads data from file instead of from the AP FTP server""" | |
import os | |
from elections import AP | |
class MockFTP(object): | |
def quit(self): | |
pass |
#!/usr/bin/env python | |
import csv | |
import sys | |
import click | |
def underlines(fieldnames): | |
underlines = [] | |
for fieldname in fieldnames: |
#!/usr/bin/env python | |
import argparse | |
import xlrd | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description='Extract rows from an Excel ' | |
'file.') | |
parser.add_argument('filename', nargs=1, |
<!doctype html> | |
<html> | |
<head></head> | |
<body> | |
<div id="chart"></div> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script> | |
var ENDPOINT_ROOT = 'http://chicagorains.com/api/hourlyPrecip/'; | |
function getURL(date, location) { |
// | |
// Read temperature from a TMP102 sensor and push to Xively | |
// | |
#include <SPI.h> | |
#include <WiFly.h> | |
#include <Wire.h> | |
const char ssid[] = "BigBabyBoy"; |
// Use a Radio Shack 273-059 piezo buzzer as a shock sensor | |
// Based on recipe from http://www.eng.utah.edu/~cs5789/handouts/piezo.pdf | |
// and the Knock example (http://arduino.cc/en/Tutorial/Knock) | |
const int ledPin = 13; // Built in LED is pin 13 | |
const int piezoPin = 0; // Piezoelectric element is attached to analog pin 0 | |
const int threshold = 7; // Ignore readings below this value; | |
const int delayTime = 500; // HTime to pause during each loop | |
int val, t; |
from django.utils.html import strip_tags | |
from storybase_asset.models import HtmlAsset | |
assets = HtmlAsset.objects.filter(stories__status='published') | |
total_length = 0 | |
for asset in assets: | |
# Strip HTML from the body to more accurately reflect visible length | |
total_length += len(strip_tags(asset.body)) | |
avg_length = total_length / assets.count() |
<!DOCTYPE html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<div id="app"> | |
</div> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="tabletop.js"></script> |
#!/usr/bin/env python | |
# Create a fixture of all HtmlAsset models that include 'script' in the | |
# body | |
# Usage: dump_script_assets.py | python -mjson.tool > script_assets.json | |
from django.core.management import setup_environ | |
# Edit this to use a particular settings module | |
import settings.dev | |
setup_environ(settings.dev) |