Skip to content

Instantly share code, notes, and snippets.

View therabidbanana's full-sized avatar

David Haslem therabidbanana

  • Pathstream
  • San Francisco
View GitHub Profile
@therabidbanana
therabidbanana / README.txt
Created March 14, 2012 14:08 — forked from mikekelly/0_README.txt
A potential new version of hal
I've been playing with the idea of combining the data array defined in application/collection+json
(http://amundsen.com/media-types/collection/format/) with hal links for templated data.
Seems like a good way to keep the media type lightweight while allowing the api to specify the fields
it would like passed to a given resource.
I haven't really given much thought to an xml variation, but I took a stab at it as well.
@therabidbanana
therabidbanana / assets.rake
Created January 30, 2012 21:46
Fix broken mongo railtie
# lib/tasks/assets.rake
#
# adapted from: http://blog.noizeramp.com/2011/10/14/rails-3-asset-pipeline-on-heroku-when-using-mongoid/
#
pt = Rake::Task['assets:environment']
Rake.application.send(:eval, "@tasks.delete('assets:environment')")
namespace :assets do
task :environment do
module ::MongoMapper::Connection
@therabidbanana
therabidbanana / wizard.rb
Created December 10, 2011 05:24
My Tweaked Rails Wizard
#
# $ rails new [app_name] -m https://raw.github.com/gist/1454641/wizard.txt -T -O
#
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
@therabidbanana
therabidbanana / awesome.js
Created November 3, 2011 22:50
Turntable Fluid SSB enhancments
// ==UserScript==
// @name Awesome
// @namespace http://fluidapp.com
// @description What does this do?
// @include *
// @author Someone
// ==/UserScript==
(function () {
@therabidbanana
therabidbanana / gist:1041444
Created June 22, 2011 22:39 — forked from jergason/gist:1041434
Two has-and-belongs-to-many Properties to the same model
class Comparison
include DataMapper::Resource
property :id, Serial
has n, :msruns, :through => Resource
has n, :secondary_msruns, "Msrun", :through => SecondaryMsrunComparison, :via => :msrun
belongs_to :metric
end
class Msrun
@therabidbanana
therabidbanana / test_git_pull_nanoc.sh
Created June 22, 2011 14:43
Shell script testing Nanoc compile directly after git pull
#!/bin/bash
cd /tmp
# Set up site 1.
nanoc create_site foo
cd foo
git init
git add .
git commit -m "Init"
@therabidbanana
therabidbanana / apiwars.rb
Created April 6, 2011 21:36
A Simple HTTP script to automate finding grid spaces. (For http://therabidbanana.github.com/apiwars)
# this script's occupy method didn't work very well. HTTParty isn't good at PUTs.
#
# Try rest-client gem instead:
#
#
# $ gem install rest-client
# $ restclient 'http://apiwars.heroku.com'
# > get '/grid/123', {:params => {:api => '...', :pin => '2222'}}
# ---> {...}
# > put '/grid/123', {:api => '...', :pin => '...', :unit => 'testunit'}
@therabidbanana
therabidbanana / git-dash.sh
Created February 10, 2011 22:18
A shell script to show status of several git directories at once.
#!/bin/bash
git_is_dirty(){
if [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]]; then
echo "1"
else
echo "0"
fi
}
DIR=`pwd`
startshape banana;
rule banana{
apple{ s 1.5 hue 67 b .9 sat .7}
}
rule apple {
SQUARE { skew 1.2 .9 }
tree { }
apple { s .989 r 10 hue 12 }
@therabidbanana
therabidbanana / Gemfile
Created August 20, 2010 04:22
A simple sparkles app with blog
# Gemfile
source "http://rubygems.org"
gem "openid_dm_store", :git => "git://github.com/therabidbanana/openid_dm_store.git"
gem "orange-more", :git => "git://github.com/therabidbanana/orange-more.git"
gem "orange-core", :git => "git://github.com/therabidbanana/orange-core.git"
gem "orange-sparkles", :git => "git://github.com/orange-project/orange-sparkles.git"
gem "dm-postgres-adapter"