This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pyrite_helper' | |
class SampleTest < Pyrite::PyriteTest | |
test "homepage" do | |
visit root_path # use rails roots, or "/some/path/to/page" | |
follow "A Link" # link label text | |
press "A Button" # press a button with the value "A Button" | |
click "#anything_else" # any other elements can be clicked using a CSS selector | |
wait_for :page_load # we don't wait automatically, because that causes problems | |
assert_text "some text you should see" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get current git branch | |
git_prompt_info() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) | |
if [[ -n $ref ]]; then | |
echo "[${ref#refs/heads/}]" | |
fi | |
} | |
# set prompt a la Ubuntu, but with added git branch (if any) | |
export PS1='\u@\h:$(git_prompt_info)\w$ ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem sources -a http://gems.whatever.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo env ARCHFLAGS="-arch i386 -arch x86_64" | |
$ gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/lib/mysql --with-mysql-config=/usr/loca /bin/mysql_config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'thor' | |
require 'twitter' | |
class TNT < Thor | |
map "MESSAGE" => :post | |
desc "post \"message\"", "Post a message to Twitter" | |
def post(message) | |
client.update message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up the Rails environment for Cucumber | |
ENV["RAILS_ENV"] ||= "test" | |
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') | |
require 'cucumber/rails/world' | |
# turn off transactions | |
Cucumber::Rails::World.use_transactional_fixtures = false | |
# configure webrat to use selenium | |
Webrat.configure do |config| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ImageHelpers | |
def image_path(size) | |
case size | |
when "thumbnail" | |
File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "fixtures", "adam_mint.jpg")) | |
# NOTE: I created a sub dir of "support" called "fixtures" in which to place test files. | |
else | |
raise "don't know where to find a #{size} image" | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit to: http://simonwillison.net/2006/Jan/20/escape/ | |
RegExp.escape = function(text) { | |
if (!arguments.callee.sRE) { | |
var specials = [ | |
'/', '.', '*', '+', '?', '|', | |
'(', ')', '[', ']', '{', '}', '\\' | |
]; | |
arguments.callee.sRE = new RegExp( | |
'(\\' + specials.join('|\\') + ')', 'g' | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ListController < ApplicationController | |
def index | |
@upload = Upload.list_all_torrents | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.list_all_files | |
find(:all, :order => "created_at DESC") | |
end | |
end |