Skip to content

Instantly share code, notes, and snippets.

@mdeiters
mdeiters / Gemfile
Created April 9, 2012 14:50 — forked from itzki/Gemfile
follow from coderwall leaderboard
source "https://rubygems.org"
gem 'mechanize'
gem 'twitter'
@mdeiters
mdeiters / apology101.markdown
Created March 22, 2012 17:53 — forked from avdi/apology101.markdown
How to apologize

Chances are your head's spinning right now. That accusation of bias caught you off guard, you got kind of defensive, and now all hell has broken loose. You're feeling attacked on all sides. You're a good person at heart, and having all these people treat you like the antichrist is pretty upsetting.

You need to say something, but you're probably not in the best headspace to write copy right now. So to help you along, here's my 100% guaranteed-or-you-money-back scandal defusement apology template:

@mdeiters
mdeiters / about.md
Created August 9, 2011 14:21 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@mdeiters
mdeiters / gist:1120324
Created August 2, 2011 14:40 — forked from fhwang/gist:1120210
Git pre-commit hook for JSHint and Rails
#!/usr/bin/env ruby
# To use this:
# * Set up the jshint Gem with your Rails app: https://github.com/liquid/jshint_on_rails
# * Copy this file to [YOURPROJECT]/.git/hooks/pre-commit
# * chmod 0755 .git/hooks/pre-commit
files_changed = `git diff --name-only HEAD`
if files_changed.any? { |line| line =~ %r|public/javascripts| }
puts "Running jshint to check changes to javascript ..."
@mdeiters
mdeiters / gist:975231
Created May 16, 2011 20:04 — forked from mislav/gist:938183
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
# Hook our MongoMapper model into Solr
module MongoAdapter
class InstanceAdapter < Sunspot::Adapters::InstanceAdapter
def id
@instance.id
end
end
class DataAccessor < Sunspot::Adapters::DataAccessor
def load(id)
@mdeiters
mdeiters / gist:12124
Created September 22, 2008 19:43 — forked from anonymous/gist:12123
class Show
has_many :scenes
end
class Scene
has_one :scenable :as => :scenable
end
class Announcement
belongs_to :scenable, :polymorphic => true
@mdeiters
mdeiters / gist:12106
Created September 22, 2008 19:20 — forked from anonymous/gist:12101
map.resources :divisions do |division|
division.resources :wss_configs
division.resources :websites
division.resources :urls
division.resources :announcements
division.resources :attachments
division.resources :scenes
end
map.resources :articles, :has_many => [:comments], do |article|