Skip to content

Instantly share code, notes, and snippets.

@milesgrimshaw
milesgrimshaw / streetscore_cartodb.sql
Created June 28, 2014 23:52
SQL queries to compile a single table for Street Score exploration
## 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 / Quirky.rb
Created June 11, 2014 00:27
Ruby script to collect data from Quirky product pages
# Last Updated: 2014.06.05
# Gems to include
require 'Nokogiri'
require "open-uri"
require 'pp'
require 'json'
require 'csv'
# def get_default_data( default_stats, default_pricing, date_range )
@milesgrimshaw
milesgrimshaw / tech_reading.md
Last active August 19, 2021 19:07
Startup Reading
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,
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 / Kickstarter_Geocoding.R
Last active August 29, 2015 13:57
Data prep for geocoding
# Load desired packages
library(lubridate)
library(stringr)
library(ggplot2)
library(scales)
# Set the working directory
getwd()
setwd("~/Desktop/Patreon/")
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 / gist:8941929
Created February 11, 2014 19:13
Analysis of personal Evernote notes archive
# Load packages
library(ggplot2)
library(lubridate)
library(stringr)
library(scales)
# Set the working directory
getwd()
setwd("~/Dropbox/Personal/Projects/Evernote_Analysis/files/")
## Code for subsetting and formatting open paths data for Mapbox
## Miles Grimshaw
## December 26th 2013
## Set working directory and load required packages
getwd()
setwd("~/Dropbox/Personal/Mapbox/OpenPaths/")
library(stringr)
library(lubridate)
# library(ggplot2)
require 'csv'
require 'json'
require 'pp'
i = 0
features = []
start_line = []
end_line = []
## Loop through each row of the data