Skip to content

Instantly share code, notes, and snippets.

View larrybuch's full-sized avatar

Larry Buchanan larrybuch

View GitHub Profile
rank name country age type
1 Andy Murray GBR 29 men
2 Novak Djokovic SRB 29 men
3 Stan Wawrinka SUI 31 men
4 Milos Raonic CAN 26 men
5 Kei Nishikori JPN 27 men
6 Rafael Nadal ESP 30 men
7 Jo-Wilfried Tsonga FRA 31 men
8 Marin Cilic CRO 28 men
9 Dominic Thiem AUT 23 men
@larrybuch
larrybuch / gist:e797fa7f4c55135e8a557887dcfe4556
Created April 15, 2016 16:51
starting and stopping postgres
// stopping a postgres server
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop
// starting a postgres server
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@larrybuch
larrybuch / mapshaper help.txt
Last active April 7, 2016 17:32
how to add style-y things in mapshaper svg style fill properties
-svg-style fill='winner == "deblasio" ? "red" : "grey"'
-each 'FID = ed'
-each 'FID = String(ed)'
-svg-style class='winner'
@larrybuch
larrybuch / jea-nspa.md
Last active March 17, 2017 13:22
notes for a talk to the kids in new york

Hi, I'm Larry.

I work on the graphics desk at The New York Times.

There are about 35 of us. We all come from different places and backgrounds, but at our core we're all reporters — gathering information, interviewing sources and figuring out the best visual form to represent it. There are coders, mappers, illustrators, designers, animators, statisticans, chartmakers, 3d modelers.

We make visual stories.

What do I mean by that?

Well, how about a story like this that shows you a country's collective reaction.

@larrybuch
larrybuch / breakpoints
Created February 16, 2016 02:54
clever desktop only mobile only in less
@breakpoint: 720px;
.g-desktop-only {
@media only screen and (max-width: @breakpoint) {
display: none;
}
}
.g-mobile-only {
@media only screen and (min-width: @breakpoint) {
@larrybuch
larrybuch / scraper.rb
Created February 11, 2016 18:24
basic scraper that derek sent me
require 'nokogiri'
require 'open-uri'
require 'mechanize'
doc = Nokogiri::HTML(open('http://nyphil.org/about-us/the-orchestra/musicians-of-the-orchestra'))
doc.css('.roster-name a').each do |link|
base = 'http://nyphil.org/'
#base URL
(function() {
var ε = 1e-4,
π = Math.PI,
radians = π / 180,
degrees = 180 / π;
// Creates a polyhedral projection.
// * root: a spanning tree of polygon faces. Nodes are automatically
// augmented with a transform matrix.
@larrybuch
larrybuch / geojson-conversion.sh
Last active August 29, 2015 14:06
batch convert shp files to geojson using ogr2ogr
# TAKEN FROM HERE https://gist.github.com/benbalter/5858851
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
@larrybuch
larrybuch / gist:9fc65e9fd8913fbd2c2f
Created August 27, 2014 20:15
borough lat longs
var boroughs = [
{"name": "Brooklyn","lat":40.637963,"lon":-73.977621},
{"name": "Manhattan","lat":40.774717,"lon":-73.998072},
{"name": "Staten Island","lat":40.579271,"lon":-74.17482},
{"name": "Bronx","lat":40.825442,"lon":-73.908270},
{"name": "Queens","lat":40.743665,"lon":-73.903741}
];
@larrybuch
larrybuch / gist:fbdfef062eda9ba8d625
Created July 16, 2014 04:37
replace spaces with dashes and make all lower case
.replace(/\s+/g, '-').toLowerCase();