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
Feature: Rake tasks | |
In order to help my blog development | |
As a programmer | |
I want various rake tasks to simplify my life | |
Scenario: Populate posts table with rake db:populate:posts | |
Given I have an empty posts table | |
When I run "rake db:populate:posts" | |
Then the database should contain one or more posts |
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 'rake' | |
require 'rake/testtask' | |
require 'rake/rdoctask' | |
require 'tasks/rails' | |
load RAILS_ROOT + '/lib/tasks/populate.rake' | |
Given /^I have an empty (.+) table$/ do |table_name| | |
Kernel.const_get(table_name.singularize.camelize).destroy_all |
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 SpamReportsController < ApplicationController | |
before_filter :authorize, :except => :create | |
skip_before_filter :verify_authenticity_token, :only => :create | |
def index | |
@spam_reports = SpamReport.unconfirmed.popular | |
end | |
def show | |
@spam_report = SpamReport.find(params[:id]) |
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
Factory.define :category do |c| | |
c.sequence(:name) { |n| "Category #{n}" } | |
end | |
Factory.define :post do |p| | |
p.sequence(:title) { |n| "Title#{n}" } | |
p.body "Body" | |
p.categories [Factory(:category), Factory(:category)] | |
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
NSString *backgroundPath = [[NSBundle mainBundle] pathForResource:@"background-grouped-table" ofType:@"png"]; | |
UIImage *backgroundImage = [UIImage imageWithContentsOfFile:backgroundPath]; | |
UIColor *backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage]; | |
tableView.backgroundColor = backgroundColor; | |
[backgroundColor release]; |
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
export EC2_HOME=/opt/ec2-api-tools/ec2-api-tools-1.3-30349 | |
export PATH=$PATH:$EC2_HOME/bin | |
export EC2_PRIVATE_KEY=~/.ec2/pk-yr-mum.pem | |
export EC2_CERT=~/.ec2/cert-yr.pops.pem | |
export EC2_URL=eu-west-1.ec2.amazonaws.com | |
#export JAVA_HOME=/usr/lib/jvm/java-6-sun | |
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
cat .ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys' |
NewerOlder