Skip to content

Instantly share code, notes, and snippets.

# 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
# https://developers.facebook.com/tools/explorer?method=GET&path=209024949216061%2Ffeed
#
select jsonb_build_object(
'type', 'FeatureCollection',
'features', jsonb_agg(features.feature)
)
from(
select jsonb_build_object(
'type', 'Feature',
'id', ogc_fid,
'geometry', ST_AsGeoJSON(the_geom)::jsonb,
'properties', to_jsonb(inputs) - 'gid'
// https://projects.propublica.org/voting/static/vtile-bundle.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 (https://keybase.io/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'
}
class USCode
SEARCH_ENDPOINT = "http://uscode.house.gov/uscode-cgi/fastweb.exe?search"
@@search_params = {
:view => "uscview",
:db2 => "t01t04" ,
:db3 => "t05t08" ,
:db4 => "t09t12" ,
:db5 => "t13t16" ,
:db6 => "t17t20" ,
:db7 => "t21t25" ,
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]}"
}
(function() {
var MapCanvas = Landline.Stateline = function(container, locality, opts) {
this.paper = {};
this.events = {};
this.attrs = {};
this.lookup = {};
this.locality = locality;
this.container = $(container);
this.container.css("position", "relative");
var extend = function(obj){
var others = [].slice.call(arguments,1);
others.forEach(function(other){
for(var j in other) obj[j] = other[j];
});
return obj;
}
var Node = function(value){
this.value = value;
@ashaw
ashaw / gist:8338077
Last active January 2, 2016 17:39 — forked from dansinker/gist:8337769

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 (almshaw@gmail.com), 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: http://cl.ly/0L2c152y2n2j, 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?