Skip to content

Instantly share code, notes, and snippets.

View robdodson's full-sized avatar
🏠
Working from home

Rob Dodson robdodson

🏠
Working from home
View GitHub Profile
@robdodson
robdodson / index.html
Created April 3, 2012 04:13
D3.js Population Bar Chart
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Population Projection</title>
<link rel="stylesheet" href="main.css">
</head>
@robdodson
robdodson / anagram.rb
Created May 5, 2012 15:31
Anagrams in Ruby
#!/usr/bin/env ruby -wKU
require 'optparse'
dictionary = '/usr/share/dict/words'
OptionParser.new do |opts|
opts.banner = 'Usage: anagram [ options ] word...'
opts.on('-d', '--dict path', String, 'Path to dictionary') do |dict|
@robdodson
robdodson / main.js
Created May 21, 2012 17:15
backbone-boilerplate-main.js
require([
"namespace",
// Libs
"jquery",
"use!backbone",
// Modules
"modules/example"
],
@robdodson
robdodson / main.js
Created May 22, 2012 03:53
Busted backbone router. Search doesn't work
require([
"namespace",
// Libs
"jquery",
"use!backbone",
// Modules
"modules/example"
],
@robdodson
robdodson / ease.js
Created May 25, 2012 19:06
CSS3 Ease
/*
CSS3 Penner Easing equations taken from Ceaser (http://matthewlein.com/ceaser/)
Note: easeInBack, easeOutBack, and easeInOutBack are not supported in older versions
of Webkit. For a fix please visit the Ceaser page.
*/
define(function() {
return {
@robdodson
robdodson / app.js
Created May 28, 2012 18:52
pickle store!
// Routes
var count = 100;
app.get('/', function(req, res) {
res.send('Welcome to the Pickle Store!');
});
app.get('/pickles', function(req, res) {
res.json({
@robdodson
robdodson / app.js
Created May 31, 2012 05:18
pivotal scraper
var app = require('express').createServer();
var http = require('http');
var token = 'xxxxxxxxxxxxxxxx';
var projectID = 'xxxxxxxxx';
app.get('/', function(req, res) {
res.send('index page!');
});
app.get('/project', function(req, res) {
@robdodson
robdodson / main.js
Created June 3, 2012 01:40
states in progress
var player = {
state: undefined,
states: {
base: {
initialize:function(target) {
this.target = target;
},
enter: function() {
// Implement me in your state objects
},
@robdodson
robdodson / snippet.txt
Created June 3, 2012 03:45
prototypes
function Car() {
}
Car.prototype.start = function() {
console.log('vroom vroom!');
}
@robdodson
robdodson / crawler.rb
Created June 20, 2012 07:06
Crawl a page full of links with Mechanize
require 'mechanize'
# Create a new instance of Mechanize and grab our page
agent = Mechanize.new
page = agent.get('http://robdodson.me/blog/archives/')
# Find all the links on the page that are contained within
# h1 tags.
post_links = page.links.find_all { |l| l.attributes.parent.name == 'h1' }