Skip to content

Instantly share code, notes, and snippets.

Tim Wisniewski timwis

Block or report user

Report or block timwis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timwis
timwis / parking-violations.v2.json
Last active Dec 27, 2016
Parking Violations VizWit configuration
View parking-violations.v2.json
{
"version":"2",
"header":{
"title":"Parking Violations",
"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.json
Last active Dec 27, 2016
VizWit - Carto - Philadelphia Crime Incidents
View crime-incidents.json
{
"version": "2",
"header": {
"title": "Crime Incidents 2015 - October 2016",
"description": "Philadelphia Police Department crime incidents from calendar year 2006 to present, including Part I and Part II crimes. UCR codes are generalized and incident locations are rounded to the hundred block. These counts may not coincide exactly with data that is submitted to the Uniformed Crime Reporting (UCR) system.",
"navigation": [
{
"label": "Download",
"url": ""
}
View cache-element-loop.js
const choo = require('choo')
const html = require('choo/html')
const widget = require('cache-element/widget')
const app = choo()
app.model({
state: {
rows: [ {a: 'a'}, {b: 'b'} ]
},
View reorder.js
function reorder (state, data) {
const { from, to } = data
const rowsCopy = state.rows.slice()
const fromRowCopy = rowsCopy[from.row].slice()
const item = fromRowCopy[from.index]
fromRowCopy.splice(from.index, 1) // remove from row
rowsCopy[from.row] = fromRowCopy // replace 'from' row
@timwis
timwis / choo-async-await.js
Created Dec 18, 2016
Use promises and async/await in effects in choo
View choo-async-await.js
app.use({
wrapEffects: (cb) => {
return async (state, data, send, done) => {
const psend = promisify(send)
try {
await cb(state, data, psend)
done()
} catch (err) {
done(err)
}
View crime-incidents-joined.json
{
"version": "2",
"header": {
"title": "Crime Incidents 2015 - October 2016",
"description": "Philadelphia Police Department crime incidents from calendar year 2006 to present, including Part I and Part II crimes. UCR codes are generalized and incident locations are rounded to the hundred block. These counts may not coincide exactly with data that is submitted to the Uniformed Crime Reporting (UCR) system.",
"navigation": [
{
"label": "Download",
"url": ""
}
@timwis
timwis / ward_1_committee.csv
Created Dec 5, 2016
Ward 1 democratic committee persons
View ward_1_committee.csv
WARD DISTRICT NAME PARTY TYPE
01 01 LINDA SAMACICIA Democrat M
01 02 BEATRIZ P BORODIAK Democrat M
01 03 MILLICENT BADIE Democrat M
01 04 DARNELL HELEM Democrat M
01 06 KERNARD M SHEARLDS Democrat M
01 07 AIDA L RIBOT Democrat M
01 08 CECILY C KIHN Democrat M
01 10 LARNEY J REED Democrat M
01 12 SYLVIA A HARKER Democrat M
@timwis
timwis / README.md
Last active Dec 2, 2016
Voter turnout processing
View README.md
View table.md

Target table format

| ward | registered_total | registered_democratic | registered_republican | turnout_total | turnout_democratic | turnout_republican | turnout_pct_total | turnout_pct_democratic | turnout_pct_republican | |------|------|------|------|------|------|------|------|------|------|------|------|------|------|------| | 1 | | 66A |

Alternate

| ward | party | registered_total | registered_party | turnout_total | turnout_party | turnout_pct_total | turnout_pct_party |

@timwis
timwis / steps.md
Last active Nov 28, 2016
Comparing FY16 adopted budget scripts
View steps.md

First, fetch the published file and prepare it for comparison

# Fetch file
curl 'https://data.phila.gov/resource/6quj-54t7.csv?$limit=5000' | \

# Fix currency formatting
sed -E 's/,\$([0-9]+)\.00/,\1/g' | \

# Sort
You can’t perform that action at this time.