Skip to content

Instantly share code, notes, and snippets.

View benaskins's full-sized avatar
🍑
Peachy

Ben Askins benaskins

🍑
Peachy
View GitHub Profile
require File.dirname(__FILE__) + '/../spec_helper'
Machinist::load_blueprint :user
describe User do
describe 'Adam Administrator' do
before do
@adam = User.make(:role => "Administrator")
end
it 'can create administrators' do
module Machinist
class << self
def load_blueprint(name)
require "#{RAILS_ROOT}/blueprints/#{name}.rb"
end
end
end
@benaskins
benaskins / gist:23417
Created November 10, 2008 04:31
Namespace all controllers
for UNIT in `ls app/controllers`
do
sed s/class\ /class\ Admin::/g $UNIT > app/controllers/admin/$UNIT
rm app/controllers/$UNIT
done
httpd: apr_sockaddr_info_get() failed for plus2sandbox
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
Stopping apache22.
Waiting for PIDS: 83198.
Performing sanity check on apache22 configuration:
httpd: apr_sockaddr_info_get() failed for plus2sandbox
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
Starting apache22.
Then /^I should see an ordered list of "(.*)"$/ do |dom_id|
response.should have_selector("ol##{dom_id}")
end
class MyWorld < Cucumber::Rails::World
include Webrat::Matchers
end
World do
MyWorld.new
end
static VALUE
rb_ary_uniq_bang(ary)
VALUE ary;
{
VALUE hash, v, vv;
long i, j;
hash = ary_make_hash(ary, 0);
if (RARRAY(ary)->len == RHASH(hash)->tbl->num_entries) {
class Foo
attr_accessor :some_attr
def initialize(val)
self.some_attr = val
end
def ==(other)
self.some_attr == other.some_attr
end
end
@benaskins
benaskins / gist:34642
Created December 11, 2008 07:45 — forked from lachie/gist:34640
class Foo
attr_accessor :some_attr
def initialize(val)
self.some_attr = val
end
def hash
self.some_attr.hash
end
end
<image type="Synoptic chart" subtype="Analysis" day="0" width="640" height="480" format="JPEG">
<issue_day_name>Wednesday</issue_day_name>
<issue_time_local tz="EDT">2008-12-17T15:20:00</issue_time_local>
<valid_time tz="EDT">2008-12-17T16:00:00</valid_time>
<text>
A trough extending across southern Australia is bringing showers and storms, potentially severe in SA and VIC. Cool winds behind a cold front are affecting TAS. A monsoon trough and low are bringing heavy storms to the NT and WA whilst warm northerlies affect the remainder. The northern jet is dipping well south, allowing very warm air to reach southern coasts. The polar jet is directing a mass of cold air over the TAS, bringing below average temperatures.
</text>
<url scheme="" domain="" path="" filename="" parameters="">
http://www.weatherzone.com.au/httpdata_r/images/synoptic/wz_syn_aus_d0_640x480.jpg
</url>