Skip to content

Instantly share code, notes, and snippets.

View rdmurphy's full-sized avatar
🔴
Red pandas are the best.

Ryan Murphy rdmurphy

🔴
Red pandas are the best.
View GitHub Profile
@rdmurphy
rdmurphy / aight.events.js
Created April 23, 2014 23:24
Getting pym.js to play along with IE8. Polyfill `addEventListener` for maximum success. I pulled the event polyfill out of aight (https://github.com/shawnbot/aight), minified it, and chucked it into an IE conditional. Happy <iframe>'ing!
(function() {
if (!window.addEventListener) {
(function (WindowPrototype, DocumentPrototype, ElementPrototype, addEventListener, removeEventListener, dispatchEvent, registry) {
WindowPrototype[addEventListener] = DocumentPrototype[addEventListener] = ElementPrototype[addEventListener] = function (type, listener) {
var target = this;
registry.unshift([target, type, listener, function (event) {
event.currentTarget = target;
event.preventDefault = function () { event.returnValue = false; };
event.stopPropagation = function () { event.cancelBubble = true; };
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background-color: black;
}
@rdmurphy
rdmurphy / app.py
Last active December 28, 2015 11:29
It's really easy to provide a hook into hitting a URL from a Google Spreadsheet. Here's how we do it. Stupid simple Flask app hangs out on Heroku and listens for the URL hit, which prompts the script to do the deed.
import os
from flask import Flask
from prepare_data import prepare_data
app = Flask(__name__)
@app.route('/')

Building things with Tabletop.js and Handlebars.js

Description

Maybe you've used pre-packaged vendor tools to create digital news presentations, but you aren't quite ready to tackle full-stack programming, database management and server setup. Maybe you're hoping reporters will learn how keeping structured data about their beat can benefit the organization. Or maybe you're looking for a tool that help organize/display information when that breaking news event happens.

Enter tabletop.js and handlebars.js, two little JavaScript libraries that play well with one another and make it easy to maintain and deliver data-driven content.

The workshop/panel/interactive/session proposes to:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mapbox + Leaflet</title>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.css' rel='stylesheet' />
<!--[if lte IE 8]>
<link href='http://api.tiles.mapbox.com/mapbox.js/v1.0.0/mapbox.ie.css' rel='stylesheet' >
<![endif]-->
<style>
@rdmurphy
rdmurphy / leaflet-mapbox-url-hacking.html
Last active December 15, 2015 07:29
"Hacking the URL" with Leaflet.js
<!DOCTYPE html>
<html>
<head>
<title>China Population</title>
<script src="http://cdn.leafletjs.com/leaflet-0.5/leaflet.js"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<style>
body {
margin:0;
padding:0;
@rdmurphy
rdmurphy / index.html
Last active December 11, 2015 07:48
How I use HTML5 geolocation in my apps.
<span class="geoFind" id="geoFind">Just find me!</span>
@rdmurphy
rdmurphy / tx_gopussen_superpac_expends.py
Created July 27, 2012 04:24
Texas GOP U.S. Senate Super PAC Expenditures (For or Against)
import urllib
import json
import csv
import nytapikey
BASE_URI = "http://api.nytimes.com/svc/elections/us/v3/finances/2012"
API_KEY = nytapikey.key # keeping my key warm and safe
dewhurst_id = "S2TX00361"
cruz_id = "S2TX00312"
@rdmurphy
rdmurphy / gist:1714802
Created February 1, 2012 02:56 — forked from brianboyer/gist:1696819
Lion dev environment notes
Homebrew (https://github.com/mxcl/homebrew/wiki/installation)
brew install postgres
brew install gdal --with-postgres (EDIT THE FORMULA FIRST, see https://github.com/mxcl/homebrew/issues/8301)
brew install postgis
edit /etc/paths to put /usr/local/bin on top, so that lion's psql doesnt win
PostGIS templates (based on https://wiki.archlinux.org/index.php/PostGIS)
createdb template_postgis -E UTF8
createlang plpgsql template_postgis
psql -d template_postgis -f /usr/local/share/postgis/postgis.sql
@rdmurphy
rdmurphy / cargochart.html
Created December 7, 2011 20:40
A working version of a data formatter using the Google Charts API.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>cargochart</title>
</head>
<body>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});