Skip to content

Instantly share code, notes, and snippets.

View tylerpearson's full-sized avatar

Tyler Pearson tylerpearson

View GitHub Profile
require 'json'
require 'nokogiri'
require 'open-uri'
require 'colored'
require 'active_support/all'
# the url for the page we want to scrape
PAGE_URL = "http://gisweb.durhamnc.gov/gis_apps/crimedata/dsp_tables.cfm?CFID=482922&CFTOKEN=13687690"
# grab the page for Nokogiri
require 'active_support/all'
require 'colored'
require 'httparty'
require 'json'
# load and parse the JSON file of scraped crimes
results = JSON.parse(File.read("../data/all-crimes.json"))
crimes = []
require 'json'
require 'colored'
# read and parse the JSON data
results = JSON.parse(File.read("../data/all-geo.json"))
# initialize the GeoJSON
geo_json = {
:type => "FeatureCollection",
:features => []
@tylerpearson
tylerpearson / state-abbreivations.rb
Last active December 30, 2015 01:59
U.S. state abbreviations as a Ruby array (with DC!)
states = %w{AL AK AZ AR CA CO CT DC DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY}
@tylerpearson
tylerpearson / ca-olympians.md
Created February 12, 2014 14:44
Who the 2014 Canadian Olympic team follows on Twitter
@tylerpearson
tylerpearson / results.md
Created February 12, 2014 14:49
Who the 2014 U.S. Winter Olympians follow on Twitter
@tylerpearson
tylerpearson / get-reps.js
Last active August 29, 2015 13:57
Google Civic Info API with jQuery
$.ajax({
type: "POST",
url: "https://www.googleapis.com/civicinfo/us_v1/representatives/lookup?key=AIzaSyCcn1YcPE4Ja0tsYVb0oRxMxK4xTTjXRck",
data: JSON.stringify({'address': '1263 Pacific Ave. Kansas City KS'}),
dataType: "json",
contentType: "application/json; charset=utf-8"
}).done(function(data) {
alert("it worked");
});

Keybase proof

I hereby claim:

  • I am tylerpearson on github.
  • I am tylerpearson (https://keybase.io/tylerpearson) on keybase.
  • I have a public key whose fingerprint is CE07 404E C0F8 0BE1 A2C2 D933 C68C B0FE 23FD D51B

To claim this, I am signing this object:

/*
* FB SETTINGS
*/
window.fbAsyncInit = function() {
// 1. Get a unique appId for the website from https://developers.facebook.com/apps
// The title will be visible in the post, so make it the name of the site (e.g. Taco Truck for Congress)
// 2. In "Settings", click "+ Add Platform", select "Website", and add the site URL (localhost is cool initially too)
// 3. In "App Details", things like the icon can be customized
@tylerpearson
tylerpearson / passenger_nginx_env_vars.md
Last active August 29, 2015 14:07
setting env vars with passenger and nginx
http {
    ...
    passenger_ruby /path/to/passenger_ruby

=============

chmod +x /path/to/passenger_ruby