Skip to content

Instantly share code, notes, and snippets.

View mattpolito's full-sized avatar

Matt Polito mattpolito

View GitHub Profile
@gus
gus / ruby-coding-style.md
Created July 8, 2010 14:16
Coding in Ruby - mostly the Gus way

Hijacked from Christian Neukirchen's Ruby Style Guide

Coding in Ruby

These are guides, not rules. There are always reasons to not do something, but if you can stay on this road for as long as possible, at least Gus will be happy.

General

  • Use common sense.
  • Be consistent.
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@mislav
mislav / template-uri.rb
Created September 27, 2009 15:31
URI templates are, like, super-useful
# https://github.com/sporkmonger/addressable/
require 'addressable/template'
# http://dev.twitter.com/doc/get/statuses/followers
template = Addressable::Template.new 'http://{host=twitter.com}' +
'/statuses/followers{-prefix|/|id}.{format=json}' +
'?{-join|&|user_id,screen_name,cursor}'
template.expand(:id => 'mislav')
# => http://twitter.com/statuses/followers/mislav.json?
require 'net/dns/resolver'
# Custom Domain
#
# Require net-dns gem
#
# A Rack middleware to to resolve the custom domain to original subdomain
# for your multi telent application.
#
# It's all transperant to your application, it performs cname lookup and