Skip to content

Instantly share code, notes, and snippets.

View topfunky's full-sized avatar
🛠️

Geoffrey Grosenbach topfunky

🛠️
View GitHub Profile
# 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
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
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
#!/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.
#
# 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.
@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"];
}];
#!/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;
(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)
if (Dir.exist?(NSBundle.mainBundle.privateFrameworksPath))
$:.map! { |x| x.sub(/^\/Library\/Frameworks/, NSBundle.mainBundle.privateFrameworksPath) }
$:.unshift NSBundle.mainBundle.resourcePath.fileSystemRepresentation
end
#!/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