Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Stephen Tudor 2012-03-31 17:38:04 -04:00
commit 299408e405
6 changed files with 84 additions and 54 deletions

View File

@ -34,3 +34,4 @@ marutanm
msanders msanders
Povilas Balzaravičius Pawka Povilas Balzaravičius Pawka
Dmitry Dementev Dmitry Dementev
Travis Holton

View File

@ -196,5 +196,22 @@ snippet MIT
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
${3}
snippet APACHE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
${3} ${3}

View File

@ -30,20 +30,22 @@ snippet bfun
${2:// body...} ${2:// body...}
# Class # Class
snippet cla class .. snippet cla class ..
class ${1:ClassName} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2:// body...} ${2}
snippet cla class .. constructor: .. snippet cla class .. constructor: ..
class ${1:ClassName} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
constructor: (${2:args}) -> constructor: (${2:args}) ->
${3:// body...} ${3}
${4} ${4}
snippet cla class .. extends .. snippet cla class .. extends ..
class ${1:ClassName} extends ${2:Ancestor} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
${3:// body...} ${3}
snippet cla class .. extends .. constructor: .. snippet cla class .. extends .. constructor: ..
class ${1:ClassName} extends ${2:Ancestor} class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
constructor: (${3:args}) -> constructor: (${3:args}) ->
${4:// body...} ${4}
${5} ${5}
# If # If
snippet if snippet if

View File

@ -8,7 +8,6 @@ snippet %%
{% end$1 %} {% end$1 %}
snippet { snippet {
{{ ${1} }}${2} {{ ${1} }}${2}
# Template Tags # Template Tags
snippet autoescape snippet autoescape

View File

@ -1,6 +1,6 @@
# #!/usr/bin/perl # #!/usr/bin/perl
snippet #! snippet #!
#!/usr/bin/perl #!/usr/bin/env perl
# Hash Pointer # Hash Pointer
snippet . snippet .
@ -47,10 +47,11 @@ snippet xunless
${1:expression} unless ${2:condition};${3} ${1:expression} unless ${2:condition};${3}
# Try/Except # Try/Except
snippet eval snippet eval
local $@;
eval { eval {
${1:# do something risky...} ${1:# do something risky...}
}; };
if ($@) { if (my $e = $@) {
${2:# handle failure...} ${2:# handle failure...}
} }
# While Loop # While Loop
@ -133,19 +134,19 @@ snippet begin
# call package function with some parameter # call package function with some parameter
snippet pkgmv snippet pkgmv
__PACKAGE__->${1:package_method}(${2:var}); __PACKAGE__->${1:package_method}(${2:var})
# call package function without a parameter # call package function without a parameter
snippet pkgm snippet pkgm
__PACKAGE__->${1:package_method}(); __PACKAGE__->${1:package_method}()
# call package "get_" function without a parameter # call package "get_" function without a parameter
snippet pkget snippet pkget
__PACKAGE__->get_${1:package_method}(); __PACKAGE__->get_${1:package_method}()
# call package function with a parameter # call package function with a parameter
snippet pkgetv snippet pkgetv
__PACKAGE__->get_${1:package_method}(${2:var}); __PACKAGE__->get_${1:package_method}(${2:var})
# complex regex # complex regex
snippet qrx snippet qrx
@ -214,6 +215,15 @@ snippet psub
${2:Summary....} ${2:Summary....}
# Heading for inline subroutine pod
snippet psubi
=head2 ${1:MethodName}
${2:Summary...}
=cut
# Subroutine signature # Subroutine signature
snippet parg snippet parg
@ -257,7 +267,7 @@ snippet moosecl
package ${1:ClassName}; package ${1:ClassName};
use Moose; use Moose;
#extends ${2:# ParentClass}; #extends '${2:# ParentClass}';
${6:# body of class} ${6:# body of class}
@ -300,7 +310,7 @@ snippet override
# use test classes # use test classes
snippet tuse snippet tuse
use Test::More; use Test::More;
use Test::Deep; use Test::Deep ();
use Test::Exception; use Test::Exception;
# local test lib # local test lib
@ -316,7 +326,7 @@ snippet trunner
use ${1:test_class}; use ${1:test_class};
$1->runtests(); $1->runtests();
#testclass # Test::Class-style test
snippet tsub snippet tsub
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) { sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
my $self = shift; my $self = shift;
@ -324,6 +334,12 @@ snippet tsub
} }
# Test::Routine-style test
snippet trsub
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
my ($self) = @_;
${3:# test code}
};
#prep test method #prep test method
snippet tprep snippet tprep

View File

@ -152,6 +152,10 @@ snippet w
# attr_accessor # attr_accessor
snippet rw snippet rw
attr_accessor :${1:attr_names} attr_accessor :${1:attr_names}
snippet atp
attr_protected :${1:attr_names}
snippet ata
attr_accessible :${1:attr_names}
# include Enumerable # include Enumerable
snippet Enum snippet Enum
include Enumerable include Enumerable
@ -680,8 +684,6 @@ snippet logi
logger.info { "${1:message}" }${2} logger.info { "${1:message}" }${2}
snippet logw snippet logw
logger.warn { "${1:message}" }${2} logger.warn { "${1:message}" }${2}
snippet mac
add_column :${1:table}, :${2:column}, :${3:type}
snippet mapc snippet mapc
${1:map}.${2:connect} '${3:controller/:action/:id}' ${1:map}.${2:connect} '${3:controller/:action/:id}'
snippet mapca snippet mapca
@ -696,37 +698,12 @@ snippet mapwo
end end
snippet mbs snippet mbs
before_save :${1:method} before_save :${1:method}
snippet mcc
change_column :${1:table}, :${2:column}, :${3:type}
snippet mccc
t.column :${1:title}, :${2:string}
snippet mcht snippet mcht
change_table :${1:table_name} do |t| change_table :${1:table_name} do |t|
${2} ${2}
end end
snippet mcol
remove_column :${1:table}, :${2:column}
snippet mct
create_table :${1:table_name} do |t|
t.column :${2:name}, :${3:type}
end
snippet migration
class ${1:`Snippet_MigrationNameFromFilename()`} < ActiveRecord::Migration
def self.up
${2}
end
def self.down
end
end
snippet mp snippet mp
map(&:${1:id}) map(&:${1:id})
snippet mrc
remove_column :${1:column}
snippet mrmc
remove_column :${1:table}, :${2:column}
snippet mrnc
rename_column :${1:table}, :${2:old}, :${3:new}
snippet mrw snippet mrw
mattr_accessor :${1:attr_names} mattr_accessor :${1:attr_names}
snippet oa snippet oa
@ -854,13 +831,6 @@ snippet tcts
snippet tctss snippet tctss
t.timestamps t.timestamps
${1} ${1}
snippet trc
t.remove :${1:column}
snippet tre
t.rename :${1:old_column_name}, :${2:new_column_name}
${3}
snippet tref
t.references :${1:model}
snippet va snippet va
validates_associated :${1:attribute} validates_associated :${1:attribute}
snippet vao snippet vao
@ -905,8 +875,33 @@ snippet mac
add_column :${1:table_name}, :${2:column_name}, :${3:data_type} add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
snippet mrc snippet mrc
remove_column :${1:table_name}, :${2:column_name} remove_column :${1:table_name}, :${2:column_name}
snippet mrenc snippet mrnc
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name} rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
snippet mcc
change_column :${1:table}, :${2:column}, :${3:type}
snippet mccc
t.column :${1:title}, :${2:string}
snippet mct
create_table :${1:table_name} do |t|
t.column :${2:name}, :${3:type}
end
snippet migration
class ${1:class_name} < ActiveRecord::Migration
def self.up
${2}
end
def self.down
end
end
snippet trc
t.remove :${1:column}
snippet tre
t.rename :${1:old_column_name}, :${2:new_column_name}
${3}
snippet tref
t.references :${1:model}
#rspec #rspec
snippet it snippet it