Skip to content

Instantly share code, notes, and snippets.

View tbuckl's full-sized avatar
Studying

Tom Buckley tbuckl

Studying
View GitHub Profile
@tbuckl
tbuckl / .block
Created June 13, 2017 06:16 — forked from mbostock/.block
Zoomable Map Tiles
license: gpl-3.0
p1 <- "C:/projects/RTD/RegionalTransitDatabase/data/05_2017_511_GTFS"
p2 <- "C:/projects/RTD/RegionalTransitDatabase/data/05_2017_511_GTFS"
library(readr)
setwd(p2)
df1 = NULL
for (txt in dir(pattern = "_peak_bus_routes.csv$",full.names=TRUE,recursive=TRUE)){
print(txt)
df1 = rbind(df1, read_csv(txt))
}
@tbuckl
tbuckl / d3.geo.tile.min.js
Last active May 27, 2017 11:35
Foursquare Neighborhood Estimation
d3.geo.tile=function(){function t(){var t=Math.max(Math.log(n)/Math.LN2-8,0),h=Math.round(t+e),o=Math.pow(2,t-h+8),u=[(r[0]-n/2)/o,(r[1]-n/2)/o],l=[],c=d3.range(Math.max(0,Math.floor(-u[0])),Math.max(0,Math.ceil(a[0]/o-u[0]))),M=d3.range(Math.max(0,Math.floor(-u[1])),Math.max(0,Math.ceil(a[1]/o-u[1])));return M.forEach(function(t){c.forEach(function(a){l.push([a,t,h])})}),l.translate=u,l.scale=o,l}var a=[960,500],n=256,r=[a[0]/2,a[1]/2],e=0;return t.size=function(n){return arguments.length?(a=n,t):a},t.scale=function(a){return arguments.length?(n=a,t):n},t.translate=function(a){return arguments.length?(r=a,t):r},t.zoomDelta=function(a){return arguments.length?(e=+a,t):e},t};
import geopandas as gpd
import pandas as pd
import fiona
###
#read in NHS data
###
#download data: #http://www.dot.ca.gov/hq/tsip/gis/datalibrary/zip/highway/NHS_Map21.zip
nhs = gpd.read_file("data/NHS_Map21/NHS_Map21.shp")
@tbuckl
tbuckl / sas_r_sql_pandas.md
Last active March 31, 2017 19:23
SAS for R Users for Pandas Users for SQL Users for SAS Users for Pandas Users for SAS Users

Tom's notes on travel survey

(1) Survey Recruitment

Not sure what this is! :)

(2) rMove

rmove crashed when i first opened it. had to reopen.

I turned this app on for about a day and then went on a ski trip that weekend, which made it pretty hard to use. It was entirely using up my battery when I needed it in really critical situations (long driving tip to Tahoe) and then once I got on the mountain, I had to uninstall the app in order to save my battery. Perhaps thats user error, but I wish there had been more of an "on" "off" button for the app, put right up front in a clearer place. This was sort of disappointing because I knew that my trips up and down on the ski lift were not interesting for the sake of planning transportation, but that my trip to get to Tahoe was interesting for transportation planning (I took several modes, shared cars, etc). But by the time I was ready to come back home I had already uninstalled the app and that was a bit of a barrier to get back into it, at lea

@tbuckl
tbuckl / census_tools.md
Last active February 20, 2017 18:47
census tools
<html>
<head>
<title>Source Zoning Data</title>
<body>this is an empty page that will be used to redirect to a map in the future</body>
@tbuckl
tbuckl / sspd.py
Created November 17, 2016 23:24
pandas utils for smartsheets
from smartsheet import *
import pandas as pd
from credentials import smartsheet_token
smartsheet = smartsheet.Smartsheet(smartsheet_token)
def get_sheet_as_df(sheet_id):
ss1 = smartsheet.Sheets.get_sheet(sheet_id, page_size=0)
row_count = ss1.total_row_count
ss1 = smartsheet.Sheets.get_sheet(sheet_id, page_size=row_count)
@tbuckl
tbuckl / index.html
Last active May 21, 2017 21:43
Bay Area Bathymetry
<!DOCTYPE html>
<html>
<head>
<title>Ocean</title>
<!-- Load Leaflet from CDN-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/leaflet/1.0.0-rc.3/leaflet.css" />
<script src="https://cdn.jsdelivr.net/leaflet/1.0.0-rc.3/leaflet-src.js"></script>
<!-- Load Esri Leaflet from CDN -->
<script src="https://cdn.jsdelivr.net/leaflet.esri/2.0.2/esri-leaflet.js"></script>