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 requests | |
from BeautifulSoup import BeautifulSoup | |
from datetime import datetime | |
import pdb | |
''' | |
To use: | |
num_pages_to_follow = 85 | |
scraper = EmmaScraper('CAP APPREC') |
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 django.contrib.gis.geos import Point | |
from django.contrib.gis.gdal import DataSource | |
import random | |
import csv | |
def dotdensity(shape_id_key=None, col_id_key=None,\ | |
shapefilepath=None, datafilepath=None, outputfilepath=None, filter_map=None): | |
reader = list(csv.reader(open(datafilepath, 'rb'))) | |
header = reader[0] |
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 type="text/javascript" charset="utf-8"> | |
var map = null; | |
var ft_id = 1964047; | |
var precinct_ft = 1979379; | |
var directionsService = new google.maps.DirectionsService(); | |
var directionsDisplay = new google.maps.DirectionsRenderer(); | |
var geocoder = new google.maps.Geocoder(); | |
var cur_marker = null; | |
var selected_address = ""; | |
var layer = null; |
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 django.core.management.base import BaseCommand, CommandError | |
from django.core.cache import cache | |
from django.test.client import Client | |
from django.test.client import RequestFactory | |
class Command(BaseCommand): | |
def handle(self, *args, **options): | |
cache.clear() |
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 clrs = [colorbrewer.Reds[7][3], colorbrewer.Reds[7][5], colorbrewer.Reds[7][7]]; | |
var color = d3.scale.quantize() | |
.domain(minmax) | |
.range(clrs); |
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 slugify = function(input){ | |
return input | |
.toLowerCase() | |
.replace(/ /g,'-') | |
.replace(/[^\w-]+/g,''); | |
}; |
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
/************************************************************************** | |
* OSM2GEO - OSM to GeoJSON converter | |
* OSM to GeoJSON converter takes in a .osm XML file as input and produces | |
* corresponding GeoJSON object. | |
* | |
* AUTHOR: P.Arunmozhi <aruntheguy@gmail.com> | |
* DATE : 26 / Nov / 2011 | |
* LICENSE : WTFPL - Do What The Fuck You Want To Public License | |
* LICENSE URL: http://sam.zoy.org/wtfpl/ | |
* |
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 margin = {top: 20, left: 50, right: 50, bottom: 50}, | |
w = 700 - margin.left - margin.right, | |
h = 500 - margin.top - margin.bottom; | |
var ygetter = function(d){return d.value;}; | |
var f = d3.format(",.0f"); | |
var barPadding = 10; | |
var colWidth = (w / data.length) - barPadding; | |
var colSpace = w / data.length; |
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 legend = function(r, notes, fmt, label, points){ | |
notes.append("svg:circle") | |
.attr("cy", 40 + r(points[2])) | |
.attr("cx", 0) | |
.attr("r", r(points[2])) | |
.style("stroke", "#444455") | |
.style("stroke-width", "1") | |
.style("fill", "none"); | |
notes.append("svg:circle") | |
.attr("cy", 40 + r(points[1])) |
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
/* | |
requires: phantomjs, async | |
usage: phantomjs index.js | |
*/ | |
var async = require('async'); | |
var sites = [ | |
['zaller', 'https://www.baycitizen.org/blogs/sandbox/digital-maps-low-cost-fighting-wildfires/'], | |
['binladen-pg-2', 'https://www.baycitizen.org/news/osama-bin-laden/san-francisco-vs-usa-rift-emerges-bin/?page=1'], |