- Ruby - what is bundler? - Tom Clark
- git - tags vs branches - Tom Bates
- git - rebase vs merge - Tom Altree
- Ruby modules and
include
,extend
,prepend
- Duncan Smith - Ruby's Enumerable and Enumerators - John Foulkes
- Ruby's blocks, procs and lambdas - Chris Rigby
- Inheritance vs Composition, with examples in Ruby - James Walsh
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
Feature: Tag logic | |
In order to conveniently run subsets of features | |
As a Cuker | |
I want to select features using logical AND/OR of tags | |
Background: | |
Given a file named "features/test.feature" with: | |
""" | |
@feature | |
Feature: Sample |
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
puts "*" * 100 | |
require 'cucumber/wire_support/wire_language' | |
class WireFilter < Cucumber::Core::Filter.new(:wire) | |
def test_case(test_case) | |
wire.begin_scenario(test_case) | |
test_case.describe_to receiver | |
wire.end_scenario | |
end | |
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
r.match('/designer/:photo_id/crop').name(:cropper) do |cropper| | |
cropper.match(:method => :get).to(:controller => 'crops', :action => 'new') | |
cropper.match(:method => :post).to(:controller => 'crops', :action => 'create') | |
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
def create | |
only_provides :json | |
if params[:Filedata] | |
@photo = Photo.new_from_filedata(params[:Filedata]) | |
if @photo.save | |
render '', :status => 200 | |
else | |
raise NotAcceptable | |
end | |
else |
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 Items < ActiveRecord::Base | |
def update | |
@item = Items.find(params[:id]) | |
raise NotFound unless @item | |
if @item.update_attributes(params[:item]) | |
redirect url(:item, item) | |
else | |
raise BadRequest | |
end | |
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
RESULTS = %w(H H H H H H A A A A A D) | |
def result | |
RESULTS[rand(RESULTS.length)] | |
end | |
require 'readline' | |
def prompt(prompt="> ") | |
input = nil |
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
Merb::BootLoader.after_app_loads do | |
config_path = Merb.root / 'config' / 'starling.yml' | |
load_path = Merb.root / 'app' / 'workers' | |
if File.exists?(config_path) | |
Workling::Client.options = YAML.load_file(config_path)[Merb.environment.to_sym] | |
Dir.glob(load_path / '**' / '*.rb').each { |wling| require wling } | |
else | |
Merb.logger.error! "No starling.yml file found in #{Merb.root}/config." | |
exit(1) |
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
# works | |
gem('activemerchant'); require 'active_merchant' | |
# fails with FATAL: The file activemerchant was not found | |
dependency('activemerchant') { require 'active_merchant' } |
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 'rubygems' | |
require 'cucumber/rake/task' | |
Cucumber::Rake::Task.new(:features) do |t| | |
t.cucumber_opts = "--format pretty" | |
end |