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
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
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
#!/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
# 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
// 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
#!/usr/bin/perl | |
# Graphical tree output of a filesystem | |
# `tree somepath_to_start_from` | |
# | |
# TODO show actual graphical output with dashes and bars | |
# TODO allow command-line options | |
use strict; | |
use File::Find; |
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
(defun enter-to-previous-line () | |
(interactive) | |
(beginning-of-line) | |
(newline-and-indent) | |
(previous-line) | |
(indent-according-to-mode)) | |
(define-key textmate-mode-map [C-return] 'enter-to-previous-line) | |
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
if (Dir.exist?(NSBundle.mainBundle.privateFrameworksPath)) | |
$:.map! { |x| x.sub(/^\/Library\/Frameworks/, NSBundle.mainBundle.privateFrameworksPath) } | |
$:.unshift NSBundle.mainBundle.resourcePath.fileSystemRepresentation | |
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
#!/usr/bin/env ruby | |
# Textileise things. | |
# Take Textile markup on STDIN, and output HTML to STDOUT | |
require "rubygems" | |
require "redcloth" | |
print (RedCloth.new STDIN.read).to_html |