ruby: count from 1, not 0 (I think its very important to think about the name)

add static_var snippet
This commit is contained in:
Marc Weber 2013-07-31 22:31:05 +02:00
parent b2771b368c
commit c0cddc9f86
3 changed files with 11 additions and 4 deletions

View File

@ -432,8 +432,8 @@ end
endsnippet endsnippet
snippet dov "do |<key>| ... end" i snippet dov "do |<key>| ... end" i
do |${0:v}| do |${1:v}|
$1 $2
end end
endsnippet endsnippet

View File

@ -405,3 +405,10 @@ snippet aw
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) { array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
$$2 = ${4}; $$2 = ${4};
}); });
# static var assign once
snippet static_var
static $${1} = null;
if (is_null($$1)){
$$1 = ${2};
}

View File

@ -422,8 +422,8 @@ snippet do
# not be worth adding another snippet. should 0/1 placeholders change order? # not be worth adding another snippet. should 0/1 placeholders change order?
# its a good idea to think about the var name, so use it first # its a good idea to think about the var name, so use it first
snippet dov snippet dov
do |${0:v}| do |${1:v}|
${1} ${2}
end end
snippet : snippet :
:${1:key} => ${2:"value"}${3} :${1:key} => ${2:"value"}${3}