Skip to content

Instantly share code, notes, and snippets.

@bryan-ash
bryan-ash / specs.watchr.rb
Created January 6, 2010 04:09
Simple watchr script for running specs
# Run me with:
#
# $ watchr specs.watchr.rb
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def all_specs
Dir['spec/**/*_spec.rb']
end
@bryan-ash
bryan-ash / spike.treetop
Created January 6, 2010 01:25
Treetop grammar to find array of C enum elements
grammar Spike
rule typedef
'typedef enum { ' typedef_items ' }'
{
def items
typedef_items.items
end
}
end
@bryan-ash
bryan-ash / Treetop optional and mandatory spaces
Created January 6, 2010 01:17
Treetop rules for optional and mandatory spaces (thanks Clifford Heath)
rule s # Optional space
S?
end
rule S # Mandatory space
(white / comment_to_eol / comment_c_style)+
end
rule white
[ \t\n\r]+
@bryan-ash
bryan-ash / gist:86479
Created March 27, 2009 00:59
Basic layout for use with restfull authentication Rails app
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Test</title>
<%= javascript_include_tag :defaults %>
<%= stylesheet_link_tag 'site' %>
</head>