Skip to content

Instantly share code, notes, and snippets.

View dannydb's full-sized avatar

Danny DeBelius dannydb

View GitHub Profile
@ashaw
ashaw / sankey.js
Last active August 29, 2015 13:56
var Sankey = function(opts) {
this.opts = opts;
this.el = $("#" + this.opts.el);
this.graphsReady = 0;
this.graphWidth = this.el.width();
};
Sankey.prototype.initPaper = function() {
this.paper = Raphael(document.getElementById(this.opts.el));
};
@ryanpitts
ryanpitts / Ryan's Rush Timeline
Created April 1, 2014 20:24
Just one song from each Rush studio album, in chronological order.
Working Man
In The End
Bastille Day
2112 Overture
Closer To The Heart
The Trees
The Spirit Of Radio
Limelight
Subdivisions
Distant Early Warning
@rdmurphy
rdmurphy / problems.md
Last active August 29, 2015 14:07
Yosemite Upgrade Problems

Problems I Had With OS X Yosemite (10.10)

PostgreSQL Wouldn't Start

Tried to run postgres -D /usr/local/var/postgres and got this:

FATAL: could not open directory "pg_tblspc": No such file or directory

An easy fix. The Yosemite install blows away some empty directories that PostgreSQL expects.

@TylerFisher
TylerFisher / LICENSE
Last active August 29, 2015 14:08
This code will refresh all users on your webpage upon deployment of a timestamp.json file to S3. We used this to deploy hotfixes on election night for elections.npr.org. It requires Fabric (a Python library for running tasks on the command line) and jquery-cookie.js, but could easily be refactored to not.
The MIT License (MIT)
Copyright (c) 2014 NPR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@jeremyjbowers
jeremyjbowers / fix_ur_postgres.sh
Created February 11, 2015 16:32
A quickie shell script for fixing your Postgres installation on a Mac when migrating from 9.3.5 to 9.4.1 via homebrew.
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
initdb /usr/local/var/postgres9.4 -E utf8
pg_upgrade -v \
-d /usr/local/var/postgres \
-D /usr/local/var/postgres9.4 \
-b /usr/local/Cellar/postgresql/9.3.5_1/bin/ \
-B /usr/local/Cellar/postgresql/9.4.1/bin/
mv /usr/local/var/postgres /usr/local/var/postgres9.3
mv /usr/local/var/postgres9.4 /usr/local/var/postgres
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
@harrisj
harrisj / article_fetcher.rb
Created June 22, 2012 20:16
Basic code for the nytimes_ebooks
# encoding: UTF-8
require 'rubygems'
require 'rest-client'
require 'nokogiri'
class ArticleFetcher
def self.fetch_text(url)
case url
when /video\.nytimes\.com/
@vwall
vwall / gist:3824648
Created October 3, 2012 02:45 — forked from demimismo/gist:3359506
Install Postgresql on Mountain Lion

Install Postgresql on Mountain Lion

Based on: http://coderwall.com/p/1mni7w

brew install postgresql
initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
// Types
var one = 1;
var two = 2;
three;
window.three;
window.one = 1;
one = 1;
var one = [];
var one = {one: 1};
one.two = 1;
require 'sinatra'
require 'sanitize'
TO_REMOVE = ["", " ", " "]
get '/' do
<<-HTML
<form method="post" action="sanitize">
<textarea name="dirty" style="width:100%;height:800px;"></textarea>
<input type="submit" value="Submit">
@parisminton
parisminton / commaify.js
Created July 8, 2013 17:44
This function will automatically insert commas after the thousands place of any number. Returns a string. Useful for calculations that appear in copy. Call 'commaify(some_dynamic_integer);'
function commaify (num) {
var num_string,
i,
len,
threes = [],
remainders;
num_string = num.toString();
len = num_string.length;
remainders = len % 3;