Skip to content

Instantly share code, notes, and snippets.

View fb_scrape.rb
# gem install crack rest-client fastercsv
require 'rubygems'
require 'crack'
require 'rest_client'
require 'fastercsv'
# To use, get an access token here, by clicking "get access token"
# and checking user.groups in the dialog box
View jsonb_build_object_example.sql
select jsonb_build_object(
'type', 'FeatureCollection',
'features', jsonb_agg(features.feature)
select jsonb_build_object(
'type', 'Feature',
'id', ogc_fid,
'geometry', ST_AsGeoJSON(the_geom)::jsonb,
'properties', to_jsonb(inputs) - 'gid'
View tilequery.js
import * as VectorTile from '@mapbox/vector-tile';
import * as Protobuf from 'pbf';
import * as Turf from '@turf/turf';
Math.radians = function(degrees) {
return degrees * Math.PI / 180;
export const TileQuery = {

Keybase proof

I hereby claim:

  • I am ashaw on github.
  • I am a_l ( on keybase.
  • I have a public key ASCC07IPMNPo72sD5dLL3UtrWljymJDP6G2LapRIUeUfggo

To claim this, I am signing this object:

jankycs() {
echo "select st_astext(st_transform(st_setsrid(st_point($2, $1), 4326), 3857));" | psql houston-rain -t | perl -pe 's/[^\d\.\- ]//g' | perl -pe 's/^ //g';
printf '\n'
View uscode.rb
class USCode
@@search_params = {
:view => "uscview",
:db2 => "t01t04" ,
:db3 => "t05t08" ,
:db4 => "t09t12" ,
:db5 => "t13t16" ,
:db6 => "t17t20" ,
:db7 => "t21t25" ,
View picturefill-rails.rb
def pf(path)
picturefill(path, "AltText") do
b = path.scan(/(^.*)\.(jpg|png|gif)/).flatten
sizes = {
:small => "#{b[0]}_small.#{b[1]}",
:medium => "#{b[0]}_medium.#{b[1]}",
:medium_high_dpi => "#{b[0]}_medium_high_dpi.#{b[1]}",
:large => "#{b[0]}_large.#{b[1]}",
:large_high_dpi => "#{b[0]}_large_high_dpi.#{b[1]}"
View stateline-noraphael.js
(function() {
var MapCanvas = Landline.Stateline = function(container, locality, opts) {
this.paper = {}; = {};
this.attrs = {};
this.lookup = {};
this.locality = locality;
this.container = $(container);
this.container.css("position", "relative");
View slides.js
var extend = function(obj){
var others = [],1);
for(var j in other) obj[j] = other[j];
return obj;
var Node = function(value){
this.value = value;
View gist:8338077

Tire Quality App: How Safe Are Your Tires?

Before you get to SF:

  1. Install Rails. Unless a critical mass of people are Pythonistas, we'll use Rails. (We'll use all manner of other tools, depending on the Fellows' skills and interests) but, as a baseline, make sure Rails is installed and working on your machine before you show up. (Instructions are below.)
  2. Send me a note (, or comment on this gist about what tools you like to use to build things, whether it be Ruby, Python, R, JavaScript, etc, and we'll adjust our stack to how most people like to do things.
  3. Download the UTQGS data:, and take a look at it
  4. Develop some questions about the data that you'd want to see in an app. Example questions that come to mind:
  • What are the safety ratings of the country's best-selling tires?