Skip to content

Instantly share code, notes, and snippets.

View awesome's full-sized avatar

So Awesome Man awesome

View GitHub Profile
@awesome
awesome / unit methods
Created January 23, 2009 07:42 — forked from soawesomeman/gist:46666
minitest/unit methods
>> pp MiniTest::Unit::TestCase.instance_methods.sort - Object.methods
["_assertions",
"_assertions=",
"assert",
"assert_block",
"assert_empty",
"assert_equal",
"assert_in_delta",
"assert_in_epsilon",
"assert_includes",
@awesome
awesome / config.ru
Created March 30, 2009 23:59 — forked from mtodd/config.ru
use Rack::Auth::Basic do |login, password|
# Account.find_by_login(login) returns a Hash:
# account = {:login => "dude", :password => "awesome"}
account = Account.find_by_login(login)
account.authenticate(password)
end
run Fuck
# so...
use Rack::Auth::Basic do |login, password|
Given /^I visit subdomain (.+)$/ do |sub|
host! "#{sub}.#{TEST_DOMAIN}" #TEST_DOMAIN is defined in test.rb. In my case TEST_DOMAIN = 'example.com'
end

HOWTO: iPhone AT&T Tethering

In 10 steps:

  • Update iTunes to 8.2 via Software Update
  • Update your iPhone to the 3.0 release (out today - June 17th)
  • Download this dmg and mount it: tethering file
  • Enable hidden carrier testing option (in Terminal.app): defaults write com.apple.iTunes carrier-testing -bool TRUE
  • Start up iTunes
Then(/^I should be at (.+?) page$/) do |page_name|
request.path.should =~ /^#{path_to(page_name + " page")}/
end
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
#!/usr/bin/env ruby
# -*- ruby -*-
require 'rubygems'
require 'daemon-spawn'
RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
class DelayedJobWorker < DaemonSpawn::Base
def start(args)
ENV['RAILS_ENV'] ||= args.first || 'development'
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
@awesome
awesome / gist:186376
Created September 13, 2009 23:43 — forked from mwunsch/gist:109799
require 'nokogiri'
# = XmlMini Nokogiri implementation
module ActiveSupport
module XmlMini_Nokogiri #:nodoc:
extend self
# Parse an XML Document string into a simple hash using libxml / nokogiri.
# string::
# XML Document string to parse
@awesome
awesome / cancan.rb
Created February 16, 2010 22:41 — forked from ryanb/cancan.rb
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new # guest user
if user.role? :admin
can :manage, :all
else
can :read, :all