Skip to content

Instantly share code, notes, and snippets.

Dallas Reedy dallas

Block or report user

Report or block dallas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dallas
dallas / syntax highlighting for Rails builders in TextMate
Created Jun 24, 2009
Syntax highlighting for Rails builders in TextMate (add to the Ruby on Rails language)
View syntax highlighting for Rails builders in TextMate
# 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'; };
};
},
@dallas
dallas / try.rb
Created Jul 8, 2009 — forked from CodeOfficer/try.rb
TryProxy by CodeOfficer from heypanda.com
View try.rb
# 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
@dallas
dallas / rails_template.rb
Created Jul 8, 2009 — forked from henrik/rails_template.rb
Rails template for v2.3 by henrik
View rails_template.rb
# 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
@dallas
dallas / to_word.rb
Created Aug 9, 2009
implementation of Integer#to_word
View to_word.rb
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.
@dallas
dallas / html_examples.html
Created Aug 10, 2009
HTML elements—like, all of 'em
View html_examples.html
<!-- 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>
@dallas
dallas / easy_columns.css
Created Aug 13, 2009
thoughts on CSS columnar grids in TextMate
View easy_columns.css
/* 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,
@dallas
dallas / fun with Fib.rb
Created Aug 13, 2009
having fun with Hash initializer and the Fibonacci Sequence
View fun with Fib.rb
# 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
@dallas
dallas / gist:176414
Created Aug 27, 2009 — forked from laserlemon/gist:175993
software install directions by laserlemon
View gist:176414
# 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
@dallas
dallas / gist:178685
Created Aug 31, 2009
IRb enhancements & settings
We couldn’t find that file to show.
@dallas
dallas / flash_message.rb
Created Dec 3, 2009
The beginnings of Flashtastic!
View flash_message.rb
# 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>
You can’t perform that action at this time.