Skip to content

Instantly share code, notes, and snippets.

Avatar

Miles Grimshaw milesgrimshaw

View GitHub Profile
@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 / 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 / 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'
@milesgrimshaw
milesgrimshaw / Quirky.rb
Created Jun 11, 2014
Ruby script to collect data from Quirky product pages
View Quirky.rb
# 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 / gist:4748004
Last active Dec 12, 2015
Who Are My Peers? The code I wrote to both learn R and analyze some descriptive qualities of the current Yale undergraduate student body( Classes '13, '14, '15, '16).
View gist:4748004
#Pull in the html
x <- scan("~/Dropbox/Documents/Senior Year/Spring/STAT230/YaleFacebook3.html",
what="", sep="\n")
#All the student data is within the div class='display_data'
data <- grep('display_data', x, fixed=TRUE)
#The student data is all on the next line of html. The studens variable now contains the
#line number of the html with all the data
students <- x[data+1]
#each student's info is contained within the div with class='student_text_container'
@milesgrimshaw
milesgrimshaw / gist:5172167
Created Mar 15, 2013
Obesity In The USA (Octopress Blog Post)
View gist:5172167
---
layout: post
title: "Obesity in the USA"
date: 2013-03-14 12:59
comments: true
categories:
---
<!-- Make sure to include D3 first or else the IIFEs won't work. -->
<script src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="/Data/obesitystatedata.js"></script>
@milesgrimshaw
milesgrimshaw / gist:5392161
Created Apr 15, 2013
R script for making the graphs on the US economy
View gist:5392161
##############################
# Miles Grimshaw
# April 15th, 2013
# Code for graphs exploring US Economy
# Blog Post:
##############################
getwd()
setwd("~/Desktop/Macro_Paper/Data/")
@milesgrimshaw
milesgrimshaw / gist:5523271
Created May 6, 2013
R code for Personal Data Analytics
View gist:5523271
### Miles Grimshaw Code For Blog Post on Personal Data
### May 5th 2013
getwd()
setwd("~/Desktop/x_Final_Project")
library(stringr)
library(lubridate)
library(ggplot2)
@milesgrimshaw
milesgrimshaw / gist:5996636
Last active Dec 19, 2015
Merge JSON files of personal gmail header data and save as single CSV.
View gist:5996636
## MILES GRIMSHAW
require 'mechanize'
require 'csv'
require 'open-uri'
require "pp"
require "json"
CSV.open("immersion.csv", "wb") do |csv|
csv << ["Text","Date"]
You can’t perform that action at this time.