Skip to content

Instantly share code, notes, and snippets.

View jakehow's full-sized avatar

Jake Howerton jakehow

View GitHub Profile
desc "Discover previous revision"
task :set_previous_revision do
previous_revision = ""
run "tail -2 #{deploy_to}/revisions.log" do |ch, stream, out|
previous_revision = out.split[3]
end
set :previous_revision, previous_revision
end
desc "Send release notes for latest revision via Basecamp"
module Watir
class Safari
def url
scripter.url
end
end
class AppleScripter
def url
@document.URL.get
require 'rubygems'
require 'atom'
require 'gcalendar'
require 'net/https'
require 'uri'
LAST_CHECKED = Time.now - 36000
HIGHRISE_URL = 'x.highrisehq.com' #set this to your url
class Meeting
#!/bin/bash
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost
apt-get update
apt-get upgrade -y
apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev
apt-get -y install mysql-server libmysqlclient15-dev mysql-client
apt-get -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8
RUBYGEMS="rubygems-1.3.0"
Story: Creating an account
As an anonymous user
I want to be able to create an account
So that I can be one of the cool kids
Scenario: Anonymous user can not start creating an account
Given an anonymous user
When she goes to /users/new
Then she should be redirected to 'http://www.example.com/session/new'
class Array
def flatten
each_with_index do |object, index|
if object.kind_of?(Array)
delete_at(index)
insert(index, *object.flatten)
end
end
end
end
+------------------------------------------------------+
| date | total_boxes | available_boxes |
+------------------------------------------------------+
| 2008-11-01 | 392 | 0 |
| 2008-10-01 | 392 | 0 |
| 2008-09-01 | 392 | 0 |
| 2008-08-01 | 392 | 0 |
| 2008-07-01 | 392 | 0 |
| 2008-06-01 | 392 | 0 |
| 2008-05-01 | 384 | 4 |
>> cx.class
=> Mysql
>> my.class
=> Mysql
>> my.query(sql)
=> #<Mysql::Result:0x2adfbf80ea48>
>> cx.query(sql)
Mysql::Error: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
from (irb):41:in `query'
from (irb):41
>> class Blah < CouchRest::ExtendedDocument
>> property :myval
>> property :trueval
>> def myval=(val)
>> self.trueval = val
>> end
>> end
=> nil
>> b = Blah.new(:myval => 10)
=> {"couchrest-type"=>"Blah", "myval"=>10}
>> s = Statement.new
=> {"updated_at"=>nil, "couchrest-type"=>"Statement", "created_at"=>nil}
>> s.create_attachment(:name => 'test.txt', :content_type => 'text/plain', :file => File.open('test.txt'))
=> {"content-type"=>"text/plain", "data"=>"dGVzdAo="}
>> s.save
=> nil
>> s['_attachments']['test.txt']
=> {"content-type"=>"text/plain", "data"=>"ZEdWemRBbz0="}
>> s['_attachments']['test.txt']['content-type']
=> "text/plain"