Skip to content

Instantly share code, notes, and snippets.

{
"version": "1",
"header": {
"title": "Improve Detroit: Submitted Issues",
"description": "This data set reflects parking violations reported by authorized agencies in Philadelphia. The data represented below is a sample of parking violations occurring between 2012-2015 with license plate numbers anonymized for privacy.",
"navigation": [
{
"label": "Download",
"url": "https://data.phila.gov/api/views/3bxz-a5sb/rows.csv?accessType=DOWNLOAD&bom=true"
}
@timwis
timwis / mass-commonwealth-connect.json
Last active September 30, 2015 01:14
Massachusetts Service Requests VizWit config
{
"version": "1",
"header": {
"title": "Improve Detroit: Submitted Issues",
"description": "This data set reflects parking violations reported by authorized agencies in Philadelphia. The data represented below is a sample of parking violations occurring between 2012-2015 with license plate numbers anonymized for privacy.",
"navigation": [
{
"label": "Download",
"url": "https://data.phila.gov/api/views/3bxz-a5sb/rows.csv?accessType=DOWNLOAD&bom=true"
}
@timwis
timwis / crime-incidents.v2.json
Last active October 23, 2015 17:49
Philadelphia Crime Incidents VizWit Config
{
"version": "2",
"header": {
"title": "Police Department",
"navigation": [
{
"label": "Download",
"url": "https://www.opendataphilly.org/dataset/crime-incidents"
}
]
@timwis
timwis / fire-statistics.json
Last active October 25, 2015 17:24
Fire Statistics VizWit
{
"version": "2",
"header": {
"title": "Fire Department"
},
"cards": [
{
"x": 0,
"y": 0,
"width": 12,
@timwis
timwis / prisons.json
Last active November 4, 2015 11:42
Prisons VizWit Config
{
"version": "2",
"header": {
"title": "Philadelphia Prison System",
"description": "Mission: To provide a secure correctional environment that adequately detains persons accused or convicted of illegal acts; to provide programs, services, and supervision in a safe, lawful, clean, humane environment; and to prepare incarcerated persons for reentry into society in a frame of mind that will facilitate their becoming law-abiding citizens."
},
"cards": [
{
"x": 0,
"y": 0,
@timwis
timwis / join.js
Created November 11, 2015 17:31
Join 2 JSON objects on common property in JavaScript
$.when(
$.getJSON('https://data.phila.gov/resource/bbgf-pidf.geojson'),
$.getJSON('https://data.phila.gov/resource/r24g-zx3n.json?%24select=count(*)%20as%20value%2C%20%3A%40computed_region_bbgf_pidf%20as%20label&%24group=%3A%40computed_region_bbgf_pidf&%24order=value%20desc')
).done(function(responseGeojson, responseData) {
var data = responseData[0]
var geojson = responseGeojson[0]
// Create hash table for easy reference
var dataHash = {}
data.forEach(function(item) {
var detectType = function(sample) {
if(moment(sample, moment.ISO_8601, true).isValid()) {
return 'datetime'
} else if(moment(sample, 'YYYY-MM-DD', true).isValid()) {
return 'date'
} else if(moment(sample, 'X', true).isValid()) {
return 'timestamp'
} else if( ! isNaN(sample) && sample.indexOf('.') !== -1) {
return 'float'
} else if( ! isNaN(sample)) {
import requests
import requests_mock
import pprint
pp = pprint.PrettyPrinter(indent=4)
session = requests.Session()
adapter = requests_mock.Adapter()
session.mount('mock', adapter)
@timwis
timwis / README.md
Created December 3, 2015 17:20
Fire Stats Sheet2

README is empty

@timwis
timwis / handsontable-ampersand.js
Last active December 22, 2015 12:46
Use an Ampersand Collection with Handsontable
var Handsontable = require('handsontable')
var AmpersandModel = require('ampersand-model')
var AmpersandRestCollection = require('ampersand-rest-collection')
var _ = require('lodash')
var Person = AmpersandModel.extend({
props: {
id: 'number',
name: 'string',
address: 'string'