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
[ | |
{ "code": "SC", "name": "South Carolina" }, | |
{ "code": "AL", "name": "Alabama" }, | |
{ "code": "NE", "name": "Nebraska" }, | |
{ "code": "WV", "name": "West Virginia" }, | |
{ "code": "ID", "name": "Idaho" }, | |
{ "code": "MO", "name": "Missouri" }, | |
{ "code": "AK", "name": "Alaska" }, | |
{ "code": "UT", "name": "Utah" }, | |
{ "code": "IA", "name": "Iowa" }, |
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
"Arkansas", | |
"Washington, D.C.", | |
"Delaware", | |
"Florida", | |
"Georgia", | |
"Kansas", | |
"Louisiana", | |
"Maryland", | |
"Missouri", | |
"Mississippi", |
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
var intcomma = function(value) { | |
// inspired by django.contrib.humanize.intcomma | |
var origValue = String(value); | |
var newValue = origValue.replace(/^(-?\d+)(\d{3})/, '$1,$2'); | |
if (origValue == newValue){ | |
return newValue; | |
} else { | |
return intcomma(newValue); | |
} | |
}; |
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
async = require 'async' | |
fs = require 'fs' | |
{filter, flatten} = require 'underscore' | |
OBJ_C_EPOCH = 978307200 | |
DROPBOX_DIR = #"<path to your dropbox folder >/Dropbox/Apps/Reporter-App/" | |
fs.readdir DROPBOX_DIR, (err, files) -> | |
throw new err if err? | |
dataFiles = filter files, (filename) -> /.json/.test filename |
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
var ctaColors = { | |
blue: '#00A1DE', | |
brown: '#62361B', | |
green: '#009B3A', | |
orange: '#F9461C', | |
pink: '#E27EA6', | |
purple: '#522398', | |
red: '#C60C30', | |
yellow: '#F9E300' | |
} |
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
function flashSupported(){ | |
if (window.ActiveXObject){ | |
try { | |
new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
} else { | |
return Array.from(navigator.plugins).some(function(plugin){ |
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
<script src="http://media.scpr.org/assets/scripts/webtrends.v2.js"></script> | |
<script> | |
//<![CDATA[ | |
var _tag=new WebTrends(); | |
_tag.dcsGetId(); | |
//]]> | |
</script> | |
<script> | |
//<![CDATA[ | |
_tag.dcsCustom=function(){ |
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
h = location.href | |
docStr = /^http:\/\/(\w*).github.com\/(\w*)(?:\/.*)?/ | |
codeStr = /^https?:\/\/github.com\/(\w*)\/(\w*)(?:\/.*)?/ | |
docTmp = "http://$user.github.com/$proj" | |
codeTmp = "https://github.com/$user/$proj" | |
isDoc = h.match(docStr) | |
isCode = h.match(codeStr) | |
redirect = (loc) -> |
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
# based on http://amix.dk/blog/post/19574 | |
from datetime import datetime, timedelta | |
GRAVITY = 0.5 # HN default: 1.8 | |
WINDOW = 36 # max age in hours | |
now = datetime.now() | |
def hours_from_dt(dt): |
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 os | |
import shutil | |
import urllib2 | |
import zipfile | |
from lxml import etree # requires lxml & friends | |
# TODO: | |
# - Total vote counts | |
# - County-level results |
NewerOlder