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
Povilas Balzaravičius Pawka
Dmitry Dementev
Travis Holton

View File

@ -196,5 +196,22 @@ snippet MIT
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH 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}

View File

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

View File

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

View File

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

View File

@ -152,6 +152,10 @@ snippet w
# attr_accessor
snippet rw
attr_accessor :${1:attr_names}
snippet atp
attr_protected :${1:attr_names}
snippet ata
attr_accessible :${1:attr_names}
# include Enumerable
snippet Enum
include Enumerable
@ -680,8 +684,6 @@ snippet logi
logger.info { "${1:message}" }${2}
snippet logw
logger.warn { "${1:message}" }${2}
snippet mac
add_column :${1:table}, :${2:column}, :${3:type}
snippet mapc
${1:map}.${2:connect} '${3:controller/:action/:id}'
snippet mapca
@ -696,37 +698,12 @@ snippet mapwo
end
snippet mbs
before_save :${1:method}
snippet mcc
change_column :${1:table}, :${2:column}, :${3:type}
snippet mccc
t.column :${1:title}, :${2:string}
snippet mcht
change_table :${1:table_name} do |t|
${2}
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
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
mattr_accessor :${1:attr_names}
snippet oa
@ -854,13 +831,6 @@ snippet tcts
snippet tctss
t.timestamps
${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
validates_associated :${1:attribute}
snippet vao
@ -905,8 +875,33 @@ snippet mac
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
snippet mrc
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}
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
snippet it