Skip to content

Instantly share code, notes, and snippets.

@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'
@timwis
timwis / gist:6539220
Last active December 22, 2015 22:19
Tax balance API data structure
/**
* /taxbalances/883309000
*/
{
status: "success",
data: {
property: {
account_number: "883309000"
},
balances: [
@timwis
timwis / gist:7882901
Created December 9, 2013 23:17
Convert between 4326 and 2272 with Proj4js. Written by @davewalk. Uses http://trac.osgeo.org/proj4js/
convertCoordinates: function (coords) {
Proj4js.defs['EPSG:2272'] = '+proj=lcc +lat_1=40.96666666666667 +lat_2=39.93333333333333 +lat_0=39.33333333333334 +lon_0=-77.75 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs';
var source = new Proj4js.Proj('EPSG:4326');
var dest = new Proj4js.Proj('EPSG:2272');
var point = new Proj4js.Point(-75.163789, 39.952335);
Proj4js.transform(source, dest, point);
return point;
}
KeyValDropdownEditor.prototype.prepare = function () {
Handsontable.editors.BaseEditor.prototype.prepare.apply(this, arguments) // call parent method
var source = this.cellProperties.source
var options
Handsontable.Dom.empty(this.select)
if (typeof source === 'function') {
options = source(this.row, this.col, this.prop)
@timwis
timwis / crime-incidents.json
Last active January 8, 2016 18:01
Philly part 2 crime incidents VizWit
{
"version": "2",
"header": {
"title": "VizWit",
"description": "Lorem ipsum dolor sit amet"
},
"cards": [
{
"x": 0,
"y": 0,
{
"version": "2",
"header": {
"title": "Business Licenses in Chicago",
"description": "Business licenses issued by the Department of Business Affairs and Consumer Protection in the City of Chicago from 2002 to the present. January 1, 2006 to present. Data is updated daily.",
"navigation": [
{
"label": "Download",
"url": "https://data.cityofchicago.org/api/views/r5kz-chrr/rows.csv?accessType=DOWNLOAD&bom=true"
}
@timwis
timwis / city-owned-properties.v2.json
Last active January 15, 2016 11:13
City-owned properties VizWit configuration
{
"version": "2",
"header": {
"title": "City-owned Properties",
"description": "Properties owned by the City of Philadelphia",
"navigation": [
{
"label": "Download",
"url": "https://data.phila.gov/api/views/3h6i-2hfj/rows.csv?accessType=DOWNLOAD&bom=true"
}
@timwis
timwis / chicago-crimes.v2.json
Last active January 15, 2016 11:14
Chicago crime incidents VizWit configuration
{
"version": "2",
"header": {
"title": "Crime Incidents in Chicago",
"description": "This dataset reflects reported incidents of crime (with the exception of murders where data exists for each victim) that occurred in the City of Chicago from 2001 to present, minus the most recent seven days. Data is extracted from the Chicago Police Department's CLEAR (Citizen Law Enforcement Analysis and Reporting) system. In order to protect the privacy of crime victims, addresses are shown at the block level only and specific locations are not identified.",
"navigation": [
{
"label": "Download",
"url": "https://data.cityofchicago.org/api/views/ijzp-q8t2/rows.csv?accessType=DOWNLOAD&bom=true"
}
@timwis
timwis / callouts.v2.json
Last active January 15, 2016 11:14
Callout cards VizWit config
{
"version": "2",
"header": {
"title": "Callouts",
"description": "This page demonstrates the callout feature of VizWit."
},
"cards": [
{
"x": 0,
"y": 0,
@timwis
timwis / test.json
Last active January 17, 2016 20:22
vizwit provider test
{
"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"
}