Skip to content

Instantly share code, notes, and snippets.

Miles Grimshaw milesgrimshaw

Block or report user

Report or block milesgrimshaw

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
@milesgrimshaw
milesgrimshaw / Style.css
Created Jun 20, 2015
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 / mindbody.R
Created Mar 17, 2015
Script to parse MindBody data
View mindbody.R
# Load libraries
library(ggplot2)
# Set working directory
setwd("~/Dropbox (Personal)/Personal/Github/MindBody/New/")
# Read in the data
data <- read.csv('mind_new.csv', header=TRUE, as.is=TRUE)
# Convert everything to lower case
@milesgrimshaw
milesgrimshaw / yelp.rb
Created Mar 16, 2015
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'
@milesgrimshaw
milesgrimshaw / citymedia.rb
Created Mar 16, 2015
Script to collect data from CityGridMedia's Places API
View citymedia.rb
require 'rubygems'
require 'nokogiri'
require 'pp'
require 'mechanize'
require 'open-uri'
require 'csv'
key = "## YOUR KEY HERE"
@milesgrimshaw
milesgrimshaw / mindbody.rb
Created Mar 16, 2015
Script to scrape the clients feed behind the map on MindBody's website
View mindbody.rb
require 'nokogiri'
require 'pp'
require 'mechanize'
require 'open-uri'
require 'csv'
page = Nokogiri::XML(open('https://www.mindbodyonline.com/clients/feed/all.xml'))
items = page.css('marker')
CSV.open("mind_new.csv", "wb") do |csv|
@milesgrimshaw
milesgrimshaw / inbox_count
Created Sep 25, 2014
Google Apps Script to save the count of emails in your inbox
View inbox_count
function processInbox() {
// get all threads in inbox
var threads = GmailApp.getInboxThreads();
data_id = '1t70IDdWcaJzCIIaNWm2nHSPKzetHfTxhkKc9jKkAlpA'
var dataSs = SpreadsheetApp.openById(data_id);
var sheet = dataSs.getSheets()[0];
var current_date = new Date();
sheet.appendRow([current_date, current_date.toISOString(),threads.length]);
};
@milesgrimshaw
milesgrimshaw / geocode_appscript
Created Sep 23, 2014
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 / Citibike.R
Created Aug 6, 2014
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 Aug 6, 2014
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 / yelp.rb
Last active Sep 17, 2015
How many gyms/yoga/pilates in Boston/New York/LA? Ruby script to output a spreadsheet of the number of a given category in a given city according to Yelp.
View yelp.rb
require 'oauth'
require 'json'
require 'pp'
require 'csv'
consumer_key = 'NUM'
consumer_secret = 'NUM'
token = 'NUM'
token_secret = 'NUM'
You can’t perform that action at this time.