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 / dabr.js
Created November 3, 2011 19:21
"Do a Barrel Roll!" Bookmarklet
javascript:(function(){var%20css=document.createElement("style");css.type="text/css";css.innerHTML="@-moz-keyframes%20roll%20{%20100%25%20{%20-moz-transform:%20rotate(360deg);%20}%20}%20@-o-keyframes%20roll%20{%20100%25%20{%20-o-transform:%20rotate(360deg);%20}%20}%20@-webkit-keyframes%20roll%20{%20100%25%20{%20-webkit-transform:%20rotate(360deg);%20}%20}%20body{%20-moz-animation-name:%20roll;%20-moz-animation-duration:%204s;%20-moz-animation-iteration-count:%201;%20-o-animation-name:%20roll;%20-o-animation-duration:%204s;%20-o-animation-iteration-count:%201;%20-webkit-animation-name:%20roll;%20-webkit-animation-duration:%204s;%20-webkit-animation-iteration-count:%201;%20}";document.getElementsByTagName('head')[0].appendChild(css)})();
@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']});
@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 / 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 / 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 / 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;
<!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>

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:

@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('/')
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
background-color: black;
}