Skip to content

Commit

Permalink
start converting to the snipmate format, still lots to do
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Grenfell committed Feb 18, 2009
1 parent 522e5ca commit ba6fa12
Show file tree
Hide file tree
Showing 112 changed files with 234 additions and 220 deletions.
4 changes: 2 additions & 2 deletions ruby-rails/asd.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
assert_difference "<+Model+>.<+count+>", <+Model+> do
<++>
end
<++>
end
4 changes: 2 additions & 2 deletions ruby-rails/asnd.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
assert_no_difference "<+Model+>.<+count+>" do
<++>
end
<++>
end
22 changes: 11 additions & 11 deletions ruby-rails/defcreate.snippet
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
def create
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])

respond_to do |wants|
if @\<c-r>=NS_underscore(snippet_classname)\<cr>.save
flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully created.'
wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>, :status => :created, :location => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
else
wants.html { render :action => "new" }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
end
end
respond_to do |wants|
if @\<c-r>=NS_underscore(snippet_classname)\<cr>.save
flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully created.'
wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>, :status => :created, :location => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
else
wants.html { render :action => "new" }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
end
end
end
12 changes: 6 additions & 6 deletions ruby-rails/defdestroy.snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
def destroy
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
@\<c-r>=NS_underscore(snippet_classname)\<cr>.destroy
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
@\<c-r>=NS_underscore(snippet_classname)\<cr>.destroy

respond_to do |wants|
wants.html { redirect_to(\<c-r>=NS_underscore(snippet_classname)\<cr>s_url) }
wants.xml { head :ok }
end
respond_to do |wants|
wants.html { redirect_to(\<c-r>=NS_underscore(snippet_classname)\<cr>s_url) }
wants.xml { head :ok }
end
end
2 changes: 1 addition & 1 deletion ruby-rails/defedit.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def edit
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
end
10 changes: 5 additions & 5 deletions ruby-rails/defindex.snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def index
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.all
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.all

respond_to do |wants|
wants.html # index.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>s }
end
respond_to do |wants|
wants.html # index.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>s }
end
end
10 changes: 5 additions & 5 deletions ruby-rails/defnew.snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def new
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.new

respond_to do |wants|
wants.html # new.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
end
respond_to do |wants|
wants.html # new.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
end
end
10 changes: 5 additions & 5 deletions ruby-rails/defshow.snippet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def show
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])

respond_to do |wants|
wants.html # show.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
end
respond_to do |wants|
wants.html # show.html.erb
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr> }
end
end
22 changes: 11 additions & 11 deletions ruby-rails/defupdate.snippet
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
def update
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])
@\<c-r>=NS_underscore(NS_prompt("snippet_classname", "Model ClassName", ""))\<cr> = \<c-r>=snippet_classname\<cr>.find(params[:id])

respond_to do |wants|
if @\<c-r>=NS_underscore(snippet_classname)\<cr>.update_attributes(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully updated.'
wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
wants.xml { head :ok }
else
wants.html { render :action => "edit" }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
end
end
respond_to do |wants|
if @\<c-r>=NS_underscore(snippet_classname)\<cr>.update_attributes(params[:\<c-r>=NS_underscore(snippet_classname)\<cr>])
flash[:notice] = '\<c-r>=snippet_classname\<cr> was successfully updated.'
wants.html { redirect_to(@\<c-r>=NS_underscore(snippet_classname)\<cr>) }
wants.xml { head :ok }
else
wants.html { render :action => "edit" }
wants.xml { render :xml => @\<c-r>=NS_underscore(snippet_classname)\<cr>.errors, :status => :unprocessable_entity }
end
end
end
2 changes: 1 addition & 1 deletion ruby-rails/mapwo.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<+map+>.with_options :<+controller+> => '<+thing+>' do |<+thing+>|
<++>
<++>
end
2 changes: 1 addition & 1 deletion ruby-rails/mct.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
create_table :<+table_name+> do |t|
t.column :<+name+>, :<+type+>
t.column :<+name+>, :<+type+>
end
12 changes: 6 additions & 6 deletions ruby-rails/migration.snippet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class \<c-r>=Snippet_MigrationNameFromFilename()\<cr> < ActiveRecord::Migration
def self.up
<++>
end
def self.up
<++>
end

def self.down
<++>
end
def self.down
<++>
end
end
2 changes: 1 addition & 1 deletion ruby-rails/rest.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
respond_to do |wants|
wants.<+html+> <+{ <++> }+>
wants.<+html+> <+{ <++> }+>
end
4 changes: 2 additions & 2 deletions ruby-rails/ru.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
render :update do |<+page+>|
<+page+>.<++>
end
<+page+>.<++>
end
20 changes: 10 additions & 10 deletions ruby-rails/sweeper.snippet
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
class \<c-r>=NS_prompt("snip_classname", "Model classname", "")\<cr>Sweeper < ActionController::Caching::Sweeper
observe \<c-r>=snip_classname\<cr>
observe \<c-r>=snip_classname\<cr>

def after_save(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
end
def after_save(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
end

def after_destroy(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
end
def after_destroy(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
end

def expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_page
end
def expire_cache(\<c-r>=NS_underscore(snip_classname)\<cr>)
expire_page
end
end
2 changes: 1 addition & 1 deletion ruby-rails/tcb.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.boolean :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcbi.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.binary :<+title+><+, :limit => <+2+>.megabytes+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcd.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.decimal :<+title+><+<+, :precision => <+10+>+><+, :scale => <+2+>+>+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcda.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.date :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcdt.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.datetime :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcf.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.float :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tch.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.change :<+name+><+, :<+string+><+, :<+limit+> => <+80+>+>+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tci.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.integer :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcl.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.integer :lock_version, :null => false, :default => 0
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcs.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.string :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tct.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.text :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcti.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.time :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tcts.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.timestamp :<+title+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tctss.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.timestamps
<++>
<++>
2 changes: 1 addition & 1 deletion ruby-rails/tre.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
t.rename :<+old_column_name+>, :<+new_column_name+>
<++>
<++>
2 changes: 1 addition & 1 deletion ruby/Md.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
File.open(<+"<+path+>.dump"+>, "wb") { |<+file+>| Marshal.dump(<+obj+>, <+file+>) }
File.open(${1:dump_path}, "wb") { |${2:file}| Marshal.dump(${3:obj}, ${4:$2}) }
2 changes: 1 addition & 1 deletion ruby/Ml.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
File.open(<+"<+path+>.dump"+>, "rb") { |<+file+>| Marshal.load(<+file+>) }
File.open(${1:dump_path}, "rb") { |${2:file}| Marshal.load(${3:$2}) }
2 changes: 1 addition & 1 deletion ruby/Pn.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PStore.new(<+"<+file_name.pstore+>"+>)
PStore.new(${1})
2 changes: 1 addition & 1 deletion ruby/Yd.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
File.open(<+"<+path+>.yaml"+>, "w") { |<+file+>| YAML.dump(<+obj+>, <+file+>) }
File.open(${1:path_to_yml}, "w") { |${2:file}| YAML.dump(${3:obj}, ${4:$2}) }
2 changes: 1 addition & 1 deletion ruby/Yl.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
File.open(<+"<+path+>.yaml"+>) { |<+file+>| YAML.load(<+file+>) }
File.open(${1:path_to_yml}) { |${2:file}| YAML.load(${3:$2}) }
2 changes: 1 addition & 1 deletion ruby/am.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
alias_method :<+new_name+>, :<+old_name+>
alias_method :${1:new_name}, :${2:old_name}
2 changes: 1 addition & 1 deletion ruby/anr.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_nothing_raised(<+Exception+>) { <++> }
assert_nothing_raised(${1:Exception}) { ${2} }
2 changes: 1 addition & 1 deletion ruby/as.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert <+test+>, "<+failure_message+>"
assert ${1:test}, "${2:failure_message}"
2 changes: 1 addition & 1 deletion ruby/ase.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_equal <+expected+>, <+actual+>
assert_equal ${1:expected}, ${2:actual}
2 changes: 1 addition & 1 deletion ruby/asid.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_in_delta <+expected_float+>, <+actual_float+>, <+delta_float+>
assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:delta_float}
2 changes: 1 addition & 1 deletion ruby/asio.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_instance_of <+ExpectedClass+>, <+actual_instance+>
assert_instance_of ${1:ExpectedClass}, ${2:actual_instance}
2 changes: 1 addition & 1 deletion ruby/asko.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_kind_of <+ExpectedKind+>, <+actual_instance+>
assert_kind_of ${1:ExpectedKind}, ${2:actual_instance}
2 changes: 1 addition & 1 deletion ruby/asm.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_match /<+expected_pattern+>/, <+actual_string+>
assert_match /${1:expected_pattern}/, ${2:actual_string}
2 changes: 1 addition & 1 deletion ruby/asn.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_nil <+instance+>
assert_nil ${1:instance}
2 changes: 1 addition & 1 deletion ruby/asne.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_not_equal <+unexpected+>, <+actual+>
assert_not_equal ${1:unexpected}, ${2:actual}
2 changes: 1 addition & 1 deletion ruby/asnm.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_no_match /<+unexpected_pattern+>/, <+actual_string+>
assert_no_match /${1:unexpected_pattern}/, ${2:actual_string}
2 changes: 1 addition & 1 deletion ruby/asnn.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_not_nil <+instance+>
assert_not_nil ${1:instance}
2 changes: 1 addition & 1 deletion ruby/asns.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_not_same <+unexpected+>, <+actual+>
assert_not_same ${1:unexpected}, ${2:actual}
2 changes: 1 addition & 1 deletion ruby/asnt.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_nothing_thrown { <++> }
assert_nothing_thrown { ${1} }
2 changes: 1 addition & 1 deletion ruby/aso.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_operator <+left+>, :<+operator+>, <+right+>
assert_operator ${1:left}, :${2:operator}, ${3:right}
2 changes: 1 addition & 1 deletion ruby/asr.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_raise(<+Exception+>) { <++> }
assert_raise(${1:Exception}) { ${2} }
2 changes: 1 addition & 1 deletion ruby/asrt.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_respond_to <+object+>, :<+method+>
assert_respond_to ${1:object}, :${2:method}
2 changes: 1 addition & 1 deletion ruby/ass.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_send [<+object+>, :<+message+>, <+args+>]
assert_send [${1:object}, :${2:message}, ${3:args}]
2 changes: 1 addition & 1 deletion ruby/ast.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert_throws(:<+expected+>) { <++> }
assert_throws(:${1:expected}) { ${2} }
6 changes: 3 additions & 3 deletions ruby/bm.snippet
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TESTS = <+10_000+>
TESTS = ${1:10_000}
Benchmark.bmbm do |results|
<++>
end
${2}
end
6 changes: 3 additions & 3 deletions ruby/case.snippet
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
case <++>
when <++>
case ${1}
when ${2}
else
<++>
${3}
end
2 changes: 1 addition & 1 deletion ruby/class.snippet
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
class <+\<c-r>=Snippet_RubyClassNameFromFilename()\<CR>+>
class ${1:`Snippet_RubyClassNameFromFilename()`}
end
4 changes: 2 additions & 2 deletions ruby/def.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def <+function_name+>
<++>
def ${1:name}
${2}
end
4 changes: 2 additions & 2 deletions ruby/defmm.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def method_missing(meth, *args, &blk)
<++>
end
${1}
end
6 changes: 3 additions & 3 deletions ruby/defs.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def self.<+class_method_name+>
<++>
end
def self.${1:class_method_name}
${2}
end
6 changes: 3 additions & 3 deletions ruby/deft.snippet
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
def test_<+case_name+>
<++>
end
def test_${1:case_name}
${2}
end
2 changes: 1 addition & 1 deletion ruby/detect.snippet
Original file line number Diff line number Diff line change
@@ -1 +1 @@
detect { |<+element+>| <+body+> }
detect { |${1:element}| ${2:body} }
Loading

0 comments on commit ba6fa12

Please sign in to comment.