This file contains 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 File.dirname(__FILE__) + '/../test_helper' | |
class PhotoTest < ActiveSupport::TestCase | |
# FIXME: http://thoughtbot.lighthouseapp.com/projects/8794/tickets/35-should_have_attached_file - AVS | |
should_have_attached_file :image, :styles => { :medium => "500", :thumb => "150x150#" }, | |
:path => ":rails_root/public/assets/images/:id/:style.:extension", | |
:url => "/assets/images/:id/:style.:extension", :validations => [] | |
should_belong_to :property |
This file contains 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
alias gemi='sudo gem install --no-rdoc --no-ri' | |
alias svnst='svn st | grep -v status | grep \s' | |
alias dns='dscacheutil -flushcache' | |
alias ls='ls -G' | |
alias grep='grep --color' | |
alias less='less -r' | |
alias m='mate' | |
# prompt |
This file contains 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
config.action_controller.asset_host = Proc.new do |source, request| | |
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com" | |
ssl_host = "https://asset1.backpackit.com" | |
if request.ssl? | |
case | |
when source =~ /\.js$/ | |
ssl_host | |
when request.headers["USER_AGENT"] =~ /(Safari)/ | |
non_ssl_host |
This file contains 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 Example < ActiveRecord::Base | |
includes | |
associations | |
named scopes | |
validations | |
This file contains 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
# http://pablotron.org/software/wirble/ | |
# Provides "ri", history survives restart etc | |
require 'rubygems' | |
require 'wirble' | |
Wirble.init | |
# http://www.quotedprintable.com/2007/9/13/my-irbrc | |
# Show rails root in script/console prompt | |
require 'irb/completion' |
This file contains 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
(function($){ | |
$.fn.inlineLabels = function(options){ | |
var settings = $.extend({ | |
suffix: '...' | |
}, options) | |
var inputs = this.find('input[type=text]') | |
inputs.data('labelText', inputs.prev('label')) | |
this.find('input[type=text]').each(function(i, input){ |
This file contains 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
# SUPER DARING APP TEMPLATE 1.0 | |
# By Peter Cooper | |
# Link to local copy of edge rails | |
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' } | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm public/favicon.ico" |
This file contains 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
run "rm public/index.html" | |
generate(:scaffold, "item name:string") | |
route "map.root :controller => :items" | |
rake("db:migrate", "production") | |
gem 'ruby-openid' | |
gem 'will-paginate', :git => 'git://github.com/mislav/will_paginate.git' | |
gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" | |
gist '60999', '.gitignore' |
This file contains 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 SurveysController < ApplicationController | |
# GET /surveys | |
# GET /surveys.xml | |
def index | |
@surveys = Survey.find(:all, :limit => 50) | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @surveys } | |
end |
This file contains 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
survey_controller_test.rb: | |
context 'PUT to update for existing survey' do | |
setup do | |
@survey = Factory(:survey) | |
put :update, :id => @survey.to_param, | |
:survey => Factory.attributes_for(:survey) | |
end | |
should_set_the_flash_to /updated/i |
OlderNewer