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
// And what about block-based contexts: | |
NSString * myString = @"Bacon"; | |
[self test:@"has a class of NSString" code:^{ | |
// Old style | |
STAssertTrue([myString isKindOfClass:[NSString class]], @"Got %@ class", [myString class]); | |
// BDD style? | |
[[myString className] shouldEqual:@"NSCFString"]; | |
}]; |
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
# DESCRIPTION: Cap task to setup the current (initialized) git directory as a remote repository. | |
# | |
# INSTALL: Copy to home directory as ~/.caprc | |
# RUN: cap git:setup scm=t | |
# | |
# AUTHOR: Geoffrey Grosenbach http://peepcode.com | |
# | |
# Assumes ability to run commands as sudo and the presence of a "git" user and group on remote server. | |
# The Capistrano :user is used only to connect and setup directories. | |
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
#!/bin/env ruby | |
## | |
# Originally from http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/StakingOutFileChanges.rdoc | |
# Modified by Geoffrey Grosenbach http://peepcode.com | |
# | |
# Watches files and runs a command when any of them are modified. | |
# | |
# If one argment is given, will run that command and watch app, lib, test, spec. | |
# |
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
desc "Uninstall all Merb gems for a fresh start" | |
task "merb:uninstall" do | |
cmd = [ | |
"gem list", | |
"grep merb", | |
"cut -d ' ' -f 1", | |
"xargs sudo gem uninstall --all" | |
].join(" | ") | |
system(cmd) | |
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
require 'rubygems' | |
require 'merb-core' | |
Merb::Config.setup(:merb_root => ".", | |
:environment => ENV['RACK_ENV']) | |
Merb.environment = Merb::Config[:environment] | |
Merb.root = Merb::Config[:merb_root] | |
Merb::BootLoader.run | |
run Merb::Rack::Application.new |
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
# OUTPUT | |
# Called with: foo : html : flatapp_rc5 | |
# Called with: flatapp_rc5 : html : flatapp_rc5 | |
# Called with: application : html : flatapp_rc5 | |
class FlatappRc5 < Merb::Controller | |
def _template_location(action, type = nil, controller = controller_name) | |
puts "Called with: " + [action, type, controller_name].join(" : ") | |
# This works better for taking advantage of views/application.html.erb |
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
irb> require 'rubygems'; require 'beanstalk-client'; | |
irb> p = Beanstalk::Pool.new(['localhost:11300']) | |
EOFError: EOFError | |
irb> p.put "hello" | |
EOFError: EOFError | |
EOFError: EOFError | |
SocketError: getaddrinfo: Name or service not known | |
Beanstalk::NotConnected: Beanstalk::NotConnected |
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
desc "Install merb from the repository" | |
task :default do | |
system "sudo gem install wycats-thor -s http://gems.github.com" | |
system "curl -L http://merbivore.com/merb.thor > merb.thor" | |
system "sudo thor merb:edge --install" | |
system "sudo thor merb:edge:plugins ---install" | |
system "sudo thor merb:edge:do mysql --install" | |
system "sudo thor merb:edge:dm_core --install" | |
system "sudo thor merb:edge:dm_more --install" |
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
# Updated for current plugin | |
def log_to_exceptional(exception) | |
logger.info "Exception #{exception.inspect}" | |
Exceptional.handle(exception, self, request, params) | |
rescue NoMethodError | |
logger.info "Couldn't log to Exceptional" | |
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
# NOTE: See further development and a gem at http://github.com/topfunky/basic_model | |
require 'couchrest' | |
## | |
# A minimal class to help use CouchDB and CouchRest with Rails. | |
# | |
# Provides dot notation access for all attributes, one level deep. | |
# | |
# note.title |