Skip to content

Instantly share code, notes, and snippets.

View topfunky's full-sized avatar
🛠️

Geoffrey Grosenbach topfunky

🛠️
View GitHub Profile
@topfunky
topfunky / gist:52512
Created January 25, 2009 20:19 — forked from jm/gist:52501
// 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"];
}];
# 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.
#!/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.
#
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
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
# 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
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
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"
# 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
# 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