Skip to content

Instantly share code, notes, and snippets.

View Geocoding Apps Script
function addMahZipCodez() {
// grab basic sheet data
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
// init some locals for looping over each row
var row;
@milesgrimshaw
milesgrimshaw / Kickstarter_Geocoding.R
Last active August 29, 2015 13:57
Data prep for geocoding
View Kickstarter_Geocoding.R
# Load desired packages
library(lubridate)
library(stringr)
library(ggplot2)
library(scales)
# Set the working directory
getwd()
setwd("~/Desktop/Patreon/")
View Response
Dear Miles,
We heard you discovered a security issue with *Kluck*. We take security and privacy very seriously, and our team has worked today to address the concern.
The coordinates you discovered are not exact coordinates; they reflect a radius for a *user* who has given *Kluck* permission to show *the user's* profile, including location. However, to avoid any confusion, we have now disabled that feature. [Redacted]
We sincerely appreciate you bringing this to our attention...[redacted]
Sincerely,
View Response
Dear Miles,
We heard you discovered a security issue with *Kluck*. We take security and privacy very seriously, and our team has worked today to address the concern.
The coordinates you discovered are not exact coordinates; they reflect a radius for a *user* who has given *Kluck* permission to show *the user's* profile, including location. However, to avoid any confusion, we have now disabled that feature. [Redacted]
We sincerely appreciate you bringing this to our attention...[redacted]
Sincerely,
@milesgrimshaw
milesgrimshaw / streetscore_cartodb.sql
Created June 28, 2014 23:52
SQL queries to compile a single table for Street Score exploration
View streetscore_cartodb.sql
## Instersection Commands For StreetScore and TreeCount
UPDATE cb_newyork_streetscore_compiled SET streetscore = (SELECT AVG(q_score) FROM streetscore_newyorkcity WHERE ST_Intersects(the_geom, cb_newyork_streetscore_compiled.the_geom) )
UPDATE cb_newyork_streetscore_compiled SET trees = (SELECT COUNT(*) FROM tree_census_simple WHERE ST_Intersects(the_geom, cb_newyork_streetscore_compiled.the_geom) )
## Collect PLUTO Data
UPDATE nyc_blocks_2010 SET assesstot = (SELECT sum(assesstot) FROM pluto WHERE ST_Intersects(the_geom, nyc_blocks_2010.the_geom) )
@milesgrimshaw
milesgrimshaw / Citibike.R
Created August 6, 2014 11:49
R script to analyze personal Citibike data
View Citibike.R
library(ggplot2)
library(lubridate)
## Set the working directory
setwd("~/Dropbox (Personal)/Personal/Github/Citibike")
## Organize restaurant data
r <- read.csv('trips.csv', header=TRUE, as.is=TRUE)
head(r)
@milesgrimshaw
milesgrimshaw / citibike.rb
Created August 6, 2014 11:47
Script to collect and get routes for personal Citibike data
View citibike.rb
## API Structure
# {
# "name": "citibike_bay",
# "count": 8,
# "frequency": "realtime",
# "version": 1,
# "newdata": true,
# "lastrunstatus": "success",
# "lastsuccess": "Tue Jul 22 2014 21:50:19 GMT+0000 (UTC)",
# "results": {
@milesgrimshaw
milesgrimshaw / geocode_appscript
Created September 23, 2014 18:52
Geocode Restaurant Data in Google Sheet Appscript
View geocode_appscript
function geocode_all() {
// grab basic sheet data
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
// init some locals for looping over each row
var row;
@milesgrimshaw
milesgrimshaw / Style.css
Created June 20, 2015 21:52
Custom style for map of personal data exhaust
View Style.css
#ubergeojson, #original {
line-color: @road;
line-width: 0.5;
[zoom>=11] { line-width: 0.5; }
[zoom>=12] { line-width: 0.7; }
[zoom>=13] { line-width: 1; }
[zoom>=14] { line-width: 1.2; }
[zoom>=15] { line-width: 1.4; }
[zoom>=16] { line-width: 1.6; }
}
@milesgrimshaw
milesgrimshaw / yelp.rb
Created March 16, 2015 23:10
Script to collect search count data for various terms in Yelp across top 60 US cities
View yelp.rb
require 'oauth'
require 'json'
require 'pp'
require 'csv'
consumer_key = '#YOURS'
consumer_secret = '#YOURS'
token = '#YOURS'
token_secret = '#YOURS'