Skip to content

Instantly share code, notes, and snippets.

View jasonlally's full-sized avatar

Jason Lally jasonlally

View GitHub Profile
@jasonlally
jasonlally / intersections.geojson
Created June 26, 2018 18:47
intersections.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Load GeoJSON from a URL</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.3.0/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.3.0/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@jasonlally
jasonlally / gist:c706ec68e1c2ebdd290b
Created March 16, 2015 17:43
google-geocoder-with-dstk.js
// Global variables
var ss = SpreadsheetApp.getActiveSpreadsheet(),
sheet = ss.getActiveSheet(),
activeRange = ss.getActiveRange(),
settings = {};
var geocoders = {
yahoo: {
query: function(query, key) {
return 'http://where.yahooapis.com/geocode?appid=' +
@jasonlally
jasonlally / example-ga-event.js
Last active October 18, 2018 14:08
Example code to track clicks on Socrata tracker buttons
//assuming jQuery is available
//attach events to the nav buttons above datasets
$('#sidebarOptions').on('click', 'a', function() {
var dataset = $('#datasetName').attr('title');
var label = $(this).attr('title');
//labels sent to google analytics on click events will include the dataset name and the label of the button
//this gives greater insight into how users are interacting with datasets once they arrive
ga('send', 'event', 'Data Panel', 'Click', dataset + ': ' + label);
});
@jasonlally
jasonlally / 0_reuse_code.js
Created January 25, 2014 04:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jasonlally
jasonlally / meta_data_socrata_api.py
Last active December 18, 2015 22:08
Loops through all the city data catalogs using Socrata and dumps them to a structured JSON document that can be read by a D3 tree map.
#Connects to the Socrata search API and loads data describing the tabular datasets in the catalog for use by D3 tree map
#This version connects to a list of existing Socrata instances and loops through the ones categorized as city
#Use: python dataportalapi.py > portaldata.json
import requests, json, math, re
def check_categories(d,category):
for i in range(len(d)):
if d[i]['name'] == category: return i
return -1