Skip to content

Instantly share code, notes, and snippets.

View arnklint's full-sized avatar
😀
writing status

Jonas Arnklint arnklint

😀
writing status
View GitHub Profile
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/raw/248940/c31e540b1b68236697fe8c0f32e6b83a39978797/Rails%20MongoMapper%20Template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names
@arnklint
arnklint / post.rb
Created August 15, 2009 20:21 — forked from standout/post.rb
spam protection
class Post < ActiveRecord::Base
attr_accessor :comment # fake attribute used for spam trapping
validates_length_of :comment, :in => 0..1
end
@arnklint
arnklint / form-field.tmSnippet
Created August 10, 2009 20:19
Rails field snippet
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string>&lt;p&gt;
${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.label :${1:attribute}${2:, "${3:${1/[[:alpha:]]+|(_)/(?1: :\u$0)/g}}"}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}&lt;br /&gt;
${TM_RAILS_TEMPLATE_START_RUBY_EXPR}f.text_field :${1/(\w*).*/$1/ig}${TM_RAILS_TEMPLATE_END_RUBY_EXPR}
&lt;/p&gt;</string>
<key>name</key>