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
# This is now part of the Ruby on Rails bundle in my textmate_paraphernalia repository | |
{ match = '(\b(xml|css)\b\.)(\b\w+\b!?)?'; | |
captures = { | |
2 = { name = 'variable.other.builder.rails'; }; | |
3 = { name = 'function.other.builder.rails'; }; | |
}; | |
}, |
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
# courtesy of http://heypanda.com/ | |
class TryProxy | |
def initialize(receiving_object) | |
@receiving_object = receiving_object | |
end | |
def method_missing(meth, *args, &block) | |
@receiving_object.nil? ? nil : @receiving_object.send(meth, *args, &block) rescue nil | |
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
# Rails template for Rails 2.3. Work in progress. | |
# By Henrik Nyh (http://henrik.nyh.se) 2009-03-29. Public domain. | |
# Usage: rails myapp -m http://gist.github.com/87341.txt | |
META_AUTHOR = "Henrik Nyh (http://henrik.nyh.se)" | |
JQUERY_VERSION = "1.3.2" | |
APP_NAME = File.basename(Dir.pwd) | |
git :init |
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 Integer | |
@@singles ||= ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] | |
@@teens ||= ['ten', 'eleven', 'twelve', 'thirteen', '', 'fifteen'] | |
@@tens ||= ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'] | |
@@places ||= [ 'hundred', 'thousand', 'million', 'billion', 'trillion', 'quadrillion', 'quintillion', | |
'sextillion', 'septillion', 'octillion', 'nonillion', 'decillion', 'undecillion', | |
'duodecillion', 'tredecillion', 'quattuordecillion', 'quindecillion', 'sexdecillion', | |
'septendecillion', 'octodecillion', 'novemdecillion', 'vigintillion'] # etc. | |
# (QUICKLY) Converts a number into English words. |
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
<!-- Got this from inside the gridz_app files | |
http://github.com/tschmidt/gridz_app | |
Other than that, I don't know where it's from, but I like it! --> | |
<h1>This document shows various HTML elements</h1> | |
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit Lorem ipsum dolor sit amet, volutpat. </p> | |
<h2>This is 2nd level heading bh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi luptatum zzril delenit Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam no</h2> | |
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p> |
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
/* Need to make a columnar CSS layout (for a 960-grid, say)? | |
Have a fixed width base to work off of (like 960 pixels)? | |
Want it in all kinds of sizes (2,3,4,5,6,8,10 & 12, say)? | |
Then this is the snippet for you! | |
In TextMate, you can just select all | |
of the following lines and press: | |
Ctrl + Shift + E (evaluate as ruby). | |
This snippet is based on a 960px base, |
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
# Having some fun with a simple Fibonacci sequence Hash! | |
fibonacci = Hash.new {|hash, key| hash[key] = hash[key - 1] + hash[key - 2]} | |
#=> {} | |
# Gotta get things started here… | |
fibonacci[1] = 1 | |
#=> 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
# Leopard Development Environment (from clean installation) | |
# Replace USERNAME with your OS X short name. | |
# Replace PASSWORD with your MySQL root password. | |
# Install XCode Tools | |
# Install MacPorts | |
# Install Textmate | |
# Generate an SSH key | |
ssh-keygen |
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
# Create a ViewHelper class or module (whatever) for dealing with flash messages in an easy-to-use format | |
# the current way: | |
<%- if flash[:error] -%> | |
<p class="error"><%= flash[:error] %></p> | |
<%- end -%> | |
<%- if flash[:notice] -%> | |
<p class="notice success"> | |
<%= flash[:notice] %> <%= link_to('View Now', view_post_path) if post_created %> | |
</p> |
OlderNewer