Skip to content

Instantly share code, notes, and snippets.

View clhenrick's full-sized avatar

Chris Henrick clhenrick

View GitHub Profile
@clhenrick
clhenrick / index.html
Last active August 29, 2015 14:05
Leaflet + D3 test
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Leaflet, Mapbox and D3JS test</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />
<style>
@clhenrick
clhenrick / process_twitter_data.py
Last active August 29, 2015 14:05
iterate over twitter data and output to csv
## inspired by Mike Migurski's blog post on using twitter's public streaming API
## http://mike.teczno.com/notes/streaming-data-from-twitter.html
import json
from csv import writer
# create an empty list to store our tweets in
tweets = []
# append each line of the data to our tweets list using the json module
@clhenrick
clhenrick / index.html
Last active August 29, 2015 14:06
parsons bfa creative code class teaching example
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Our First Webpage</title>
</head>
<body>
<h1>Hello Internet!</h1>
</body>
</html>
@clhenrick
clhenrick / index.html
Last active August 29, 2015 14:06
CartoDB JS + D3 JS
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Leaflet, Mapbox and D3JS test</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
<script src="http://libs.cartocdn.com/cartodb.js/v3/cartodb.js"></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />
@clhenrick
clhenrick / loops.js
Last active August 29, 2015 14:06
In class code for Parsons BFA Creativity and Computation week 3
/*** Creative Computing Week 03 Class Code ***/
// this is a comment for a single line of code.
/* this is a comment
that spans multiple
lines ...
*/
// PRO TIP: a good practice to follow when you are first learning to code is to write what your code is doing in plain english above each line.
@clhenrick
clhenrick / maptime-nyc-bike-data-hack.sql
Last active August 29, 2015 14:10
maptime-nyc bike hack postgis sql
-- get the length in feet using NY Long Island State Plane Feet (EPSG:2263)
SELECT *, st_length(st_transform(the_geom, 2263)) as length FROM osm_nyc_ways_bicycle_just_nyc
-- we need to select the_geom_webmercator for data to render in cartodb's map view
SELECT cartodb_id, st_Centroid(the_geom_webmercator) as the_geom_webmercator FROM osm_nyc_ways_bicycle_just_nyc
-- fid out where the datasets intersect
SELECT a.the_geom_webmercator
FROM osm_nyc_ways_bicycle_just_nyc a,
cscl_bikeroute b
@clhenrick
clhenrick / index.html
Created December 3, 2014 16:59
odyssey.js & cartodb.js testing
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Bushwick Community Map Intro</title>
<meta name="description" content="An introduction to the Bushwick Community Map">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/themes/css/cartodb.css">
<link rel="stylesheet" href="http://cartodb.github.io/odyssey.js/sandbox/css/slides.css">
@clhenrick
clhenrick / index.html
Created December 3, 2014 18:57
hacking odyssey part 2
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Bushwick Community Map Intro</title>
<meta name="description" content="An introduction to the Bushwick Community Map">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cartodb-libs.global.ssl.fastly.net/cartodb.js/v3/themes/css/cartodb.css">
<link rel="stylesheet" href="http://cartodb.github.io/odyssey.js/sandbox/css/slides.css">
@clhenrick
clhenrick / index.html
Last active August 29, 2015 14:10
odyssey.js hack three
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NWB map intro test</title>
<meta name="description" content="An introduction to the Bushwick Community Map">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" href="http://cartodb.github.io/odyssey.js/sandbox/css/slides.css">
@clhenrick
clhenrick / index.js
Last active August 29, 2015 14:15
update bbl in hpd violations data
var bbl = require('make_bbls').bbl;
var _ = require('underscore');
var async = require('async');
var pg = require('pg');
pg.defaults.database = 'nyc_hpd';
pg.defaults.host = 'localhost';
pg.defaults.user = 'chrislhenrick';
pg.defaults.password = '';
pg.defaults.port = 5432;