Skip to content

Instantly share code, notes, and snippets.

View shaneshifflett's full-sized avatar

Shane Shifflett shaneshifflett

View GitHub Profile
@shaneshifflett
shaneshifflett / dump.txt
Created September 18, 2015 02:47
tracker investigation local
| results | BASE TABLE |
| resultview3 | VIEW |
| resultview_sub1 | BASE TABLE |
| resultview_sub2 | BASE TABLE |
| resultview_sub3 | BASE TABLE |
| resultview_sub3a | BASE TABLE |
RESULTSVIEW3 is confirmed to be a view
mysql> select * from trackertouse;
@shaneshifflett
shaneshifflett / routes.geojson
Created September 1, 2015 03:53
sfmtaroutes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shaneshifflett
shaneshifflett / gif-converter.sh
Last active October 13, 2016 16:25
Convert a GIF to MP4
brew install ffmpeg --with-libvorbis, --with-libvpx, --with-theora, --with-opus, --with-x265, --with-fdk-aac --with-ffplay, --with-freetype, --with-libass, --with-libquvi
ffmpeg -f gif -i YOURGIF.gif -vcodec libx264 -pix_fmt yuv420p YOURMP4.mp4
ffmpeg -i YOURMP4.mp4 -c:v libvpx -b:v 1M -c:a libvorbis YOURWEBM.webm
#bonus cool js library
#http://gka.github.io/canvid/
@shaneshifflett
shaneshifflett / gdoc_to_timeline_converter.rb
Created February 21, 2014 23:37
convert a google spreadsheet to a json file that can be read by timeline.js
task :jsonify_timeline => :environment do
require 'csv'
require 'json'
require 'open-uri'
def scrub(text)
if text.include? '--'
text = text.gsub(/--/, '—')
end
return text
@shaneshifflett
shaneshifflett / medill_scraper.py
Last active December 31, 2015 07:08
medill scraper
from BeautifulSoup import BeautifulSoup
from datetime import datetime
import itertools
import requests
import os
directory = "medill-scraper/data/scrapes/%s/" % (datetime.now().strftime("%m-%d-%Y"))
if not os.path.exists(directory):
os.makedirs(directory)
@shaneshifflett
shaneshifflett / shooter.js
Created December 12, 2013 23:49
shoot old clips
/*
requires: phantomjs, async
usage: phantomjs index.js
*/
var async = require('async');
var sites = [
['zaller', 'https://www.baycitizen.org/blogs/sandbox/digital-maps-low-cost-fighting-wildfires/'],
['binladen-pg-2', 'https://www.baycitizen.org/news/osama-bin-laden/san-francisco-vs-usa-rift-emerges-bin/?page=1'],
@shaneshifflett
shaneshifflett / nested_bubble_scale.js
Last active December 24, 2015 10:19
nested bubble scale with swatch
var legend = function(r, notes, fmt, label, points){
notes.append("svg:circle")
.attr("cy", 40 + r(points[2]))
.attr("cx", 0)
.attr("r", r(points[2]))
.style("stroke", "#444455")
.style("stroke-width", "1")
.style("fill", "none");
notes.append("svg:circle")
.attr("cy", 40 + r(points[1]))
@shaneshifflett
shaneshifflett / bar.js
Last active December 23, 2015 22:00
simple bar chart d3
var margin = {top: 20, left: 50, right: 50, bottom: 50},
w = 700 - margin.left - margin.right,
h = 500 - margin.top - margin.bottom;
var ygetter = function(d){return d.value;};
var f = d3.format(",.0f");
var barPadding = 10;
var colWidth = (w / data.length) - barPadding;
var colSpace = w / data.length;
/**************************************************************************
* OSM2GEO - OSM to GeoJSON converter
* OSM to GeoJSON converter takes in a .osm XML file as input and produces
* corresponding GeoJSON object.
*
* AUTHOR: P.Arunmozhi <aruntheguy@gmail.com>
* DATE : 26 / Nov / 2011
* LICENSE : WTFPL - Do What The Fuck You Want To Public License
* LICENSE URL: http://sam.zoy.org/wtfpl/
*
var slugify = function(input){
return input
.toLowerCase()
.replace(/ /g,'-')
.replace(/[^\w-]+/g,'');
};