mirror of
https://github.com/amix/vimrc
synced 2025-07-06 16:05:01 +08:00
Use sources_non_forked folder for pathogen path, with sources_non_forked_fallback folder as fallback.
This commit is contained in:
@ -1,288 +0,0 @@
|
||||
# Global snippets
|
||||
|
||||
# (c) holds no legal value ;)
|
||||
snippet c)
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.
|
||||
snippet date
|
||||
`strftime("%Y-%m-%d")`
|
||||
snippet ddate
|
||||
`strftime("%B %d, %Y")`
|
||||
snippet diso
|
||||
`strftime("%Y-%m-%dT%H:%M:%S")`
|
||||
snippet time
|
||||
`strftime("%H:%M")`
|
||||
snippet datetime
|
||||
`strftime("%Y-%m-%d %H:%M")`
|
||||
snippet lorem
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
snippet GPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet LGPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet GPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet LGPL3
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet AGPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet GMGPL linking exception
|
||||
As a special exception, if other files instantiate generics from
|
||||
this unit, or you link this unit with other files to produce an
|
||||
executable, this unit does not by itself cause the resulting
|
||||
executable to be covered by the GNU General Public License.
|
||||
This exception does not however invalidate any other reasons why the
|
||||
executable file might be covered by the GNU Public License.
|
||||
|
||||
${0}
|
||||
snippet BSD2
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation
|
||||
are those of the authors and should not be interpreted as representing
|
||||
official policies, either expressed or implied, of $2.
|
||||
${0}
|
||||
snippet BSD3
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the ${3:organization} nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
${0}
|
||||
snippet BSD4
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
This product includes software developed by the ${3:organization}.
|
||||
4. Neither the name of the $3 nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
${0}
|
||||
snippet MIT
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
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.
|
||||
${0}
|
||||
snippet APACHE
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
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.
|
||||
${0}
|
||||
snippet BEERWARE
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
|
||||
$2 wrote this file. As long as you retain this notice you
|
||||
can do whatever you want with this stuff. If we meet some day, and you think
|
||||
this stuff is worth it, you can buy me a beer or coffee in return
|
||||
${0}
|
||||
snippet WTFPL
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright `strftime("%Y")` ${0:`g:snips_author`}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
${0}
|
||||
snippet MPL2
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
${0}
|
||||
snippet AGPL
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
snippet ISC
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")`, ${2:`g:snips_author`}
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
${0}
|
@ -1,152 +0,0 @@
|
||||
snippet main
|
||||
package {
|
||||
import flash.display.*;
|
||||
import flash.Events.*;
|
||||
|
||||
public class Main extends Sprite {
|
||||
public function Main ( ) {
|
||||
trace("start");
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
stage.addEventListener(Event.RESIZE, resizeListener);
|
||||
}
|
||||
|
||||
private function resizeListener (e:Event):void {
|
||||
trace("The application window changed size!");
|
||||
trace("New width: " + stage.stageWidth);
|
||||
trace("New height: " + stage.stageHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
snippet class
|
||||
${1:public|internal} class ${2:name} ${0:extends } {
|
||||
public function $2 ( ) {
|
||||
("start");
|
||||
}
|
||||
}
|
||||
snippet all
|
||||
package name {
|
||||
|
||||
${1:public|internal|final} class ${2:name} ${0:extends } {
|
||||
private|public| static const FOO = "abc";
|
||||
private|public| static var BAR = "abc";
|
||||
|
||||
// class initializer - no JIT !! one time setup
|
||||
if Cababilities.os == "Linux|MacOS" {
|
||||
FOO = "other";
|
||||
}
|
||||
|
||||
// constructor:
|
||||
public function $2 ( ){
|
||||
super2();
|
||||
trace("start");
|
||||
}
|
||||
public function name (a, b...){
|
||||
super.name(..);
|
||||
lable:break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function A(){
|
||||
// A can only be accessed within this file
|
||||
}
|
||||
snippet switch
|
||||
switch(${1}){
|
||||
case ${2}:
|
||||
${0}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
snippet case
|
||||
case ${1}:
|
||||
${0}
|
||||
break;
|
||||
snippet package
|
||||
package ${1:package}{
|
||||
${0}
|
||||
}
|
||||
snippet wh
|
||||
while ${1:cond}{
|
||||
${0}
|
||||
}
|
||||
snippet do
|
||||
do {
|
||||
${0}
|
||||
} while (${1:cond})
|
||||
snippet for enumerate names
|
||||
for (${1:var} in ${2:object}){
|
||||
${0}
|
||||
}
|
||||
snippet for enumerate values
|
||||
for each (${1:var} in ${2:object}){
|
||||
${0}
|
||||
}
|
||||
snippet get_set
|
||||
function get ${1:name} {
|
||||
return ${2}
|
||||
}
|
||||
function set $1 (newValue) {
|
||||
${0}
|
||||
}
|
||||
snippet interface
|
||||
interface name {
|
||||
function method(${1}):${0:returntype};
|
||||
}
|
||||
snippet try
|
||||
try {
|
||||
${1:${VISUAL}}
|
||||
} catch (error:ErrorType) {
|
||||
${2}
|
||||
} finally {
|
||||
${0}
|
||||
}
|
||||
# For Loop (same as c.snippet)
|
||||
snippet for for (..) {..}
|
||||
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${0}
|
||||
}
|
||||
# Custom For Loop
|
||||
snippet forr
|
||||
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${0}
|
||||
}
|
||||
# If Condition
|
||||
snippet if
|
||||
if ($1) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Ternary conditional
|
||||
snippet t Ternary: `condition ? true : false`
|
||||
$1 ? $2 : $0
|
||||
snippet fun
|
||||
function ${1:function_name}(${2})${3}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# FlxSprite (usefull when using the flixel library)
|
||||
snippet FlxSprite
|
||||
package
|
||||
{
|
||||
import org.flixel.*
|
||||
|
||||
public class ${1:ClassName} extends ${2:FlxSprite}
|
||||
{
|
||||
public function $1(${3: X:Number, Y:Number}):void
|
||||
{
|
||||
super(X,Y);
|
||||
${4}
|
||||
}
|
||||
|
||||
override public function update():void
|
||||
{
|
||||
super.update();
|
||||
${0}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,217 +0,0 @@
|
||||
snippet wi with
|
||||
with ${1};${0}
|
||||
|
||||
snippet pac package
|
||||
package ${1} is
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet pacb package body
|
||||
package body ${1} is
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet ent entry ... when
|
||||
entry ${1}(${2}) when ${3} is
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet task task
|
||||
task ${1} is
|
||||
entry ${0}
|
||||
end $1;
|
||||
|
||||
snippet taskb task body
|
||||
task body ${1} is
|
||||
${2}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet acc accept
|
||||
accept ${1}(${2}) do
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet prot protected type
|
||||
protected type ${1}(${2}) is
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet prob protected body
|
||||
protected body ${1} is
|
||||
${2}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet gen generic type
|
||||
generic
|
||||
type ${1} is ${2};${0}
|
||||
|
||||
snippet ty type
|
||||
type ${1} is ${2};${0}
|
||||
|
||||
snippet tyd type with default value
|
||||
type ${1} is ${2}
|
||||
with Default_Value => ${3};${0}
|
||||
|
||||
snippet subty subtype
|
||||
subtype ${1} is ${2};${0}
|
||||
|
||||
snippet dec declare block
|
||||
declare
|
||||
${1}
|
||||
begin
|
||||
${0}
|
||||
end;
|
||||
|
||||
snippet decn declare named block
|
||||
${1}:
|
||||
declare
|
||||
${2}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet ifex if expression
|
||||
if ${1} then ${2} else ${0}
|
||||
|
||||
snippet casex case expression
|
||||
case ${1} is
|
||||
when ${2} => ${3},${0}
|
||||
|
||||
snippet fora for all
|
||||
for all ${1} ${2:in} ${3} => ${0}
|
||||
|
||||
snippet fors for some
|
||||
for some ${1} ${2:in} ${3} => ${0}
|
||||
|
||||
snippet if if
|
||||
if ${1} then
|
||||
${0:${VISUAL}}
|
||||
end if;
|
||||
|
||||
snippet ife if ... else
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end if;
|
||||
|
||||
snippet el else
|
||||
else
|
||||
${0:${VISUAL}}
|
||||
|
||||
snippet eif elsif
|
||||
elsif ${1} then
|
||||
${0}
|
||||
|
||||
snippet wh while
|
||||
while ${1} loop
|
||||
${0:${VISUAL}}
|
||||
end loop;
|
||||
|
||||
snippet nwh named while
|
||||
${1}:
|
||||
while ${2} loop
|
||||
${0:${VISUAL}}
|
||||
end loop $1;
|
||||
|
||||
snippet for for
|
||||
for ${1:I} in ${2} loop
|
||||
${0}
|
||||
end loop;
|
||||
|
||||
snippet fore for each
|
||||
for ${1} of ${2} loop
|
||||
${0}
|
||||
end loop;
|
||||
|
||||
snippet nfor named for
|
||||
${1}:
|
||||
for ${2:I} in ${3} loop
|
||||
${0}
|
||||
end loop $1;
|
||||
|
||||
snippet nfore named for each
|
||||
${1}:
|
||||
for ${2} of ${3} loop
|
||||
${0}
|
||||
end loop $1;
|
||||
|
||||
snippet proc procedure
|
||||
procedure ${1}(${2}) is
|
||||
${3}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet procd procedure declaration
|
||||
procedure ${1};${0}
|
||||
|
||||
snippet fun function
|
||||
function ${1}(${2}) return ${3} is
|
||||
${4}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet fune expression function
|
||||
function ${1} return ${2} is
|
||||
(${3});${0}
|
||||
|
||||
snippet fund function declaration
|
||||
function ${1} return ${2};${0}
|
||||
|
||||
snippet ret extended return
|
||||
return ${1} do
|
||||
${0}
|
||||
end return;
|
||||
|
||||
snippet rec record
|
||||
record
|
||||
${0}
|
||||
end record;
|
||||
|
||||
snippet case case
|
||||
case ${1} is
|
||||
when ${2} => ${3};${0}
|
||||
end case;
|
||||
|
||||
snippet whe when
|
||||
when ${1} => ${2};${0}
|
||||
|
||||
snippet wheo when others
|
||||
when others => ${1};${0}
|
||||
|
||||
snippet lo loop
|
||||
loop
|
||||
${0}
|
||||
end loop;
|
||||
|
||||
snippet nlo named loop
|
||||
${1}:
|
||||
loop
|
||||
${0}
|
||||
end loop $1;
|
||||
|
||||
snippet ex exit when
|
||||
exit when ${1};${0}
|
||||
|
||||
snippet put Ada.Text_IO.Put
|
||||
Ada.Text_IO.Put(${1});${0}
|
||||
|
||||
snippet putl Ada.Text_IO.Put_Line
|
||||
Ada.Text_IO.Put_Line(${1});${0}
|
||||
|
||||
snippet get Ada.Text_IO.Get
|
||||
Ada.Text_IO.Get(${1});${0}
|
||||
|
||||
snippet getl Ada.Text_IO.Get_Line
|
||||
Ada.Text_IO.Get_Line(${1});${0}
|
||||
|
||||
snippet newline Ada.Text_IO.New_Line
|
||||
Ada.Text_IO.New_Line(${1:1});${0}
|
||||
|
@ -1 +0,0 @@
|
||||
extends _
|
@ -1,38 +0,0 @@
|
||||
snippet mod
|
||||
module ${0:`expand('%:t:r')`}
|
||||
snippet imp
|
||||
import ${0:http}
|
||||
snippet impt
|
||||
import type ${0:option.option}
|
||||
snippet exp
|
||||
export ${0}
|
||||
snippet expt
|
||||
export ${0}
|
||||
snippet fn
|
||||
val ${1:fn} ${2}: fn ${3:'a} -> ${4:'a}
|
||||
let $1 ${5} =
|
||||
${0:${VISUAL}}
|
||||
snippet mat
|
||||
match ${1} with
|
||||
| ${2} -> ${0}
|
||||
snippet -
|
||||
| ${1} -> ${0}
|
||||
snippet let
|
||||
let ${1} = ${2:${VISUAL}} in
|
||||
${0}
|
||||
snippet letf
|
||||
let ${1} =
|
||||
${0:${VISUAL}}
|
||||
snippet ty
|
||||
type ${1:msg}
|
||||
= ${0}
|
||||
snippet test
|
||||
test "${1}" =
|
||||
${0:${VISUAL}}
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet ae
|
||||
assert.equal ${0}
|
@ -1,35 +0,0 @@
|
||||
# Snippets for code blocks used oftenly in Apache files.
|
||||
# <Directory>
|
||||
snippet dir
|
||||
<Directory ${1:/}>
|
||||
DirectoryIndex ${0:index.html}
|
||||
Order Deny,Allow
|
||||
Deny from All
|
||||
</Directory>
|
||||
# <FilesMatch>
|
||||
snippet filesmatch
|
||||
<FilesMatch "${1:regex}">
|
||||
${0:${VISUAL}}
|
||||
</FilesMatch>
|
||||
# <IfModule>
|
||||
snippet ifmodule
|
||||
<IfModule ${1:mod_example.c}>
|
||||
${0:${VISUAL}}
|
||||
</IfModule>
|
||||
# <LimitExcept>
|
||||
snippet limitexcept
|
||||
<LimitExcept ${1:POST GET}>
|
||||
${0:${VISUAL}}
|
||||
</LimitExcept>
|
||||
# <Proxy>
|
||||
snippet proxy
|
||||
<Proxy ${1:*}>
|
||||
${0:${VISUAL}}
|
||||
</Proxy>
|
||||
# <VirtualHost>
|
||||
snippet virtualhost
|
||||
<VirtualHost ${1:*}:${2:80}>
|
||||
ServerAdmin ${3:webmaster@example.com}
|
||||
DocumentRoot ${4:/www/example.com}
|
||||
ServerName ${0:www.example.com}
|
||||
</VirtualHost>
|
@ -1,124 +0,0 @@
|
||||
snippet setup
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(${1:9600});
|
||||
${2}
|
||||
}
|
||||
|
||||
snippet loop
|
||||
void loop()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet inc
|
||||
#include <${1}.h>
|
||||
|
||||
snippet def
|
||||
#define ${1}
|
||||
|
||||
# if
|
||||
snippet if
|
||||
if ($1) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if ($1) {
|
||||
${2}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if ($1) ${2};
|
||||
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
default:
|
||||
${6}
|
||||
}
|
||||
|
||||
snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
|
||||
# for
|
||||
snippet for
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while ($1) {
|
||||
${2}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${2}
|
||||
} while ($1);
|
||||
##
|
||||
## Functions
|
||||
# function definition
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
|
||||
## IO
|
||||
# pinMode OUTPUT
|
||||
snippet pinout
|
||||
pinMode(${1}, OUTPUT);
|
||||
# pinMode INPUT
|
||||
snippet pinin
|
||||
pinMode(${1}, INPUT);
|
||||
# digitalWrite HIGH
|
||||
snippet dwHigh
|
||||
digitalWrite(${1}, HIGH);
|
||||
# digitalWrite LOW
|
||||
snippet dwLow
|
||||
digitalWrite(${1}, LOW);
|
||||
# digitalRead
|
||||
snippet dr
|
||||
digitalRead(${1});
|
||||
# analogRead
|
||||
snippet ar
|
||||
analogRead(${1});
|
||||
# analogWrite
|
||||
snippet aw
|
||||
analogWrite(${1});
|
||||
# serialRead
|
||||
snippet sr
|
||||
Serial.read();
|
||||
# serialWrite
|
||||
snippet sw
|
||||
Serial.write();
|
||||
# serial.print
|
||||
snippet sp
|
||||
Serial.print(${1});
|
||||
# serial.println
|
||||
snippet sl
|
||||
Serial.println(${1});
|
||||
|
||||
|
||||
# delay
|
||||
snippet dl
|
||||
delay(${1});
|
||||
# millis
|
||||
snippet ml
|
||||
millis();
|
@ -1,195 +0,0 @@
|
||||
snippet scode Start basic code for assembly
|
||||
.data
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
.global main
|
||||
|
||||
|
||||
main:
|
||||
|
||||
|
||||
snippet scodes Start basic code for assembly with _start label
|
||||
.data
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
.globl _start
|
||||
|
||||
|
||||
_start:
|
||||
|
||||
|
||||
snippet lo Long
|
||||
$1: .long $2
|
||||
snippet wo Word
|
||||
$1: .word $2
|
||||
snippet by Byte
|
||||
$1: .byte $2
|
||||
snippet sp Space
|
||||
$1: .space $2
|
||||
snippet ai Ascii
|
||||
$1: .ascii "$2"
|
||||
snippet az Asciz
|
||||
$1: .asciz "$2"
|
||||
snippet ze Zero
|
||||
$1: .zero "$2"
|
||||
snippet qu Quad
|
||||
$1: .quad "$2"
|
||||
snippet si Single
|
||||
$1: .single "$2"
|
||||
snippet do Double
|
||||
$1: .single "$2"
|
||||
snippet fl Float
|
||||
$1: .single "$2"
|
||||
snippet oc Octa
|
||||
$1: .single "$2"
|
||||
snippet sh Short
|
||||
$1: .single "$2"
|
||||
snippet exit0 Exit without error
|
||||
movl \$1, %eax
|
||||
xorl %ebx, %ebx
|
||||
int \$0x80
|
||||
|
||||
snippet exit Exit with error
|
||||
mov \$1, %eax
|
||||
mov $1, %ebx
|
||||
int \$0x80
|
||||
|
||||
snippet readfstdin Read fixed length text from stdin
|
||||
mov \$3, %eax
|
||||
mov \$2, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet writestdout Write text to stdout
|
||||
mov \$4, %eax
|
||||
mov \$1, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet writestderr Write text to stderr
|
||||
mov \$4, %eax
|
||||
mov \$2, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet * Multiplication
|
||||
mov $1, %eax
|
||||
mul $2
|
||||
|
||||
snippet / Division
|
||||
mov $1, %eax
|
||||
div $2
|
||||
|
||||
snippet jmpl Conditional lower jump
|
||||
cmp $1, $2
|
||||
jl $3
|
||||
|
||||
snippet jmple Conditional lower or equal jump
|
||||
cmp $1, $2
|
||||
jle $3
|
||||
|
||||
snippet jmpe Conditional equal jump
|
||||
cmp $1, $2
|
||||
je $3
|
||||
|
||||
snippet jmpn Conditional not equal jump
|
||||
cmp $1, $2
|
||||
jn $3
|
||||
|
||||
snippet jmpg Conditional greater jump
|
||||
cmp $1, $2
|
||||
jg $3
|
||||
|
||||
snippet jmpge Conditional greater or equal jump
|
||||
cmp $1, $2
|
||||
je $3
|
||||
|
||||
snippet loopn Loop n times
|
||||
mov $1, %ecx
|
||||
|
||||
et_for:
|
||||
$2
|
||||
|
||||
loop et_for
|
||||
|
||||
snippet loopnn Loop n-1 times
|
||||
mov $1, %ecx
|
||||
dec %ecx
|
||||
|
||||
et_for:
|
||||
$2
|
||||
|
||||
loop et_for
|
||||
|
||||
snippet loopv Loop through a vector
|
||||
lea $1, %edi
|
||||
xor %ecx, %ecx
|
||||
|
||||
et_for:
|
||||
cmp %ecx, $2
|
||||
je $3
|
||||
|
||||
$4
|
||||
|
||||
inc %ecx
|
||||
jmp et_for
|
||||
|
||||
snippet mul Multiply
|
||||
xor %edx, %edx
|
||||
mov $1, %eax
|
||||
mul $2
|
||||
snippet mul64 Multiply numbers greater than 2^32
|
||||
mov $1, %edx
|
||||
mov $2, %eax
|
||||
mul $3
|
||||
snippet div Divide
|
||||
xor %edx, %edx
|
||||
mov $1, %eax
|
||||
div $2
|
||||
snippet div64 Divide numbers greater than 2^32
|
||||
mov $1, %edx
|
||||
mov $2, %eax
|
||||
div $3
|
||||
snippet pr Call printf
|
||||
pushl $1
|
||||
call printf
|
||||
popl $2
|
||||
snippet sc Call scanf
|
||||
pushl $1
|
||||
call scanf
|
||||
popl $2
|
||||
snippet mindex Current index from a matrix
|
||||
xor %edx, %edx
|
||||
movl $1, %eax
|
||||
mull $2
|
||||
addl $3, %eax
|
||||
snippet ffl Call fflush
|
||||
pushl \$0
|
||||
call fflush
|
||||
popl $1
|
||||
snippet at Call atoi
|
||||
pushl $1
|
||||
call atoi
|
||||
popl $2
|
||||
snippet len Call strlen
|
||||
pushl $1
|
||||
call strlen
|
||||
popl $2
|
||||
snippet proc Basic procedure
|
||||
$1:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
|
||||
$2
|
||||
|
||||
popl %ebp
|
||||
ret
|
@ -1,66 +0,0 @@
|
||||
snippet if
|
||||
If $1 Then
|
||||
${0:; True code}
|
||||
EndIf
|
||||
snippet el
|
||||
Else
|
||||
${0}
|
||||
snippet eif
|
||||
ElseIf $1 Then
|
||||
${0:; True code}
|
||||
# If/Else block
|
||||
snippet ife
|
||||
If $1 Then
|
||||
${2:; True code}
|
||||
Else
|
||||
${0:; Else code}
|
||||
EndIf
|
||||
# If/ElseIf/Else block - because there is eif this is not really neccessary
|
||||
snippet ifelif
|
||||
If ${1:condition 1} Then
|
||||
${2:; True code}
|
||||
ElseIf ${3:condition 2} Then
|
||||
${4:; True code}
|
||||
Else
|
||||
${0:; Else code}
|
||||
EndIf
|
||||
# Switch block
|
||||
snippet switch
|
||||
Switch ($1)
|
||||
Case ${2:case1}:
|
||||
${3:; Case 1 code}
|
||||
Case Else:
|
||||
${0:; Else code}
|
||||
EndSwitch
|
||||
# Select block
|
||||
snippet select
|
||||
Select ($1)
|
||||
Case ${2:case1}:
|
||||
${3:; Case 1 code}
|
||||
Case Else:
|
||||
${0:; Else code}
|
||||
EndSelect
|
||||
# While loop
|
||||
snippet wh
|
||||
While ($1)
|
||||
${0:; code...}
|
||||
WEnd
|
||||
# For loop
|
||||
snippet for
|
||||
For ${1:n} = ${3:1} to ${2:count}
|
||||
${0:; code...}
|
||||
Next
|
||||
# New Function
|
||||
snippet func
|
||||
Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0:Return}
|
||||
EndFunc
|
||||
# Message box
|
||||
snippet msg
|
||||
MsgBox(${0:MsgType}, ${1:"Title"}, ${2:"Message Text"})
|
||||
# Debug Message
|
||||
snippet debug
|
||||
MsgBox(0, "Debug", ${0:"Debug Message"})
|
||||
# Show Variable Debug Message
|
||||
snippet showvar
|
||||
MsgBox(0, "${0:VarName}", $1)
|
@ -1,82 +0,0 @@
|
||||
# cannot use /usr/bin/env because it does not support parameters (as -f)
|
||||
snippet #! #!/usr/bin/awk -f
|
||||
#!/usr/bin/awk -f
|
||||
# @include is a gawk extension
|
||||
snippet inc @include
|
||||
@include "${1}"${0}
|
||||
# @load is a gawk extension
|
||||
snippet loa @load
|
||||
@load "${1}"${0}
|
||||
snippet beg BEGIN { ... }
|
||||
BEGIN {
|
||||
${0}
|
||||
}
|
||||
# BEGINFILE is a gawk extension
|
||||
snippet begf BEGINFILE { ... }
|
||||
BEGINFILE {
|
||||
${0}
|
||||
}
|
||||
snippet end END { ... }
|
||||
END {
|
||||
${0}
|
||||
}
|
||||
# ENDFILE is a gawk extension
|
||||
snippet endf ENDFILE { ... }
|
||||
ENDFILE {
|
||||
${0}
|
||||
}
|
||||
snippet pri print
|
||||
print ${1:"${2}"}${0}
|
||||
snippet printf printf
|
||||
printf("${1:%s}\n", ${2})${0}
|
||||
snippet ign IGNORECASE
|
||||
IGNORECASE = ${1:1}
|
||||
snippet if if {...}
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife if ... else ...
|
||||
if (${1}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
snippet eif else if ...
|
||||
else if (${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet el else {...}
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
snippet wh while
|
||||
while (${1}) {
|
||||
${2}
|
||||
}
|
||||
snippet do do ... while
|
||||
do {
|
||||
${0}
|
||||
} while (${1})
|
||||
snippet for for
|
||||
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
|
||||
${0}
|
||||
}
|
||||
snippet fore for each
|
||||
for (${1:i} in ${2:array}) {
|
||||
${0}
|
||||
}
|
||||
# the switch is a gawk extension
|
||||
snippet sw switch
|
||||
switch (${1}) {
|
||||
case ${2}:
|
||||
${3}
|
||||
break
|
||||
default:
|
||||
${0}
|
||||
break
|
||||
}
|
||||
# the switch is a gawk extension
|
||||
snippet case case
|
||||
case ${1}:
|
||||
${0}
|
||||
break
|
@ -1,25 +0,0 @@
|
||||
extends sh
|
||||
|
||||
# Shebang
|
||||
snippet #!
|
||||
#!/usr/bin/env bash
|
||||
|
||||
snippet s#!
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
snippet if
|
||||
if [[ $1 ]]; then
|
||||
${0:${VISUAL}}
|
||||
fi
|
||||
snippet elif
|
||||
elif [[ $1 ]]; then
|
||||
${0:${VISUAL}}
|
||||
snippet wh
|
||||
while [[ $1 ]]; do
|
||||
${0:${VISUAL}}
|
||||
done
|
||||
snippet until
|
||||
until [[ $1 ]]; do
|
||||
${0:${VISUAL}}
|
||||
done
|
@ -1,394 +0,0 @@
|
||||
## Main
|
||||
# main
|
||||
snippet main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# main(void)
|
||||
snippet mainn
|
||||
int main(void)
|
||||
{
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet inc
|
||||
#include <${1:stdio}.h>
|
||||
$0
|
||||
# #include "..."
|
||||
snippet Inc
|
||||
#include "${1:`vim_snippets#Filename("$1.h")`}"
|
||||
$0
|
||||
# ifndef...define...endif
|
||||
snippet ndef
|
||||
#ifndef $1
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif /* ifndef $1 */
|
||||
# define
|
||||
snippet def
|
||||
#define
|
||||
# ifdef...endif
|
||||
snippet ifdef
|
||||
#ifdef ${1:FOO}
|
||||
${2:#define }
|
||||
#endif
|
||||
# if
|
||||
snippet #if
|
||||
#if ${1:FOO}
|
||||
${0:${VISUAL}}
|
||||
#endif
|
||||
# header include guard
|
||||
snippet once
|
||||
#ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`}
|
||||
|
||||
#define $1
|
||||
|
||||
${0}
|
||||
|
||||
#endif /* end of include guard: $1 */
|
||||
# Disable C++ name mangling in C headers
|
||||
snippet nocxx
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
${0}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
##
|
||||
## Control Statements
|
||||
# if
|
||||
snippet if
|
||||
if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if (${1:true}) ${0};
|
||||
# ternary
|
||||
snippet t Ternary: `condition ? true : false`
|
||||
$1 ? $2 : $0
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
default:
|
||||
${6}
|
||||
}
|
||||
# switch without default
|
||||
snippet switchndef
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
}
|
||||
# case
|
||||
snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
snippet ret
|
||||
return ${0};
|
||||
snippet ex
|
||||
exit($0);
|
||||
##
|
||||
## Loops
|
||||
# for
|
||||
snippet for
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while (${1:1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet wht
|
||||
while (true) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${0:${VISUAL}}
|
||||
} while ($1);
|
||||
##
|
||||
## Functions
|
||||
# function definition
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# function definition with zero parameters
|
||||
snippet fun0
|
||||
${1:void} ${2:function_name}()
|
||||
{
|
||||
${3}
|
||||
}
|
||||
# function definition with Doxygen documentation
|
||||
snippet dfun0
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \return ${3:Return parameter description}
|
||||
*/
|
||||
${4:void} ${5:function_name}()
|
||||
{
|
||||
${6}
|
||||
}
|
||||
# function definition with one parameter
|
||||
snippet fun1
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# function definition with one parameter with Doxygen documentation
|
||||
snippet dfun1
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \return ${5:Return parameter description}
|
||||
*/
|
||||
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function definition with two parameters
|
||||
snippet fun2
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
|
||||
{
|
||||
${7}
|
||||
}
|
||||
# function definition with two parameters with Doxygen documentation
|
||||
snippet dfun2
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \param $5 ${6:Parameter description}
|
||||
* \return ${7:Return parameter description}
|
||||
*/
|
||||
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
|
||||
{
|
||||
${12}
|
||||
}
|
||||
# function definition with three parameters
|
||||
snippet fun3
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function definition with three parameters with Doxygen documentation
|
||||
snippet dfun3
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \param $5 ${6:Parameter description}
|
||||
* \param $7 ${8:Parameter description}
|
||||
* \return ${9:Return parameter description}
|
||||
*/
|
||||
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
|
||||
{
|
||||
${15}
|
||||
}
|
||||
# function declaration
|
||||
snippet fund
|
||||
${1:void} ${2:function_name}(${3});
|
||||
##
|
||||
## Types
|
||||
# typedef
|
||||
snippet td
|
||||
typedef ${1:int} ${2:MyCustomType};
|
||||
# struct
|
||||
snippet st
|
||||
/*! \struct $1
|
||||
* \brief ${3:Brief struct description}
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
|
||||
${2:Data} /*!< ${4:Description} */
|
||||
}${5: /* optional variable list */};
|
||||
# typedef struct
|
||||
snippet tds
|
||||
/*! \struct $2
|
||||
* \brief ${5:Brief struct description}
|
||||
*
|
||||
* ${6:Detailed description}
|
||||
*/
|
||||
typedef struct ${2:_$1 }{
|
||||
m_${3:Data} /*!< ${4:Description} */
|
||||
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
|
||||
|
||||
snippet enum
|
||||
/*! \enum $1
|
||||
*
|
||||
* ${2:Detailed description}
|
||||
*/
|
||||
enum ${1:name} { ${0} };
|
||||
# typedef enum
|
||||
snippet tde
|
||||
/*! \enum $2
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
typedef enum {
|
||||
${1:Data} /*!< ${3:Description} */
|
||||
} ${2:foo};
|
||||
##
|
||||
## Input/Output
|
||||
# printf
|
||||
snippet pr
|
||||
printf("${1:%s}\n"${2});
|
||||
# fprintf (again, this isn't as nice as TextMate's version, but it works)
|
||||
snippet fpr
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${3});
|
||||
snippet prd
|
||||
printf("${1:} = %d\n", $1);
|
||||
snippet prf
|
||||
printf("${1:} = %f\n", $1);
|
||||
snippet prx
|
||||
printf("${1:} = %${2}\n", $1);
|
||||
snippet warn
|
||||
warn("${1:%s}"$0);
|
||||
snippet warnx
|
||||
warnx("${1:%s}"$0);
|
||||
snippet err
|
||||
err(${1:1}, "${2:%s}"$0);
|
||||
snippet errx
|
||||
errx(${1:1}, "${2:%s}"$0);
|
||||
# getopt
|
||||
snippet getopt
|
||||
int choice;
|
||||
while (1)
|
||||
{
|
||||
static struct option long_options[] =
|
||||
{
|
||||
/* Use flags like so:
|
||||
{"verbose", no_argument, &verbose_flag, 'V'}*/
|
||||
/* Argument styles: no_argument, required_argument, optional_argument */
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
${1}
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
int option_index = 0;
|
||||
|
||||
/* Argument parameters:
|
||||
no_argument: " "
|
||||
required_argument: ":"
|
||||
optional_argument: "::" */
|
||||
|
||||
choice = getopt_long( argc, argv, "vh",
|
||||
long_options, &option_index);
|
||||
|
||||
if (choice == -1)
|
||||
break;
|
||||
|
||||
switch( choice )
|
||||
{
|
||||
case 'v':
|
||||
${2}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
${3}
|
||||
break;
|
||||
|
||||
case '?':
|
||||
/* getopt_long will have already printed an error */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Not sure how to get here... */
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Deal with non-option arguments here */
|
||||
if ( optind < argc )
|
||||
{
|
||||
while ( optind < argc )
|
||||
{
|
||||
${0}
|
||||
}
|
||||
}
|
||||
|
||||
## Assertions
|
||||
snippet asr
|
||||
assert($1);
|
||||
|
||||
snippet anl
|
||||
assert(${1:ptr} != NULL);
|
||||
|
||||
## Dynamic Allocation
|
||||
snippet mlc
|
||||
${1:ptr} = (${2:type}*) malloc(sizeof($2));
|
||||
|
||||
snippet clc
|
||||
${1:ptr} = (${2:type}*) calloc(${3:size}, sizeof($2));
|
||||
|
||||
snippet rlc
|
||||
${1:ptr} = realloc($1, ${2:size} * sizeof(${3:type}));
|
||||
|
||||
snippet mlcd
|
||||
${1:type} ${2:ptr} = ($1*) malloc(sizeof($1));
|
||||
|
||||
snippet clcd
|
||||
${1:type} ${2:ptr} = ($1*) calloc(${3:size}, sizeof($1));
|
||||
|
||||
snippet fre
|
||||
free(${1:ptr});
|
||||
|
||||
##
|
||||
# TODO section
|
||||
snippet todo
|
||||
/*! TODO: ${1:Todo description here}
|
||||
* \todo $1
|
||||
*/
|
||||
## Miscellaneous
|
||||
# This is kind of convenient
|
||||
snippet .
|
||||
[${1}]
|
||||
|
||||
snippet asm
|
||||
__asm__ __volatile__(
|
||||
"${0}\n\t"
|
||||
:
|
||||
:
|
||||
);
|
@ -1,204 +0,0 @@
|
||||
# Opscode Chef Cookbook Recipe Resources
|
||||
# Snippet by: Mike Smullin <mike@smullindesign.com>
|
||||
# Based on: http://wiki.opscode.com/display/chef/Resources
|
||||
|
||||
# @TODO: Include Meta attributes and actions in all snippets
|
||||
# @TODO: Finish writing snippets for remaining Resources
|
||||
|
||||
snippet cookbook_file
|
||||
# Cookbook File resource
|
||||
cookbook_file ${1:"/path/to/file"} do # The remote path where the file will reside
|
||||
${2:#}backup ${3} # How many backups of this file to keep. Set to false if you want no backups
|
||||
${4:#}group ${5} # The group owner of the file (string or id)
|
||||
${6:#}mode ${7} # The octal mode of the file - e.g. 0755
|
||||
${8:#}owner ${9} # The owner for the file
|
||||
${10:#}source ${11} # The basename of the source file
|
||||
${12:#}cookbook ${13} # The cookbook this file is stored in
|
||||
|
||||
${14:#}${15: action :create} # Create this file (Default)
|
||||
${16:#}${17: action :create_if_missing} # Create only if it doesn't exist yet
|
||||
${18:#}${0: action :delete} # Delete this file
|
||||
end
|
||||
|
||||
snippet execute
|
||||
# Execute resource
|
||||
execute ${1:"command to execute"} do # The command to execute
|
||||
${2:#}creates ${3:nil} # A file this command creates - if the file exists, the command will not be run.
|
||||
${4:#}cwd ${5:nil} # Current working directory to run the command from.
|
||||
${6:#}environment ${7:nil} # A hash of environment variables to set before running this command.
|
||||
${8:#}group ${9:nil} # A group name or group ID that we should change to before running this command.
|
||||
${10:#}path ${11:nil} # An array of paths to use when searching for the command. Nil uses system path.
|
||||
${12:#}returns ${13:0} # The return value of the command - this resource raises an exception if the return value does not match.
|
||||
${14:#}timeout ${15:nil} # How many seconds to let the command run before timing it out.
|
||||
${16:#}user ${17:nil} # A user name or user ID that we should change to before running this command.
|
||||
${18:#}umask ${19:nil} # Umask for files created by the command
|
||||
|
||||
${20:#}${21:action :run} # Run this command (Default)
|
||||
${22:#}${0:action :nothing} # Do not run this command
|
||||
end
|
||||
|
||||
snippet link
|
||||
# Link resource
|
||||
link ${1:"/target/file"} do # The file name of the link
|
||||
${2:#}to ${3} # The real file you want to link to
|
||||
${4:#}link_type ${5:symbolic} # Either :symbolic or :hard
|
||||
${6:#}owner ${7} # The owner of the symlink
|
||||
${8:#}group ${9} # The group of the symlink
|
||||
|
||||
${10:#}${11:action :create} # Create a link (Default)
|
||||
${12:#}${0:action :delete} # Delete a link
|
||||
end
|
||||
|
||||
snippet package
|
||||
# Package resource
|
||||
package ${1:"package_name"} do # Name of the package to install
|
||||
${2:#}version ${3:nil} # The version of the package to install/upgrade
|
||||
${4:#}response_file ${5:nil} # An optional response file - used to pre-seed packages (note: the file is fetched by Remote File)
|
||||
${6:#}source ${7} # Used to provide an optional package source for providers that use a local file (rubygems, dpkg and rpm)
|
||||
${8:#}options ${9:nil} # Add additional options to the underlying package command
|
||||
${10:#}gem_binary ${11:gem} # A gem_package attribut to specify a gem binary. Useful for installing ruby 1.9 gems while running chef in ruby 1.8
|
||||
|
||||
${12:#}${13:action :install} # Install a package - if version is provided, install that specific version (Default)
|
||||
${14:#}${15:action :upgrade} # Upgrade a package - if version is provided, upgrade to that specific version
|
||||
${16:#}${17:action :remove} # Remove a package
|
||||
${18:#}${0:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself)
|
||||
end
|
||||
|
||||
snippet service
|
||||
# Service resource
|
||||
service ${1:"service_name"} do # Name of the service
|
||||
${2:#}enabled ${3:nil} # Whether the service is enabled at boot time
|
||||
${4:#}running ${5:nil} # Make sure the service is running. Start if stopped
|
||||
${6:#}pattern ${7} # Pattern to look for in the process table
|
||||
${8:#}start_command ${9:nil} # Command used to start this service
|
||||
${10:#}stop_command ${11:nil} # Command used to stop this service
|
||||
${12:#}status_command ${13:nil} # Command used to check the service run status
|
||||
${14:#}restart_command ${15:nil} # Command used to restart this service
|
||||
${16:#}reload_command ${17:nil} # Command used to tell this service to reload its configuration
|
||||
${18:#}supports ${19:false} # Features this service supports, ie :restart, :reload, :status
|
||||
|
||||
${20:#}${21:action :enable} # Enable this service
|
||||
${22:#}${23:action :disable} # Disable this service
|
||||
${24:#}${25:action :nothing} # Don't do anything with this service (Default)
|
||||
${26:#}${27:action :start} # Start this service
|
||||
${28:#}${29:action :stop} # Stop this service
|
||||
${30:#}${31:action :restart} # Restart this service
|
||||
${32:#}${0:action :reload} # Reload the configuration for this service
|
||||
end
|
||||
|
||||
snippet file
|
||||
# File resource
|
||||
file ${1:"/path/to/file"} do # Path to the file
|
||||
${2:#}backup ${3:5} # How many backups of this file to keep. Set to false if you want no backups.
|
||||
${4:#}owner ${5} # The owner for the file
|
||||
${6:#}group ${7} # The group owner of the file (string or id)
|
||||
${8:#}mode ${9} # The octal mode of the file (4-digit format)
|
||||
${10:#}content ${11:nil} # A string to write to the file. This will replace any previous content if set
|
||||
|
||||
${12:#}${13:action :create} # Create this file (Default)
|
||||
${14:#}${15:action :delete} # Delete this file
|
||||
${16:#}${0:action :touch} # Touch this file (update the mtime/atime)
|
||||
end
|
||||
|
||||
snippet directory
|
||||
# Directory resource
|
||||
directory ${1:"/path/to/dir"} do # The path to the directory
|
||||
${2:#}group ${3} # The group owner of the directory (string or id)
|
||||
${4:#}mode ${5} # The octal mode of the directory, eg 0755
|
||||
${6:#}owner ${7} # The owner for the directory
|
||||
${10:#}recursive ${11:false} # When deleting the directory, delete it recursively. When creating the directory, create recursively (ie, mkdir -p)
|
||||
|
||||
${12:#}${13:action :create} # Create this directory (Default)
|
||||
${14:#}${0:action :delete} # Delete this directory
|
||||
end
|
||||
|
||||
snippet template
|
||||
# Template resource
|
||||
template ${1:"/path/to/file"} do # Path to the file
|
||||
${2:#}cookbook ${3:nil} # Specify the cookbook where the template is located, default is current cookbook
|
||||
${4:#}source ${5:nil} # Template source file. Found in templates/default for the cookbook
|
||||
${6:#}variables ${7} # Variables to use in the template
|
||||
${8:#}local ${9:false} # Is the template already present on the node?
|
||||
${10:#}backup ${11:5} # How many backups of this file to keep. Set to false if you want no backups.
|
||||
${12:#}owner ${13} # The owner for the file
|
||||
${14:#}group ${15} # The group owner of the file (string or id)
|
||||
${16:#}mode ${17} # The octal mode of the file (4-digit format)
|
||||
${18:#}content ${19:nil} # A string to write to the file. This will replace any previous content if set
|
||||
|
||||
${20:#}${21:action :create} # Create the file (Default)
|
||||
${22:#}${23:action :delete} # Delete this file
|
||||
${24:#}${0:action :touch} # Touch this file (update the mtime/atime)
|
||||
end
|
||||
|
||||
snippet svn
|
||||
# SCM Resource, Chef::Provider::Subversion
|
||||
svn ${1:"/destination/path"} do # Path to clone/checkout/export the source to
|
||||
${2:#}repository ${3} # URI of the repository
|
||||
${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
|
||||
${6:#}reference ${7} # (Git only) alias for revision
|
||||
${8:#}user ${9:nil} # System user to own the checked out code
|
||||
${10:#}group ${11:nil} # System group to own the checked out code
|
||||
${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations
|
||||
${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations
|
||||
${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command
|
||||
|
||||
${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default)
|
||||
${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available
|
||||
${22:#}${0:action :export} # Export the source, excluding or removing any version control artifacts
|
||||
end
|
||||
|
||||
snippet git
|
||||
# SCM Resource, Chef::Provider::Git
|
||||
git ${1:"/destination/path"} do # Path to clone/checkout/export the source to
|
||||
${2:#}repository ${3} # URI of the repository
|
||||
${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
|
||||
${6:#}reference ${7} # (Git only) alias for revision
|
||||
${8:#}user ${9:nil} # System user to own the checked out code
|
||||
${10:#}group ${11:nil} # System group to own the checked out code
|
||||
${12:#}depth ${13:nil} # (Git only) Number of past revisions to include in Git shallow clone
|
||||
${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update
|
||||
${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone
|
||||
${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
|
||||
|
||||
${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default)
|
||||
${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available
|
||||
${24:#}${0:action :export} # Export the source, excluding or removing any version control artifacts
|
||||
end
|
||||
|
||||
snippet deploy
|
||||
# Deploy resource
|
||||
deploy ${1:"/deploy/dir/"} do # Path to deploy to
|
||||
${2:#}deploy_to ${3} # The "meta root" for your application.
|
||||
${4:#}repository ${5} # URI of the repository
|
||||
${6:#}repo ${7} # alias for repository
|
||||
${8:#}revision ${9:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
|
||||
${10:#}branch ${11} # alias for revision
|
||||
${12:#}user ${13:nil} # System user to run the deploy as
|
||||
${14:#}group ${15:nil} # System group to run the deploy as
|
||||
${16:#}svn_username ${17} # (Subversion only) Username for Subversion operations}
|
||||
${18:#}svn_password ${19} # (Subversion only) Password for Subversion operations}
|
||||
${20:#}svn_arguments ${21} # (Subversion only) Extra arguments passed to the subversion command}
|
||||
${22:#}shallow_clone ${23:nil} # (Git only) boolean, true sets clone depth to 5
|
||||
${24:#}enable_submodules ${25:false} # (Git only) performs a submodule init and submodule update
|
||||
${26:#}remote ${27:"origin"} # (Git only) remote repository to use for syncing an existing clone
|
||||
${28:#}ssh_wrapper ${29} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
|
||||
${30:#}git_ssh_wrapper ${31} # alias for ssh_wrapper
|
||||
${32:#}scm_provider ${33:Chef::Provider::Git} # SCM Provider to use.
|
||||
${34:#}repository_cache ${35: "cached-copy"} # Name of the subdirectory where the pristine copy of your app's source is kept
|
||||
${36:#}environment ${37} # A hash of the form {"ENV_VARIABLE"=>"VALUE"}}
|
||||
${38:#}purge_before_symlink ${39:%w(log tmp/pids public/system)} # An array of paths, relative to app root, to be removed from a checkout before symlinking
|
||||
${40:#}create_dirs_before_symlink ${41:%w(tmp public config)} # Directories to create before symlinking. Runs after purge_before_symlink
|
||||
${42:#}symlinks ${43:"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} # A hash that maps files in the shared directory to their paths in the current release
|
||||
${44:#}symlink_before_migrate ${45:"config/database.yml" => "config/database.yml"} # A hash that maps files in the shared directory into the current release. Runs before migration
|
||||
${46:#}migrate ${47:false} # Should the migration command be executed? (true or false)
|
||||
${48:#}migration_command ${49} # A string containing a shell command to execute to run the migration
|
||||
${50:#}restart_command ${51:nil} # A code block to evaluate or a string containing a shell command
|
||||
${52:#}before_migrate ${53:"deploy/before_migrate.rb"} # A block or path to a file containing chef code to run before migrating
|
||||
${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking
|
||||
${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting
|
||||
${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting
|
||||
|
||||
${60:#}${61::deploy} # Deploy the application (Default)
|
||||
${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place
|
||||
${64:#}${0::rollback} # Rollback the application to the previous release
|
||||
end
|
@ -1,87 +0,0 @@
|
||||
snippet comm
|
||||
(comment
|
||||
${0})
|
||||
snippet condp
|
||||
(condp ${1:pred} ${2:expr}
|
||||
${0})
|
||||
snippet def
|
||||
(def ${0})
|
||||
snippet defm
|
||||
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
|
||||
${0:code})
|
||||
snippet defmm
|
||||
(defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn})
|
||||
snippet defma
|
||||
(defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn})
|
||||
snippet defn
|
||||
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
|
||||
${0:code})
|
||||
snippet defp
|
||||
(defprotocol ${1:name}
|
||||
${0:code})
|
||||
snippet defr
|
||||
(defrecord ${1:name} [${2:fields}]
|
||||
${3:protocol}
|
||||
${0:code})
|
||||
snippet deft
|
||||
(deftest ${1:name}
|
||||
(is (= ${0:assertion})))
|
||||
snippet is
|
||||
(is (= ${1} ${0}))
|
||||
snippet defty
|
||||
(deftype ${1:Name} [${2:fields}]
|
||||
${3:Protocol}
|
||||
${0:code})
|
||||
snippet doseq
|
||||
(doseq [${1:elem} ${2:coll}]
|
||||
${0:code})
|
||||
snippet fn
|
||||
(fn [${1:arg-list}] ${0:code})
|
||||
snippet if
|
||||
(if ${1:test-expr}
|
||||
${2:then-expr}
|
||||
${0:else-expr})
|
||||
snippet if-let
|
||||
(if-let [${1:result} ${2:test-expr}]
|
||||
(${3:then-expr} $1)
|
||||
(${0:else-expr}))
|
||||
snippet imp
|
||||
(:import [${1:package}])
|
||||
& {:keys [${1:keys}] :or {${0:defaults}}}
|
||||
snippet let
|
||||
(let [${1:name} ${2:expr}]
|
||||
${0:code})
|
||||
snippet letfn
|
||||
(letfn [(${1:name}) [${2:args}]
|
||||
${0:code})])
|
||||
snippet map
|
||||
(map ${1:func} ${0:coll})
|
||||
snippet mapl
|
||||
(map #(${1:lambda}) ${0:coll})
|
||||
snippet met
|
||||
(${1:name} [${2:this} ${3:args}]
|
||||
${0:code})
|
||||
snippet ns
|
||||
(ns ${0:name})
|
||||
snippet dotimes
|
||||
(dotimes [_ 10]
|
||||
(time
|
||||
(dotimes [_ ${1:times}]
|
||||
${0:code})))
|
||||
snippet pmethod
|
||||
(${1:name} [${2:this} ${0:args}])
|
||||
snippet refer
|
||||
(:refer-clojure :exclude [${0}])
|
||||
snippet require
|
||||
(:require [${1:namespace} :as [${0}]])
|
||||
snippet use
|
||||
(:use [${1:namespace} :only [${0}]])
|
||||
snippet print
|
||||
(println ${0})
|
||||
snippet reduce
|
||||
(reduce ${1:(fn [p n] ${3})} ${2})
|
||||
snippet when
|
||||
(when ${1:test} $0)
|
||||
snippet when-let
|
||||
(when-let [${1:result} ${2:test}]
|
||||
$0)
|
@ -1,83 +0,0 @@
|
||||
snippet init
|
||||
cmake_minimum_required(VERSION ${1:2.8.2})
|
||||
project(${2:ProjectName})
|
||||
|
||||
find_package(${3:library})
|
||||
|
||||
include_directories(${$3_INCLUDE_DIRS})
|
||||
|
||||
add_subdirectory(${0:src})
|
||||
|
||||
add_executable($2)
|
||||
|
||||
target_link_libraries($2 ${$3_LIBRARIES})
|
||||
|
||||
snippet proj
|
||||
project(${0:Name})
|
||||
|
||||
snippet min
|
||||
cmake_minimum_required(VERSION ${0:2.8.2})
|
||||
|
||||
snippet include
|
||||
include_directories(${${0:include_dir}})
|
||||
|
||||
snippet find
|
||||
find_package(${1:library} ${0:REQUIRED})
|
||||
|
||||
snippet glob
|
||||
file(glob ${1:srcs} *.${0:cpp})
|
||||
|
||||
snippet subdir
|
||||
add_subdirectory(${0:src})
|
||||
|
||||
snippet lib
|
||||
add_library(${1:lib} ${${0:srcs}})
|
||||
|
||||
snippet link
|
||||
target_link_libraries(${1:bin} ${0:somelib})
|
||||
|
||||
snippet bin
|
||||
add_executable(${1:bin})
|
||||
|
||||
snippet set
|
||||
set(${1:var} ${0:val})
|
||||
|
||||
snippet dep
|
||||
add_dependencies(${1:target}
|
||||
${0:dep}
|
||||
)
|
||||
|
||||
snippet Ext_url
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${1:googletest}
|
||||
URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip}
|
||||
URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af}
|
||||
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}"
|
||||
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
snippet Ext_git
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${1:googletest}
|
||||
GIT_REPOSITORY ${2:https://github.com/google/googletest.git}
|
||||
GIT_TAG ${3:master}
|
||||
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}"
|
||||
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
snippet props
|
||||
set_target_properties(${1:target}
|
||||
${2:properties} ${3:compile_flags}
|
||||
${0:"-O3 -Wall -pedantic"}
|
||||
)
|
||||
|
||||
snippet test
|
||||
add_test(${1:ATestName} ${0:testCommand --options})
|
@ -1,171 +0,0 @@
|
||||
# Based on nebjak/snipmate.vim/snippets/php.snippets
|
||||
|
||||
# Controller
|
||||
snippet ci_controller
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName} extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${2:// code...}
|
||||
}
|
||||
|
||||
function ${3:index}()
|
||||
{
|
||||
${4:// code...}
|
||||
}
|
||||
}
|
||||
# Model
|
||||
snippet ci_model
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName_model} extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${2:// code...}
|
||||
}
|
||||
}
|
||||
snippet ci_model_crudl
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName_model} extends CI_Model
|
||||
{
|
||||
private $table = '${2:table_name}';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${3:// code...}
|
||||
}
|
||||
|
||||
public function create($data)
|
||||
{
|
||||
if($this->db->insert($this->table, $data))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function read($id)
|
||||
{
|
||||
return $this->db->get_where($this->table, array('id', $id))->result();
|
||||
}
|
||||
|
||||
public function update($id, $data)
|
||||
{
|
||||
if($this->db->update($this->table, $data, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
if(is_array($id))
|
||||
{
|
||||
$this->db->trans_start();
|
||||
foreach($id as $elem)
|
||||
$this->db->delete($this->table, array('id' => $elem));
|
||||
$this->db->trans_complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->db->delete($this->table, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function listRows($limit = null, $offset = 0)
|
||||
{
|
||||
if(!is_null($limit))
|
||||
$this->db->limit($limit, $offset);
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
}
|
||||
# Load view
|
||||
snippet ci_load-view
|
||||
$this->load->view("${1:view_name}", $${2:data});${3}
|
||||
# DB Class snippets
|
||||
snippet ci_db-insert
|
||||
$this->db->insert("${1:table}", $${2:data});${3}
|
||||
snippet ci_db-select
|
||||
$this->db->select("${1:id, ...}");${2}
|
||||
snippet ci_db-from
|
||||
$this->db->from("${1:table}");${2}
|
||||
snippet ci_db-join
|
||||
$this->db->join("${1:table}", "$2", "${3:type}");${4}
|
||||
snippet ci_db-where
|
||||
$this->db->where("${1:key}", "${2:value}");${3}
|
||||
snippet ci_db-or_where
|
||||
$this->db->or_where("${1:key}", "${2:value}");${3}
|
||||
snippet ci_db-get
|
||||
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
|
||||
snippet ci_db-delete
|
||||
$this->db->delete("${1:table}", "${2:where}");${3}
|
||||
snippet ci_db-update
|
||||
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
|
||||
# Input Class snippets
|
||||
snippet ci_input-post
|
||||
$this->input->post("${1:index}");${2}
|
||||
snippet ci_input-get
|
||||
$this->input->get("${1:index}");${2}
|
||||
snippet ci_input-cookie
|
||||
$this->input->cookie("${1:index}");${2}
|
||||
snippet ci_input-server
|
||||
$this->input->server("${1:index}");${2}
|
||||
snippet ci_input-user_agent
|
||||
$this->input->user_agent();${1}
|
||||
snippet ci_input-is_ajax_request
|
||||
$this->input->is_ajax_request();${1}
|
||||
snippet ci_input-is_cli_request
|
||||
$this->input->is_cli_request();${1}
|
||||
# Form Validation Class and Form Helper snippets
|
||||
snippet ci_form_validation-set_rules
|
||||
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
|
||||
snippet ci_form_open
|
||||
form_open("${1:action}");${2}
|
||||
snippet ci_form_open_multipart
|
||||
form_open_multipart("${1:action}");${2}
|
||||
snippet ci_form_hidden
|
||||
form_hidden("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_input
|
||||
form_input("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_password
|
||||
form_password("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_upload
|
||||
form_upload("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_textarea
|
||||
form_textarea("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_dropdown
|
||||
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
|
||||
snippet ci_form_checkbox
|
||||
form_checkbox("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_radio
|
||||
form_radio("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_submit
|
||||
form_submit("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_reset
|
||||
form_reset("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_button
|
||||
form_button("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_label
|
||||
form_label("${1:label text}", "${2:id}");${3}
|
||||
snippet ci_form_close
|
||||
form_close();${1}
|
||||
snippet ci_validation_errors
|
||||
validation_errors();${1}
|
||||
# Session Class snippets
|
||||
snippet ci_session_userdata
|
||||
$this->session->userdata("${1:item}");${2}
|
||||
snippet ci_session_set_userdata
|
||||
$this->session->set_userdata($${1:array});${2}
|
||||
snippet ci_session_flashdata
|
||||
$this->session->flashdata("${1:item}");${2}
|
||||
snippet ci_session_set_flashdata
|
||||
$this->session->set_flashdata("${1:item}", "${2:value}");${3}
|
@ -1,116 +0,0 @@
|
||||
## Global Snippets
|
||||
# Define a new Angular Controller;
|
||||
# You can change the controller name and parameters
|
||||
snippet ngc
|
||||
${1:controllerName} = (${2:scope}, ${3:injectables}) ->
|
||||
${4}
|
||||
# angular.foreach loop
|
||||
snippet ngfor
|
||||
angular.forEach ${1:iterateOver}, (value, key) ->
|
||||
${2}
|
||||
## Module Based Snippets
|
||||
# A new angular module without a config function
|
||||
snippet ngm
|
||||
angular.module '${1:moduleName}', [${2:moduleDependencies}]
|
||||
${3}
|
||||
# A new angular module without a config function and a variable assignment
|
||||
snippet ngma
|
||||
${1:moduleName} = angular.module '$1', [${2:moduleDeps}]
|
||||
${3}
|
||||
# A new angular module with a config function
|
||||
snippet ngmc
|
||||
${1:moduleName} = angular.module('$1', [${2:moduleDeps}], (${3:configDeps}) ->
|
||||
${4}
|
||||
)
|
||||
# A factory in a module
|
||||
snippet ngmfa
|
||||
factory '${1:factoryName}', (${2:dependencies}) ->
|
||||
${3}
|
||||
# Define an Angular Module Service to be attached to a previously defined module
|
||||
# You can change the service name and service injectables
|
||||
snippet ngms
|
||||
service '${1:serviceName}', (${2:injectables}) ->
|
||||
${3}
|
||||
# Define an Angular Module Filter to be attached to a previously defined module
|
||||
# You can change the filter name
|
||||
snippet ngmfi
|
||||
filter '${1:filterName}', (${2:injectables}) ->
|
||||
(input, ${3:args}) ->
|
||||
${4}
|
||||
## Route Based Snippets
|
||||
# Defines a when condition of an AngularJS route
|
||||
snippet ngrw
|
||||
$routeProvider.when '${1:url}',
|
||||
templateUrl: '${2:templateUrl}'
|
||||
controller: '${3:controller}'
|
||||
${4}
|
||||
# Defines a when condition of an AngularJS route with the resolve block
|
||||
snippet ngrwr
|
||||
$routeProvider.when '${1:url}',
|
||||
templateUrl: '${2:templateUrl}'
|
||||
controller: '${3:controller}'
|
||||
resolve:
|
||||
${4}
|
||||
${5}
|
||||
# Defines an otherwise condition of an AngularJS route
|
||||
snippet ngro
|
||||
$routeProvider.otherwise redirectTo: '${1:url}'
|
||||
${2}
|
||||
## Scope Related Snippets
|
||||
# Define a new $scope'd function (usually inside an AngularJS Controller)
|
||||
# You can change the function name and arguments
|
||||
snippet $f
|
||||
$scope.${1:functionName} = (${2:args}) ->
|
||||
${3}
|
||||
# Defines a new $scope'd variable inside an AngularJS controller
|
||||
snippet $v
|
||||
$scope.${1:variable} = ${2:value}
|
||||
${3}
|
||||
# Defines a new $scope'd variable inside an AngularJS controller and assigns a value from a constructor arguments
|
||||
snippet $va
|
||||
$scope.${1:variable} = ${2:variable}
|
||||
${3}
|
||||
# Define a $watch for an expression
|
||||
# You can change the expression to be watched
|
||||
snippet $w
|
||||
$scope.$watch '${1:watchExpr}', (newValue, oldValue) ->
|
||||
${2}
|
||||
# Define a $on for a $broadcast/$emit on the $scope inside an Angular Controller
|
||||
# You can change the event name to listen on
|
||||
snippet $on
|
||||
$scope.$on '${1:eventName}', (event, ${2:args}) ->
|
||||
${3}
|
||||
# Define a $broadcast for a $scope inside an Angular Controller / Angular Controller Function
|
||||
# You can change the event name and optional event arguments
|
||||
snippet $b
|
||||
$scope.$broadcast '${1:eventName}', ${2:eventArgs}
|
||||
${3}
|
||||
# Define an $emit for a $scope inside an Angular Controller / Angular Controller Function
|
||||
# You can change the event name and optional event arguments
|
||||
snippet $e
|
||||
$scope.$emit '${1:eventName}', ${2:eventArgs}
|
||||
${3}
|
||||
## Directive related snippets
|
||||
# A compile function
|
||||
snippet ngdcf
|
||||
compile = (tElement, tAttrs, transclude) ->
|
||||
(scope, element, attrs) ->
|
||||
${1}
|
||||
# A linking function in a directive
|
||||
snippet ngdlf
|
||||
(scope, element, attrs${1:ctrl}) ->
|
||||
${2}
|
||||
# A directive with a compile function
|
||||
snippet ngdc
|
||||
directive '${1:directiveName}', factory = (${2:injectables}) ->
|
||||
directiveDefinitionObject =
|
||||
${3:directiveAttrs}
|
||||
compile: compile = (tElement, tAttrs, transclude) ->
|
||||
(scope, element, attrs) ->
|
||||
directiveDefinitionObject
|
||||
# A directive with a linking function only
|
||||
snippet ngdl
|
||||
.directive('${1:directiveName}', (${2:directiveDeps}) ->
|
||||
(scope, element, attrs${3:ctrl}) ->
|
||||
${4}
|
||||
)
|
@ -1,101 +0,0 @@
|
||||
# Closure loop
|
||||
snippet forindo
|
||||
for ${1:name} in ${2:array}
|
||||
do ($1) ->
|
||||
$0
|
||||
# Array comprehension
|
||||
snippet fora
|
||||
for ${1:name} in ${2:array}
|
||||
$0
|
||||
# Object comprehension
|
||||
snippet foro
|
||||
for ${1:key}, ${2:value} of ${3:object}
|
||||
$0
|
||||
# Range comprehension (inclusive)
|
||||
snippet forr
|
||||
for ${1:name} in [${2:start}..${3:finish}]
|
||||
$0
|
||||
snippet forrb
|
||||
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
|
||||
$0
|
||||
# Range comprehension (exclusive)
|
||||
snippet forrex
|
||||
for ${1:name} in [${2:start}...${3:finish}]
|
||||
$0
|
||||
snippet forrexb
|
||||
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
|
||||
$0
|
||||
# Function
|
||||
snippet fun
|
||||
(${1:args}) ->
|
||||
$0
|
||||
# Function (bound)
|
||||
snippet bfun
|
||||
(${1:args}) =>
|
||||
$0
|
||||
# Class
|
||||
snippet cla class ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${0}
|
||||
snippet cla class .. constructor: ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
constructor: (${2:args}) ->
|
||||
${3}
|
||||
|
||||
${0}
|
||||
snippet cla class .. extends ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
${0}
|
||||
snippet cla class .. extends .. constructor: ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
constructor: (${3:args}) ->
|
||||
${4}
|
||||
|
||||
${0}
|
||||
# If
|
||||
snippet if
|
||||
if $1
|
||||
${0:${VISUAL}}
|
||||
# If __ Else
|
||||
snippet ife
|
||||
if $1
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
# Else if
|
||||
snippet eif
|
||||
else if $1
|
||||
${0:${VISUAL}}
|
||||
# Ternary If
|
||||
snippet ifte Ternary
|
||||
if $1 then $2 else $0
|
||||
# Unless
|
||||
snippet unl Unless
|
||||
$1 unless $0
|
||||
# Switch
|
||||
snippet swi
|
||||
switch ${1:object}
|
||||
when ${2:value}
|
||||
$0
|
||||
|
||||
# Log
|
||||
snippet log
|
||||
console.log ${0}
|
||||
# Try __ Catch
|
||||
snippet try
|
||||
try
|
||||
${1:${VISUAL}}
|
||||
catch ${2:error}
|
||||
${0}
|
||||
# Require
|
||||
snippet req
|
||||
${2:$1} = require '${1:sys}'
|
||||
# Export
|
||||
snippet exp
|
||||
${0:root} = exports ? this
|
||||
|
||||
snippet jsonp
|
||||
JSON.parse ${0:jstr}
|
||||
# JSON.stringify
|
||||
snippet jsons
|
||||
JSON.stringify ${0:object}
|
@ -1,524 +0,0 @@
|
||||
snippet add
|
||||
${1:obj}.add('${2:selector expression}')
|
||||
snippet addClass
|
||||
${1:obj}.addClass('${2:class name}')
|
||||
snippet after
|
||||
${1:obj}.after('${2:Some text <b>and bold!</b>}')
|
||||
snippet ajax
|
||||
$.ajax
|
||||
url: "${1:mydomain.com/url}"
|
||||
type: "${2:POST}"
|
||||
dataType: "${3:xml/html/script/json}"
|
||||
data: ${4:data}
|
||||
complete: (jqXHR, textStatus) ->
|
||||
${5:// callback}
|
||||
success: (data, textStatus, jqXHR) ->
|
||||
${6:// success callback}
|
||||
error: (jqXHR, textStatus, errorThrown) ->
|
||||
${0:// error callback}
|
||||
snippet ajaxcomplete
|
||||
${1:obj}.ajaxComplete (${1:e}, xhr, settings) ->
|
||||
${0:// callback}
|
||||
snippet ajaxerror
|
||||
${1:obj}.ajaxError (${1:e}, xhr, settings, thrownError) ->
|
||||
${2:// error callback}
|
||||
${0}
|
||||
snippet ajaxget
|
||||
$.get '${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(data, textStatus, jqXHR) ->
|
||||
${0:// success callback}
|
||||
snippet ajaxpost
|
||||
$.post '${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(data, textStatus, jqXHR) ->
|
||||
${0:// success callback}
|
||||
snippet ajaxprefilter
|
||||
$.ajaxPrefilter (${1:options}, ${2:originalOptions}, jqXHR) ->
|
||||
${0: // Modify options, control originalOptions, store jqXHR, etc}
|
||||
snippet ajaxsend
|
||||
${1:obj}.ajaxSend (${1:request, settings}) ->
|
||||
${2:// error callback}
|
||||
${0}
|
||||
snippet ajaxsetup
|
||||
$.ajaxSetup({
|
||||
url: "${1:mydomain.com/url}",
|
||||
type: "${2:POST}",
|
||||
dataType: "${3:xml/html/script/json}",
|
||||
data: $.param( $("${4:Element or Expression}") ),
|
||||
complete: (jqXHR, textStatus) ->
|
||||
${5:// callback}
|
||||
,
|
||||
success: (data, textStatus, jqXHR) ->
|
||||
${6:// success callback}
|
||||
,
|
||||
error: (jqXHR, textStatus, errorThrown) ->
|
||||
${0:// error callback}
|
||||
})
|
||||
snippet ajaxstart
|
||||
$.ajaxStart ->
|
||||
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress}
|
||||
${0}
|
||||
snippet ajaxstop
|
||||
$.ajaxStop ->
|
||||
${1:// handler for when all AJAX calls have been completed}
|
||||
${0}
|
||||
snippet ajaxsuccess
|
||||
$.ajaxSuccess (${1:e}, xhr, settings) ->
|
||||
${2:// handler for when any AJAX call is successfully completed}
|
||||
${0}
|
||||
snippet andself
|
||||
${1:obj}.andSelf()
|
||||
snippet animate
|
||||
${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})
|
||||
snippet append
|
||||
${1:obj}.append('${2:Some text <b>and bold!</b>}')
|
||||
snippet appendTo
|
||||
${1:obj}.appendTo('${2:selector expression}')
|
||||
snippet attr
|
||||
${1:obj}.attr('${2:attribute}', '${3:value}')
|
||||
snippet attrm
|
||||
${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})
|
||||
snippet before
|
||||
${1:obj}.before('${2:Some text <b>and bold!</b>}')
|
||||
snippet bind
|
||||
${1:obj}.bind('${2:event name}', (${3:e}) ->
|
||||
${0:// event handler}
|
||||
snippet blur
|
||||
${1:obj}.blur (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet C
|
||||
$.Callbacks()
|
||||
snippet Cadd
|
||||
${1:callbacks}.add(${2:callbacks})
|
||||
snippet Cdis
|
||||
${1:callbacks}.disable()
|
||||
snippet Cempty
|
||||
${1:callbacks}.empty()
|
||||
snippet Cfire
|
||||
${1:callbacks}.fire(${2:args})
|
||||
snippet Cfired
|
||||
${1:callbacks}.fired()
|
||||
snippet Cfirew
|
||||
${1:callbacks}.fireWith(${2:this}, ${3:args})
|
||||
snippet Chas
|
||||
${1:callbacks}.has(${2:callback})
|
||||
snippet Clock
|
||||
${1:callbacks}.lock()
|
||||
snippet Clocked
|
||||
${1:callbacks}.locked()
|
||||
snippet Crem
|
||||
${1:callbacks}.remove(${2:callbacks})
|
||||
snippet change
|
||||
${1:obj}.change (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet children
|
||||
${1:obj}.children('${2:selector expression}')
|
||||
snippet clearq
|
||||
${1:obj}.clearQueue(${2:'queue name'})
|
||||
snippet click
|
||||
${1:obj}.click (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet clone
|
||||
${1:obj}.clone()
|
||||
snippet contains
|
||||
$.contains(${1:container}, ${0:contents})
|
||||
snippet css
|
||||
${1:obj}.css('${2:attribute}', '${3:value}')
|
||||
snippet csshooks
|
||||
$.cssHooks['${1:CSS prop}'] = {
|
||||
get: (elem, computed, extra) ->
|
||||
${2: // handle getting the CSS property}
|
||||
set: (elem, value) ->
|
||||
${0: // handle setting the CSS value}
|
||||
}
|
||||
snippet cssm
|
||||
${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})
|
||||
snippet D
|
||||
$.Deferred()
|
||||
snippet Dalways
|
||||
${1:deferred}.always(${2:callbacks})
|
||||
snippet Ddone
|
||||
${1:deferred}.done(${2:callbacks})
|
||||
snippet Dfail
|
||||
${1:deferred}.fail(${2:callbacks})
|
||||
snippet Disrej
|
||||
${1:deferred}.isRejected()
|
||||
snippet Disres
|
||||
${1:deferred}.isResolved()
|
||||
snippet Dnotify
|
||||
${1:deferred}.notify(${2:args})
|
||||
snippet Dnotifyw
|
||||
${1:deferred}.notifyWith(${2:this}, ${3:args})
|
||||
snippet Dpipe
|
||||
${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter})
|
||||
snippet Dprog
|
||||
${1:deferred}.progress(${2:callbacks})
|
||||
snippet Dprom
|
||||
${1:deferred}.promise(${2:target})
|
||||
snippet Drej
|
||||
${1:deferred}.reject(${2:args})
|
||||
snippet Drejw
|
||||
${1:deferred}.rejectWith(${2:this}, ${3:args})
|
||||
snippet Dres
|
||||
${1:deferred}.resolve(${2:args})
|
||||
snippet Dresw
|
||||
${1:deferred}.resolveWith(${2:this}, ${3:args})
|
||||
snippet Dstate
|
||||
${1:deferred}.state()
|
||||
snippet Dthen
|
||||
${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks})
|
||||
snippet Dwhen
|
||||
$.when(${1:deferreds})
|
||||
snippet data
|
||||
${1:obj}.data(${2:obj})
|
||||
snippet dataa
|
||||
$.data('${1:selector expression}', '${2:key}'${3:, 'value'})
|
||||
snippet dblclick
|
||||
${1:obj}.dblclick (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet delay
|
||||
${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'})
|
||||
snippet dele
|
||||
${1:obj}.delegate '${2:selector expression}', '${3:event name}', (${4:e}) ->
|
||||
${0:// event handler}
|
||||
snippet deq
|
||||
${1:obj}.dequeue(${2:'queue name'})
|
||||
snippet deqq
|
||||
$.dequeue('${1:selector expression}'${2:, 'queue name'})
|
||||
snippet detach
|
||||
${1:obj}.detach('${2:selector expression}')
|
||||
snippet die
|
||||
${1:obj}.die(${2:event}, ${3:handler})
|
||||
snippet each
|
||||
${1:obj}.each (index) ->
|
||||
${0:this.innerHTML = this + " is the element, " + index + " is the position"}
|
||||
snippet el
|
||||
$('<${1}/>'${2:, {}})
|
||||
snippet eltrim
|
||||
$.trim('${1:string}')
|
||||
snippet empty
|
||||
${1:obj}.empty()
|
||||
snippet end
|
||||
${1:obj}.end()
|
||||
snippet eq
|
||||
${1:obj}.eq(${2:element index})
|
||||
snippet error
|
||||
${1:obj}.error (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet eventsmap
|
||||
{
|
||||
:f${0}
|
||||
}
|
||||
snippet extend
|
||||
$.extend(${1:true, }${2:target}, ${3:obj})
|
||||
snippet fadein
|
||||
${1:obj}.fadeIn('${2:slow/400/fast}')
|
||||
snippet fadeinc
|
||||
${1:obj}.fadeIn 'slow/400/fast', ->
|
||||
${0:// callback}
|
||||
snippet fadeout
|
||||
${1:obj}.fadeOut('${2:slow/400/fast}')
|
||||
snippet fadeoutc
|
||||
${1:obj}.fadeOut 'slow/400/fast', ->
|
||||
${0:// callback}
|
||||
snippet fadeto
|
||||
${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})
|
||||
snippet fadetoc
|
||||
${1:obj}.fadeTo 'slow/400/fast', ${2:0.5}, ->
|
||||
${0:// callback}
|
||||
snippet filter
|
||||
${1:obj}.filter('${2:selector expression}')
|
||||
snippet filtert
|
||||
${1:obj}.filter (${2:index}) ->
|
||||
${3}
|
||||
snippet find
|
||||
${1:obj}.find('${2:selector expression}')
|
||||
snippet focus
|
||||
${1:obj}.focus (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet focusin
|
||||
${1:obj}.focusIn (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet focusout
|
||||
${1:obj}.focusOut (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet get
|
||||
${1:obj}.get(${2:element index})
|
||||
snippet getjson
|
||||
$.getJSON '${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(data, textStatus, jqXHR) ->
|
||||
${0:// success callback}
|
||||
snippet getscript
|
||||
$.getScript '${1:mydomain.com/url}', (script, textStatus, jqXHR) ->
|
||||
${0:// callback}
|
||||
snippet grep
|
||||
$.grep(${1:array}, (item, index) >
|
||||
${2}
|
||||
${0:, true})
|
||||
snippet hasc
|
||||
${1:obj}.hasClass('${2:className}')
|
||||
snippet hasd
|
||||
$.hasData('${0:selector expression}')
|
||||
snippet height
|
||||
${1:obj}.height(${2:integer})
|
||||
snippet hide
|
||||
${1:obj}.hide('${2:slow/400/fast}')
|
||||
snippet hidec
|
||||
${1:obj}.hide '${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet hover
|
||||
${1:obj}.hover (${2:e}) ->
|
||||
${3:// event handler}
|
||||
, ($2) ->
|
||||
${4:// event handler}
|
||||
snippet html
|
||||
${1:obj}.html('${2:Some text <b>and bold!</b>}')
|
||||
snippet inarr
|
||||
$.inArray(${1:value}, ${0:array})
|
||||
snippet insa
|
||||
${1:obj}.insertAfter('${2:selector expression}')
|
||||
snippet insb
|
||||
${1:obj}.insertBefore('${2:selector expression}')
|
||||
snippet is
|
||||
${1:obj}.is('${2:selector expression}')
|
||||
snippet isarr
|
||||
$.isArray(${1:obj})
|
||||
snippet isempty
|
||||
$.isEmptyObject(${1:obj})
|
||||
snippet isfunc
|
||||
$.isFunction(${1:obj})
|
||||
snippet isnum
|
||||
$.isNumeric(${1:value})
|
||||
snippet isobj
|
||||
$.isPlainObject(${1:obj})
|
||||
snippet iswin
|
||||
$.isWindow(${1:obj})
|
||||
snippet isxml
|
||||
$.isXMLDoc(${1:node})
|
||||
snippet jj
|
||||
$('${1:selector}')
|
||||
snippet kdown
|
||||
${1:obj}.keydown (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet kpress
|
||||
${1:obj}.keypress (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet kup
|
||||
${1:obj}.keyup (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet last
|
||||
${1:obj}.last('${1:selector expression}')
|
||||
snippet live
|
||||
${1:obj}.live '${2:events}', (${3:e}) ->
|
||||
${0:// event handler}
|
||||
snippet load
|
||||
${1:obj}.load (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet loadf
|
||||
${1:obj}.load('${2:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(responseText, textStatus, xhr) ->
|
||||
${0:// success callback}
|
||||
})
|
||||
snippet makearray
|
||||
$.makeArray(${0:obj})
|
||||
snippet map
|
||||
${1:obj}.map (${2:index}, ${3:element}) ->
|
||||
${0:// callback}
|
||||
snippet mapp
|
||||
$.map ${1:arrayOrObject}, (${2:value}, ${3:indexOrKey}) ->
|
||||
${0:// callback}
|
||||
snippet merge
|
||||
$.merge(${1:target}, ${0:original})
|
||||
snippet mdown
|
||||
${1:obj}.mousedown (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet menter
|
||||
${1:obj}.mouseenter (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mleave
|
||||
${1:obj}.mouseleave (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mmove
|
||||
${1:obj}.mousemove (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mout
|
||||
${1:obj}.mouseout (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mover
|
||||
${1:obj}.mouseover (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mup
|
||||
${1:obj}.mouseup (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet next
|
||||
${1:obj}.next('${2:selector expression}')
|
||||
snippet nexta
|
||||
${1:obj}.nextAll('${2:selector expression}')
|
||||
snippet nextu
|
||||
${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet not
|
||||
${1:obj}.not('${2:selector expression}')
|
||||
snippet off
|
||||
${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler})
|
||||
snippet offset
|
||||
${1:obj}.offset()
|
||||
snippet offsetp
|
||||
${1:obj}.offsetParent()
|
||||
snippet on
|
||||
${1:obj}.on '${2:events}', '${3:selector expression}', (${4:e}) ->
|
||||
${0:// event handler}
|
||||
snippet one
|
||||
${1:obj}.one '${2:event name}', (${3:e}) ->
|
||||
${0:// event handler}
|
||||
snippet outerh
|
||||
${1:obj}.outerHeight()
|
||||
snippet outerw
|
||||
${1:obj}.outerWidth()
|
||||
snippet param
|
||||
$.param(${1:obj})
|
||||
snippet parent
|
||||
${1:obj}.parent('${2:selector expression}')
|
||||
snippet parents
|
||||
${1:obj}.parents('${2:selector expression}')
|
||||
snippet parentsu
|
||||
${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet parsejson
|
||||
$.parseJSON(${1:data})
|
||||
snippet parsexml
|
||||
$.parseXML(${1:data})
|
||||
snippet pos
|
||||
${1:obj}.position()
|
||||
snippet prepend
|
||||
${1:obj}.prepend('${2:Some text <b>and bold!</b>}')
|
||||
snippet prependto
|
||||
${1:obj}.prependTo('${2:selector expression}')
|
||||
snippet prev
|
||||
${1:obj}.prev('${2:selector expression}')
|
||||
snippet preva
|
||||
${1:obj}.prevAll('${2:selector expression}')
|
||||
snippet prevu
|
||||
${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet promise
|
||||
${1:obj}.promise(${2:'fx'}, ${3:target})
|
||||
snippet prop
|
||||
${1:obj}.prop('${2:property name}')
|
||||
snippet proxy
|
||||
$.proxy(${1:function}, ${2:this})
|
||||
snippet pushstack
|
||||
${1:obj}.pushStack(${2:elements})
|
||||
snippet queue
|
||||
${1:obj}.queue(${2:name}${3:, newQueue})
|
||||
snippet queuee
|
||||
$.queue(${1:element}${2:, name}${3:, newQueue})
|
||||
snippet ready
|
||||
$(() ->
|
||||
${0}
|
||||
)
|
||||
snippet rem
|
||||
${1:obj}.remove()
|
||||
snippet rema
|
||||
${1:obj}.removeAttr('${2:attribute name}')
|
||||
snippet remc
|
||||
${1:obj}.removeClass('${2:class name}')
|
||||
snippet remd
|
||||
${1:obj}.removeData('${2:key name}')
|
||||
snippet remdd
|
||||
$.removeData(${1:element}${2:, 'key name}')
|
||||
snippet remp
|
||||
${1:obj}.removeProp('${2:property name}')
|
||||
snippet repa
|
||||
${1:obj}.replaceAll(${2:target})
|
||||
snippet repw
|
||||
${1:obj}.replaceWith(${2:content})
|
||||
snippet reset
|
||||
${1:obj}.reset (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet resize
|
||||
${1:obj}.resize (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet scroll
|
||||
${1:obj}.scroll (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet scrolll
|
||||
${1:obj}.scrollLeft(${2:value})
|
||||
snippet scrollt
|
||||
${1:obj}.scrollTop(${2:value})
|
||||
snippet sdown
|
||||
${1:obj}.slideDown('${2:slow/400/fast}')
|
||||
snippet sdownc
|
||||
${1:obj}.slideDown('${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet select
|
||||
${1:obj}.select (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet serialize
|
||||
${1:obj}.serialize()
|
||||
snippet serializea
|
||||
${1:obj}.serializeArray()
|
||||
snippet show
|
||||
${1:obj}.show('${2:slow/400/fast}')
|
||||
snippet showc
|
||||
${1:obj}.show '${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet sib
|
||||
${1:obj}.siblings('${2:selector expression}')
|
||||
snippet size
|
||||
${1:obj}.size()
|
||||
snippet slice
|
||||
${1:obj}.slice(${2:start}${3:, end})
|
||||
snippet stoggle
|
||||
${1:obj}.slideToggle('${2:slow/400/fast}')
|
||||
snippet stop
|
||||
${1:obj}.stop('${2:queue}', ${3:false}, ${4:false})
|
||||
snippet submit
|
||||
${1:obj}.submit (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet sup
|
||||
${1:obj}.slideUp('${2:slow/400/fast}')
|
||||
snippet supc
|
||||
${1:obj}.slideUp '${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet text
|
||||
${1:obj}.text(${2:'some text'})
|
||||
snippet this
|
||||
$(this)
|
||||
snippet toarr
|
||||
${0:obj}.toArray()
|
||||
snippet tog
|
||||
${1:obj}.toggle (${2:e}) ->
|
||||
${3:// event handler}
|
||||
, ($2) ->
|
||||
${4:// event handler}
|
||||
${0}
|
||||
snippet togclass
|
||||
${1:obj}.toggleClass('${2:class name}')
|
||||
snippet togsh
|
||||
${1:obj}.toggle('${2:slow/400/fast}')
|
||||
snippet trig
|
||||
${1:obj}.trigger('${2:event name}')
|
||||
snippet trigh
|
||||
${1:obj}.triggerHandler('${2:event name}')
|
||||
snippet $trim
|
||||
$.trim(${1:str})
|
||||
snippet $type
|
||||
$.type(${1:obj})
|
||||
snippet unbind
|
||||
${1:obj}.unbind('${2:event name}')
|
||||
snippet undele
|
||||
${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler})
|
||||
snippet uniq
|
||||
$.unique(${1:array})
|
||||
snippet unload
|
||||
${1:obj}.unload (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet unwrap
|
||||
${1:obj}.unwrap()
|
||||
snippet val
|
||||
${1:obj}.val('${2:text}')
|
||||
snippet width
|
||||
${1:obj}.width(${2:integer})
|
||||
snippet wrap
|
||||
${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')
|
@ -1,11 +0,0 @@
|
||||
snippet def
|
||||
define ["${1:#dependencies1}"], (${2:#dependencies2}) ->
|
||||
${0:TARGET}
|
||||
|
||||
snippet defn
|
||||
define "${1:#name}", ["${2:#dependencies1}"], (${3:#dependencies2}) ->
|
||||
${0:TARGET}
|
||||
|
||||
snippet reqjs
|
||||
require ["${1:#dependencies1}"], (${2:#dependencies2}) ->
|
||||
${0:TARGET}
|
@ -1,232 +0,0 @@
|
||||
extends c
|
||||
|
||||
## Main
|
||||
# main()
|
||||
snippet mainn
|
||||
int main()
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet incc
|
||||
#include <${1:iostream}>
|
||||
snippet binc
|
||||
#include <boost/${1:shared_ptr}.hpp>
|
||||
##
|
||||
## STL Collections
|
||||
# std::array
|
||||
snippet array
|
||||
std::array<${1:T}, ${2:N}> ${3};
|
||||
# std::vector
|
||||
snippet vector
|
||||
std::vector<${1:T}> ${2};
|
||||
# std::deque
|
||||
snippet deque
|
||||
std::deque<${1:T}> ${2};
|
||||
# std::forward_list
|
||||
snippet flist
|
||||
std::forward_list<${1:T}> ${2};
|
||||
# std::list
|
||||
snippet list
|
||||
std::list<${1:T}> ${2};
|
||||
# std::set
|
||||
snippet set
|
||||
std::set<${1:T}> ${2};
|
||||
# std::map
|
||||
snippet map
|
||||
std::map<${1:Key}, ${2:T}> ${3};
|
||||
# std::multiset
|
||||
snippet mset
|
||||
std::multiset<${1:T}> ${2};
|
||||
# std::multimap
|
||||
snippet mmap
|
||||
std::multimap<${1:Key}, ${2:T}> ${3};
|
||||
# std::unordered_set
|
||||
snippet uset
|
||||
std::unordered_set<${1:T}> ${2};
|
||||
# std::unordered_map
|
||||
snippet umap
|
||||
std::unordered_map<${1:Key}, ${2:T}> ${3};
|
||||
# std::unordered_multiset
|
||||
snippet umset
|
||||
std::unordered_multiset<${1:T}> ${2};
|
||||
# std::unordered_multimap
|
||||
snippet ummap
|
||||
std::unordered_multimap<${1:Key}, ${2:T}> ${3};
|
||||
# std::stack
|
||||
snippet stack
|
||||
std::stack<${1:T}> ${2};
|
||||
# std::queue
|
||||
snippet queue
|
||||
std::queue<${1:T}> ${2};
|
||||
# std::priority_queue
|
||||
snippet pqueue
|
||||
std::priority_queue<${1:T}> ${2};
|
||||
##
|
||||
## STL smart pointers
|
||||
# std::shared_ptr
|
||||
snippet msp
|
||||
std::shared_ptr<${1:T}> ${2} = std::make_shared<$1>(${3});
|
||||
snippet amsp
|
||||
auto ${1} = std::make_shared<${2:T}>(${3});
|
||||
# std::unique_ptr
|
||||
snippet mup
|
||||
std::unique_ptr<${1:T}> ${2} = std::make_unique<$1>(${3});
|
||||
snippet amup
|
||||
auto ${1} = std::make_unique<${2:T}>(${3});
|
||||
##
|
||||
## Access Modifiers
|
||||
# private
|
||||
snippet pri
|
||||
private
|
||||
# protected
|
||||
snippet pro
|
||||
protected
|
||||
# public
|
||||
snippet pub
|
||||
public
|
||||
# friend
|
||||
snippet fr
|
||||
friend
|
||||
# mutable
|
||||
snippet mu
|
||||
mutable
|
||||
##
|
||||
## Class
|
||||
# class
|
||||
snippet cl
|
||||
/*! \class $1
|
||||
* \brief ${3:Brief class description}
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
||||
{
|
||||
public:
|
||||
$1(${2});
|
||||
virtual ~$1();
|
||||
|
||||
protected:
|
||||
m_${5}; /*!< ${6:Member description} */
|
||||
};
|
||||
# member function implementation
|
||||
snippet mfun
|
||||
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||
${0}
|
||||
}
|
||||
# member function implementation without parameters
|
||||
snippet dmfun0
|
||||
/*! \brief ${4:Brief function description here}
|
||||
*
|
||||
* ${5:Detailed description}
|
||||
*
|
||||
* \return ${6:Return parameter description}
|
||||
*/
|
||||
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
|
||||
${0}
|
||||
}
|
||||
# member function implementation with one parameter
|
||||
snippet dmfun1
|
||||
/*! \brief ${6:Brief function description here}
|
||||
*
|
||||
* ${7:Detailed description}
|
||||
*
|
||||
* \param $4 ${8:Parameter description}
|
||||
* \return ${9:Return parameter description}
|
||||
*/
|
||||
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
|
||||
${0}
|
||||
}
|
||||
# member function implementation with two parameter
|
||||
snippet dmfun2
|
||||
/*! \brief ${8:Brief function description here}
|
||||
*
|
||||
* ${9:Detailed description}
|
||||
*
|
||||
* \param $4 ${10:Parameter description}
|
||||
* \param $6 ${11:Parameter description}
|
||||
* \return ${12:Return parameter description}
|
||||
*/
|
||||
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
|
||||
${0}
|
||||
}
|
||||
# namespace
|
||||
snippet ns
|
||||
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
||||
${0}
|
||||
} /* namespace $1 */
|
||||
snippet ans
|
||||
namespace {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Input/Output
|
||||
# std::cout
|
||||
snippet cout
|
||||
std::cout << ${1} << std::endl;
|
||||
# std::cin
|
||||
snippet cin
|
||||
std::cin >> ${1};
|
||||
##
|
||||
## Casts
|
||||
# static
|
||||
snippet sca
|
||||
static_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# dynamic
|
||||
snippet dca
|
||||
dynamic_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# reinterpret
|
||||
snippet rca
|
||||
reinterpret_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# const
|
||||
snippet cca
|
||||
const_cast<${1:unsigned}>(${2:expr})${3}
|
||||
## Iteration
|
||||
# for i
|
||||
snippet fori
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
|
||||
# foreach
|
||||
snippet fore
|
||||
for (${1:auto} ${2:i} : ${3:container}) {
|
||||
${4}
|
||||
}
|
||||
# iterator
|
||||
snippet iter
|
||||
for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {
|
||||
${6}
|
||||
}
|
||||
|
||||
# auto iterator
|
||||
snippet itera
|
||||
for (auto ${1:i} = ${2:container}.begin(); $1 != $2.end(); ++$1) {
|
||||
${3:std::cout << *$1 << std::endl;}
|
||||
}
|
||||
##
|
||||
## Lambdas
|
||||
# lamda (one line)
|
||||
snippet ld
|
||||
[${1}](${2}){${3}};
|
||||
# lambda (multi-line)
|
||||
snippet lld
|
||||
[${1}](${2}){
|
||||
${3}
|
||||
};
|
||||
# snippets exception
|
||||
snippet try
|
||||
try {
|
||||
|
||||
}catch(${1}) {
|
||||
|
||||
}
|
||||
# auto function
|
||||
snippet af auto function
|
||||
auto ${1:name}(${2}) -> ${3:void}
|
||||
{
|
||||
${0}
|
||||
};
|
@ -1,82 +0,0 @@
|
||||
snippet req require
|
||||
require "${1}"
|
||||
snippet case
|
||||
case $1
|
||||
when $2
|
||||
${0}
|
||||
end
|
||||
snippet when
|
||||
when $1
|
||||
${0}
|
||||
snippet def
|
||||
def ${1:method_name}
|
||||
${0}
|
||||
end
|
||||
snippet pdef
|
||||
private def ${1:method_name}
|
||||
${0}
|
||||
end
|
||||
snippet if
|
||||
if $1
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet ife
|
||||
if $1
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet wh
|
||||
while $1
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet cla class .. end
|
||||
class ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
|
||||
${0}
|
||||
end
|
||||
snippet mod class .. end
|
||||
module ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
|
||||
${0}
|
||||
end
|
||||
snippet r
|
||||
getter ${0:name}
|
||||
snippet r!
|
||||
getter! ${0:name}
|
||||
snippet r?
|
||||
getter? ${0:name}
|
||||
snippet w
|
||||
setter ${0:name}
|
||||
snippet w!
|
||||
setter! ${0:name}
|
||||
snippet w?
|
||||
setter? ${0:name}
|
||||
snippet rw
|
||||
property ${0:name}
|
||||
snippet rw!
|
||||
property! ${0:name}
|
||||
snippet rw?
|
||||
property? ${0:name}
|
||||
snippet defs
|
||||
def self.${1:class_method_name}
|
||||
${0}
|
||||
end
|
||||
snippet defi
|
||||
def initialize(${1})
|
||||
${0}
|
||||
end
|
||||
snippet do
|
||||
do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet dov
|
||||
do |${1:v}|
|
||||
${2}
|
||||
end
|
||||
snippet desc
|
||||
describe ${1:`substitute(substitute(vim_snippets#Filename(), "_spec$", "", ""), "\(_\|^\)\(.\)", "\u\2", "g")`} do
|
||||
${0}
|
||||
end
|
||||
snippet it
|
||||
it "${1}" do
|
||||
${0}
|
||||
end
|
@ -1,531 +0,0 @@
|
||||
# cs.snippets
|
||||
# ===========
|
||||
#
|
||||
# Standard C-Sharp snippets for snipmate.
|
||||
#
|
||||
# Largely ported over from Visual Studio 2010 snippets plus
|
||||
# a few snippets from Resharper plus a few widely known snippets.
|
||||
#
|
||||
# Most snippets on elements (i.e. classes, properties)
|
||||
# follow suffix conventions. The order of suffixes to a snippet
|
||||
# is fixed.
|
||||
#
|
||||
# Snippet Suffix Order
|
||||
# --------------------
|
||||
# 1. Access Modifiers
|
||||
# 2. Class Modifiers
|
||||
#
|
||||
# Access Modifier Suffix Table
|
||||
# ----------------------------
|
||||
# + = public
|
||||
# & = internal
|
||||
# | = protected
|
||||
# - = private
|
||||
#
|
||||
# Example: `cls&` expands to `internal class $1`.
|
||||
# Access modifiers might be doubled to indicate
|
||||
# different modifiers for get/set on properties.
|
||||
# Example: `pb+-` expands to `public bool $1 { get; private set; }`
|
||||
#
|
||||
# Class Modifier Table
|
||||
# --------------------
|
||||
# ^ = static
|
||||
# % = abstract
|
||||
#
|
||||
# Example: `cls|%` expands to `protected abstract class $1`
|
||||
#
|
||||
# On method and property snippets, you can directly set
|
||||
# one of the common types int, string and bool, if desired,
|
||||
# just by appending the type modifier.
|
||||
#
|
||||
# Type Modifier Table
|
||||
# -------------------
|
||||
# i = integer
|
||||
# s = string
|
||||
# b = bool
|
||||
#
|
||||
# Example: `pi+&` expands to `public int $1 { get; internal set; }`
|
||||
#
|
||||
# I'll most propably add more stuff in here like
|
||||
# * List/Array constructio
|
||||
# * Mostly used generics
|
||||
# * Linq
|
||||
# * Funcs, Actions, Predicates
|
||||
# * Lambda
|
||||
# * Events
|
||||
#
|
||||
# Feedback is welcome!
|
||||
#
|
||||
# Main
|
||||
snippet sim
|
||||
${1:public} static int Main(string[] args)
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
snippet simc
|
||||
public class Application
|
||||
{
|
||||
${1:public} static int Main(string[] args)
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
snippet svm
|
||||
${1:public} static void Main(string[] args)
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# if condition
|
||||
snippet if
|
||||
if (${1:true})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet el
|
||||
else
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ifs
|
||||
if (${1})
|
||||
${0:${VISUAL}}
|
||||
# ternary conditional
|
||||
snippet t
|
||||
${1} ? ${2} : ${0}
|
||||
snippet ?
|
||||
${1} ? ${2} : ${0}
|
||||
# do while loop
|
||||
snippet do
|
||||
do
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
} while (${1:true});
|
||||
# while loop
|
||||
snippet wh
|
||||
while (${1:true})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# for loop
|
||||
snippet for
|
||||
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:length}; $1 >= 0; $1--)
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# foreach
|
||||
snippet fore
|
||||
foreach (${1:var} ${2:entry} in ${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet foreach
|
||||
foreach (${1:var} ${2:entry} in ${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet each
|
||||
foreach (${1:var} ${2:entry} in ${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# interfaces
|
||||
snippet interface
|
||||
public interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet if+
|
||||
public interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# class bodies
|
||||
snippet class
|
||||
public class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls
|
||||
${2:public} class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls+
|
||||
public class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls+^
|
||||
public static class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls&
|
||||
internal class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls&^
|
||||
internal static class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls|
|
||||
protected class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls|%
|
||||
protected abstract class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# constructor
|
||||
snippet ctor
|
||||
public ${1:`vim_snippets#Filename()`}()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# properties - auto properties by default.
|
||||
# default type is int with layout get / set.
|
||||
snippet prop
|
||||
${1:public} ${2:int} ${3} { get; set; }
|
||||
snippet p
|
||||
${1:public} ${2:int} ${3} { get; set; }
|
||||
snippet p+
|
||||
public ${1:int} ${2} { get; set; }
|
||||
snippet p+&
|
||||
public ${1:int} ${2} { get; internal set; }
|
||||
snippet p+|
|
||||
public ${1:int} ${2} { get; protected set; }
|
||||
snippet p+-
|
||||
public ${1:int} ${2} { get; private set; }
|
||||
snippet p&
|
||||
internal ${1:int} ${2} { get; set; }
|
||||
snippet p&|
|
||||
internal ${1:int} ${2} { get; protected set; }
|
||||
snippet p&-
|
||||
internal ${1:int} ${2} { get; private set; }
|
||||
snippet p|
|
||||
protected ${1:int} ${2} { get; set; }
|
||||
snippet p|-
|
||||
protected ${1:int} ${2} { get; private set; }
|
||||
snippet p-
|
||||
private ${1:int} ${2} { get; set; }
|
||||
# property - bool
|
||||
snippet pi
|
||||
${1:public} int ${2} { get; set; }
|
||||
snippet pi+
|
||||
public int ${1} { get; set; }
|
||||
snippet pi+&
|
||||
public int ${1} { get; internal set; }
|
||||
snippet pi+|
|
||||
public int ${1} { get; protected set; }
|
||||
snippet pi+-
|
||||
public int ${1} { get; private set; }
|
||||
snippet pi&
|
||||
internal int ${1} { get; set; }
|
||||
snippet pi&|
|
||||
internal int ${1} { get; protected set; }
|
||||
snippet pi&-
|
||||
internal int ${1} { get; private set; }
|
||||
snippet pi|
|
||||
protected int ${1} { get; set; }
|
||||
snippet pi|-
|
||||
protected int ${1} { get; private set; }
|
||||
snippet pi-
|
||||
private int ${1} { get; set; }
|
||||
# property - bool
|
||||
snippet pb
|
||||
${1:public} bool ${2} { get; set; }
|
||||
snippet pb+
|
||||
public bool ${1} { get; set; }
|
||||
snippet pb+&
|
||||
public bool ${1} { get; internal set; }
|
||||
snippet pb+|
|
||||
public bool ${1} { get; protected set; }
|
||||
snippet pb+-
|
||||
public bool ${1} { get; private set; }
|
||||
snippet pb&
|
||||
internal bool ${1} { get; set; }
|
||||
snippet pb&|
|
||||
internal bool ${1} { get; protected set; }
|
||||
snippet pb&-
|
||||
internal bool ${1} { get; private set; }
|
||||
snippet pb|
|
||||
protected bool ${1} { get; set; }
|
||||
snippet pb|-
|
||||
protected bool ${1} { get; private set; }
|
||||
snippet pb-
|
||||
private bool ${1} { get; set; }
|
||||
# property - string
|
||||
snippet ps
|
||||
${1:public} string ${2} { get; set; }
|
||||
snippet ps+
|
||||
public string ${1} { get; set; }
|
||||
snippet ps+&
|
||||
public string ${1} { get; internal set; }
|
||||
snippet ps+|
|
||||
public string ${1} { get; protected set; }
|
||||
snippet ps+-
|
||||
public string ${1} { get; private set; }
|
||||
snippet ps&
|
||||
internal string ${1} { get; set; }
|
||||
snippet ps&|
|
||||
internal string ${1} { get; protected set; }
|
||||
snippet ps&-
|
||||
internal string ${1} { get; private set; }
|
||||
snippet ps|
|
||||
protected string ${1} { get; set; }
|
||||
snippet ps|-
|
||||
protected string ${1} { get; private set; }
|
||||
snippet ps-
|
||||
private string ${1} { get; set; }
|
||||
# members - void
|
||||
snippet m
|
||||
${1:public} ${2:void} ${3}(${4})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m+
|
||||
public ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m&
|
||||
internal ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m|
|
||||
protected ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m-
|
||||
private ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# members - int
|
||||
snippet mi
|
||||
${1:public} int ${2}(${3})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi+
|
||||
public int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi&
|
||||
internal int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi|
|
||||
protected int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi-
|
||||
private int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
# members - bool
|
||||
snippet mb
|
||||
${1:public} bool ${2}(${3})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb+
|
||||
public bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb&
|
||||
internal bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb|
|
||||
protected bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb-
|
||||
private bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
# members - string
|
||||
snippet ms
|
||||
${1:public} string ${2}(${3})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms+
|
||||
public string ${1}(${2})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms&
|
||||
internal string ${1}(${2})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms|
|
||||
protected string ${1:}(${2:})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms-
|
||||
private string ${1}(${2})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
# structure
|
||||
snippet struct
|
||||
public struct ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# enumeration
|
||||
snippet enum
|
||||
enum ${1}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet enum+
|
||||
public enum ${1}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# preprocessor directives
|
||||
snippet #if
|
||||
#if
|
||||
${0}
|
||||
#endif
|
||||
# inline xml documentation
|
||||
snippet ///
|
||||
/// <summary>
|
||||
/// ${0}
|
||||
/// </summary>
|
||||
snippet <p
|
||||
<param name="${1}">${2:$1}</param>
|
||||
snippet <ex
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
snippet <r
|
||||
<returns>${1}</returns>
|
||||
snippet <s
|
||||
<see cref="${1}"/>
|
||||
snippet <rem
|
||||
<remarks>${1}</remarks>
|
||||
snippet <c
|
||||
<code>${1}</code>
|
||||
|
||||
snippet cw
|
||||
Console.WriteLine(${1});
|
||||
|
||||
# equals override
|
||||
snippet eq
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
${0:throw new NotImplementedException();}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
# exception
|
||||
snippet exc
|
||||
public class ${1:MyException} : ${2:Exception}
|
||||
{
|
||||
public $1() { }
|
||||
public $1(string message) : base(message) { }
|
||||
public $1(string message, Exception inner) : base(message, inner) { }
|
||||
protected $1(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
# indexer
|
||||
snippet index
|
||||
public ${1:object} this[${2:int} index]
|
||||
{
|
||||
get { ${0} }
|
||||
set { ${0} }
|
||||
}
|
||||
# eventhandler
|
||||
snippet inv
|
||||
EventHandler temp = ${1:MyEvent};
|
||||
if (${2:temp} != null)
|
||||
{
|
||||
$2();
|
||||
}
|
||||
# lock
|
||||
snippet lock
|
||||
lock (${1:this})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# namespace
|
||||
snippet namespace
|
||||
namespace ${1:MyNamespace}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# property
|
||||
snippet propr
|
||||
public ${1:int} ${2:MyProperty} { get; set; }
|
||||
snippet propf
|
||||
private ${1:int} ${2:myVar};
|
||||
public $1 ${3:MyProperty}
|
||||
{
|
||||
get { return $2; }
|
||||
set { $2 = value; }
|
||||
}
|
||||
snippet propg
|
||||
public ${1:int} ${2:MyProperty} { get; private set; }
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:switch_on})
|
||||
{
|
||||
${0}
|
||||
default:
|
||||
}
|
||||
# try
|
||||
snippet try
|
||||
try
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
catch (${1:System.Exception})
|
||||
{
|
||||
throw;
|
||||
}
|
||||
snippet tryf
|
||||
try
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
finally
|
||||
{
|
||||
${1}
|
||||
}
|
||||
# using
|
||||
snippet usi
|
||||
using (${1:resource})
|
||||
{
|
||||
${0}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,59 +0,0 @@
|
||||
extends cpp
|
||||
|
||||
snippet kern "Kernel definition"
|
||||
__global__ void ${1:kernel}(${2:void}) {
|
||||
${0:// TODO: Implement}
|
||||
}
|
||||
|
||||
snippet dev "Device function definition"
|
||||
__device__ ${1:int} ${2:foo}(${3:void}) {
|
||||
${0:// TODO: Implement}
|
||||
return 0;
|
||||
}
|
||||
|
||||
snippet call "Kernel call"
|
||||
${1:kernel}<<<${2:args}>>>(${3});${0}
|
||||
|
||||
snippet sync "Synchonize threads"
|
||||
__syncthreads();
|
||||
|
||||
snippet tid "Thread Index"
|
||||
threadIdx.${0}
|
||||
|
||||
snippet bid "Block Index"
|
||||
blockIdx.${0}
|
||||
|
||||
snippet bdim "Block Dimension"
|
||||
blockDim.${0}
|
||||
|
||||
snippet ii "Get current index (1D)"
|
||||
int ${1:index} = threadIdx.${2:x} + blockIdx.$2 * blockDim.$2;
|
||||
|
||||
snippet ix "Get current X index (1D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
|
||||
snippet iy "Get current Y index (1D)"
|
||||
int ${1:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
|
||||
snippet iz "Get current Z index (1D)"
|
||||
int ${1:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet ixy "Get current X,Y index (2D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
|
||||
snippet ixz "Get current X,Z index (2D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet iyz "Get current Y,Z index (2D)"
|
||||
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet ixyz "Get current X,Y,Z index (3D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet share "Shared memory declaration"
|
||||
__shared__ ${1:int} ${2:memo}[${3:SIZE}];${0}
|
@ -1,338 +0,0 @@
|
||||
### Import
|
||||
snippet imp
|
||||
import
|
||||
snippet pimp
|
||||
public import
|
||||
### My favorite modules
|
||||
snippet io
|
||||
std.stdio
|
||||
snippet traits
|
||||
std.traits
|
||||
snippet conv
|
||||
std.conv
|
||||
snippet arr
|
||||
std.array
|
||||
snippet algo
|
||||
std.algorithm
|
||||
snippet theusual
|
||||
import std.stdio, std.string, std.array;
|
||||
import std.traits, std.conv, std.algorithm;
|
||||
import std.math, std.regex;
|
||||
### Control Structures
|
||||
snippet for
|
||||
for(int ${1:i} = 0; $1 < ${2:count}; $1++) {
|
||||
${0}
|
||||
}
|
||||
snippet fe
|
||||
foreach(${1:elem}; ${2:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet fei
|
||||
foreach(${1:i}, ${2:elem}; ${3:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet fer
|
||||
foreach_reverse(${1:elem}; ${2:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet feri
|
||||
foreach_reverse(${1:i}, ${2:elem}; ${3:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet sce
|
||||
scope(exit) ${1:f.close();}
|
||||
snippet scs
|
||||
scope(success) ${1}
|
||||
snippet scf
|
||||
scope(failure) ${1}
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
snippet eif
|
||||
else if(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet if
|
||||
if(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
if(${1}) {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
snippet ifee
|
||||
if(${1}) {
|
||||
${2}
|
||||
} else if(${3}) {
|
||||
${4}
|
||||
} else {
|
||||
${5}
|
||||
}
|
||||
snippet sw
|
||||
switch(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet cs
|
||||
case ${1:0}:
|
||||
${2}
|
||||
break;
|
||||
snippet def
|
||||
default:
|
||||
${0}
|
||||
snippet fsw
|
||||
final switch(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet try
|
||||
try {
|
||||
${1:${VISUAL}}
|
||||
} catch(${2:Exception} ${3:e}) {
|
||||
${4}
|
||||
}
|
||||
snippet tcf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
${3}
|
||||
} finally {
|
||||
${4}
|
||||
}
|
||||
snippet wh
|
||||
while(${1:cond}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet dowh
|
||||
do {
|
||||
${1}
|
||||
} while(${2});
|
||||
snippet sif
|
||||
static if(${1:cond}) {
|
||||
${2}
|
||||
}
|
||||
snippet sife
|
||||
static if(${1}) {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
snippet sifee
|
||||
static if(${1}) {
|
||||
${2}
|
||||
} else static if(${3}) {
|
||||
${4}
|
||||
} else {
|
||||
${5}
|
||||
}
|
||||
snippet seif
|
||||
else static if(${1}) {
|
||||
${2}
|
||||
}
|
||||
snippet ?
|
||||
(${1: a > b}) ? ${2:a} : ${3:b};
|
||||
snippet with
|
||||
with(${1:exp}) {
|
||||
${2}
|
||||
} ${0}
|
||||
### Functions
|
||||
snippet fun
|
||||
${1:auto} ${2:func}(${3:params}) {
|
||||
${0}
|
||||
}
|
||||
snippet contr
|
||||
in {
|
||||
${1}
|
||||
} out {
|
||||
${2}
|
||||
} body {
|
||||
${0}
|
||||
}
|
||||
snippet l
|
||||
(${1:x}) => ${2:x}${0:;}
|
||||
snippet funl
|
||||
function (${1:int x}) => ${2}${3:;}
|
||||
snippet del
|
||||
delegate (${1:int x}) => ${2}${3:;}
|
||||
### Templates
|
||||
snippet temp
|
||||
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) {
|
||||
${0}
|
||||
}
|
||||
snippet tempif
|
||||
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) if(${3:isSomeString!}$2) {
|
||||
${0}
|
||||
}
|
||||
snippet opApply
|
||||
int opApply(Dg)(Dg dg) if(ParameterTypeTuble!Dg.length == 2) {
|
||||
${0}
|
||||
}
|
||||
snippet psn
|
||||
pure @safe nothrow
|
||||
snippet safe
|
||||
@safe
|
||||
snippet trusted
|
||||
@trusted
|
||||
snippet system
|
||||
@system
|
||||
### OOPs
|
||||
snippet cl
|
||||
class${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet str
|
||||
struct${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet uni
|
||||
union${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet inter
|
||||
interface I${1:`vim_snippets#Filename("$2", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet enum
|
||||
enum ${1} {
|
||||
${0}
|
||||
}
|
||||
snippet pu
|
||||
public
|
||||
snippet pr
|
||||
private
|
||||
snippet po
|
||||
protected
|
||||
snippet ctor
|
||||
this(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet dtor
|
||||
~this(${1}) {
|
||||
${0}
|
||||
}
|
||||
### Type Witchery
|
||||
snippet al
|
||||
alias ${1:b} = ${2:a};
|
||||
${0}
|
||||
snippet alth
|
||||
alias ${1:value} this;
|
||||
${0}
|
||||
### The Commonplace
|
||||
snippet main
|
||||
void main() {
|
||||
${0}
|
||||
}
|
||||
snippet maina
|
||||
void main(string[] args) {
|
||||
${0}
|
||||
}
|
||||
snippet mod
|
||||
module ${1:main};${0}
|
||||
snippet var
|
||||
${1:auto} ${2:var} = ${0:1};
|
||||
snippet new
|
||||
${1:auto} ${2:var} = new ${3:Object}(${4});
|
||||
${0}
|
||||
snippet file
|
||||
auto ${1:f} = File(${2:"useful_info.xml"}, ${3:"rw"});
|
||||
${0}
|
||||
snippet map
|
||||
map!(${1:f})(${2:xs});
|
||||
${0}
|
||||
snippet filter
|
||||
filter!(${1:p})(${2:xs});
|
||||
${0}
|
||||
snippet reduce
|
||||
reduce!(${1:f})(${2:xs});
|
||||
${0}
|
||||
snippet find
|
||||
find!(${1:p})($2:xs);
|
||||
${0}
|
||||
snippet aa
|
||||
${1:int}[${2:string}] ${3:dict} = ${0};
|
||||
### Misc
|
||||
snippet #!
|
||||
#!/usr/bin/env rdmd
|
||||
snippet bang
|
||||
#!/usr/bin/env rdmd
|
||||
snippet rdmd
|
||||
#!/usr/bin/env rdmd
|
||||
snippet isstr
|
||||
isSomeString!${1:S}
|
||||
snippet isnum
|
||||
isNumeric!${1:N}
|
||||
snippet tos
|
||||
to!string(${1:x});
|
||||
${0}
|
||||
snippet toi
|
||||
to!int(${1:str});
|
||||
${0}
|
||||
snippet tod
|
||||
to!double(${1:str});
|
||||
${0}
|
||||
snippet un
|
||||
unittest {
|
||||
${0}
|
||||
}
|
||||
snippet ver
|
||||
version(${1:Posix}) {
|
||||
${0}
|
||||
}
|
||||
snippet de
|
||||
debug {
|
||||
${0}
|
||||
}
|
||||
snippet sst
|
||||
shared static this(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet td
|
||||
// Typedef is deprecated. Use alias instead.
|
||||
typedef
|
||||
snippet ino
|
||||
inout
|
||||
snippet imm
|
||||
immutable
|
||||
snippet fin
|
||||
final
|
||||
snippet con
|
||||
const
|
||||
snippet psi
|
||||
private static immutable ${1:int} ${2:Constant} = ${3:1};
|
||||
${0}
|
||||
snippet prag
|
||||
pragma(${1})
|
||||
snippet pms
|
||||
pragma(msg, ${1:Warning});
|
||||
snippet asm
|
||||
asm {
|
||||
${1}
|
||||
}
|
||||
snippet mixin
|
||||
mixin(${1:`writeln("Hello, World!");`});
|
||||
snippet over
|
||||
override
|
||||
snippet ret
|
||||
return ${1};
|
||||
snippet FILE
|
||||
__FILE__
|
||||
snippet MOD
|
||||
__MODULE__
|
||||
snippet LINE
|
||||
__LINE__
|
||||
snippet FUN
|
||||
__FUNCTION__
|
||||
snippet PF
|
||||
__PRETTY_FUNCTION__
|
||||
snippet cast
|
||||
cast(${1:T})(${2:val});
|
||||
snippet /*
|
||||
/*
|
||||
* ${1}
|
||||
*/
|
||||
### Fun stuff
|
||||
snippet idk
|
||||
// I don't know how this works. Don't touch it.
|
||||
snippet idfk
|
||||
// Don't FUCKING touch this.
|
@ -1,89 +0,0 @@
|
||||
# Snippets for dart in flutter project, to use add the following to your .vimrc
|
||||
# `autocmd BufRead,BufNewFile,BufEnter *.dart UltiSnipsAddFiletypes dart-flutter`
|
||||
# Flutter stateless widget
|
||||
snippet stless
|
||||
class $1 extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter stateful widget
|
||||
snippet stful
|
||||
class $1 extends StatefulWidget {
|
||||
@override
|
||||
_$1State createState() => _$1State();
|
||||
}
|
||||
|
||||
class _$1State extends State<$1> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter widget with AnimationController
|
||||
snippet stanim
|
||||
class $1 extends StatefulWidget {
|
||||
@override
|
||||
_$1State createState() => _$1State();
|
||||
}
|
||||
|
||||
class _$1State extends State<$1>
|
||||
with SingleTickerProviderStateMixin {
|
||||
AnimationController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter scaffold application
|
||||
snippet fsa
|
||||
void main() {
|
||||
runApp(
|
||||
MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: const HomePage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Home Page'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,83 +0,0 @@
|
||||
snippet lib
|
||||
library ${1};
|
||||
${0}
|
||||
snippet im
|
||||
import 'package:${1}/${2}.dart';
|
||||
${0}
|
||||
snippet rgx
|
||||
new RegExp(r'${1}')
|
||||
snippet var
|
||||
var ${1} = ${2};
|
||||
snippet main
|
||||
main() {
|
||||
${0}
|
||||
}
|
||||
snippet st
|
||||
static ${0}
|
||||
snippet fi
|
||||
final ${0}
|
||||
snippet re
|
||||
return ${0}
|
||||
snippet br
|
||||
break;
|
||||
snippet th
|
||||
throw ${0}
|
||||
snippet cl
|
||||
class ${1:`vim_snippets#Filename("", "untitled")`} ${0}
|
||||
snippet in
|
||||
interface ${1:`vim_snippets#Filename("", "untitled")`} ${0}
|
||||
snippet imp
|
||||
implements ${0}
|
||||
snippet ext
|
||||
extends ${0}
|
||||
snippet if
|
||||
if (${1:true}) {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
else
|
||||
snippet sw
|
||||
switch (${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet cs
|
||||
case ${1}:
|
||||
${0}
|
||||
snippet de
|
||||
default:
|
||||
${0}
|
||||
snippet for
|
||||
for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) {
|
||||
${0:$1[$2]}
|
||||
}
|
||||
snippet fore
|
||||
for (final ${2:item} in ${1:itemList}) {
|
||||
${0}
|
||||
}
|
||||
snippet wh
|
||||
while ($1) {
|
||||
${0}
|
||||
}
|
||||
snippet dowh
|
||||
do {
|
||||
${0}
|
||||
} while ($0);
|
||||
snippet as
|
||||
assert($0);
|
||||
snippet try
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception e}) {
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception e}) {
|
||||
} finally {
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
# DEP-3 (http://dep.debian.net/deps/dep3/) style patch header
|
||||
snippet header DEP-3 style header
|
||||
Description: ${1}
|
||||
Origin: ${2:vendor|upstream|other}, ${3:url of the original patch}
|
||||
Bug: ${4:url in upstream bugtracker}
|
||||
Forwarded: ${5:no|not-needed|url}
|
||||
Author: ${6:`g:snips_author`}
|
||||
Reviewed-by: ${7:name and email}
|
||||
Last-Update: ${8:`strftime("%Y-%m-%d")`}
|
||||
Applied-Upstream: ${0:upstream version|url|commit}
|
||||
|
@ -1,112 +0,0 @@
|
||||
# Model Fields
|
||||
|
||||
# Note: Optional arguments are using defaults that match what Django will use
|
||||
# as a default, e.g. with max_length fields. Doing this as a form of self
|
||||
# documentation and to make it easy to know whether you should override the
|
||||
# default or not.
|
||||
|
||||
# Note: Optional arguments that are booleans will use the opposite since you
|
||||
# can either not specify them, or override them, e.g. auto_now_add=False.
|
||||
|
||||
snippet auto
|
||||
${1:FIELDNAME} = models.AutoField(${0})
|
||||
snippet bigint
|
||||
${1:FIELDNAME} = models.BigIntegerField(${0})
|
||||
snippet binary
|
||||
${1:FIELDNAME} = models.BinaryField(${0})
|
||||
snippet bool
|
||||
${1:FIELDNAME} = models.BooleanField(${0:default=True})
|
||||
snippet char
|
||||
${1:FIELDNAME} = models.CharField(max_length=${2}${0:, blank=True})
|
||||
snippet comma
|
||||
${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${0:, blank=True})
|
||||
snippet date
|
||||
${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
||||
snippet datetime
|
||||
${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
||||
snippet decimal
|
||||
${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${0})
|
||||
snippet email
|
||||
${1:FIELDNAME} = models.EmailField(max_length=${2:75}${0:, blank=True})
|
||||
snippet file
|
||||
${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${0:, max_length=100})
|
||||
snippet filepath
|
||||
${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${0:, blank=True, })
|
||||
snippet float
|
||||
${1:FIELDNAME} = models.FloatField(${0})
|
||||
snippet image
|
||||
${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${0:, max_length=100})
|
||||
snippet int
|
||||
${1:FIELDNAME} = models.IntegerField(${0})
|
||||
snippet ip
|
||||
${1:FIELDNAME} = models.IPAddressField(${0})
|
||||
snippet nullbool
|
||||
${1:FIELDNAME} = models.NullBooleanField(${0})
|
||||
snippet posint
|
||||
${1:FIELDNAME} = models.PositiveIntegerField(${0})
|
||||
snippet possmallint
|
||||
${1:FIELDNAME} = models.PositiveSmallIntegerField(${0})
|
||||
snippet slug
|
||||
${1:FIELDNAME} = models.SlugField(max_length=${2:50}${0:, blank=True})
|
||||
snippet smallint
|
||||
${1:FIELDNAME} = models.SmallIntegerField(${0})
|
||||
snippet text
|
||||
${1:FIELDNAME} = models.TextField(${0:blank=True})
|
||||
snippet time
|
||||
${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
||||
snippet url
|
||||
${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${0:, blank=True})
|
||||
snippet xml
|
||||
${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${0:, blank=True})
|
||||
# Relational Fields
|
||||
snippet fk
|
||||
${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${0:, to_field=''})
|
||||
snippet m2m
|
||||
${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${0:, db_table=''})
|
||||
snippet o2o
|
||||
${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${0:, to_field=''})
|
||||
|
||||
# Code Skeletons
|
||||
|
||||
snippet form
|
||||
class ${1:FormName}(forms.Form):
|
||||
"""${2:docstring}"""
|
||||
${0}
|
||||
|
||||
snippet model
|
||||
class ${1:ModelName}(models.Model):
|
||||
"""${2:docstring}"""
|
||||
${3}
|
||||
|
||||
class Meta:
|
||||
${4}
|
||||
|
||||
def __unicode__(self):
|
||||
${5}
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
${6}
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('${7:view_or_url_name}' ${0})
|
||||
|
||||
snippet modeladmin
|
||||
class ${1:ModelName}Admin(admin.ModelAdmin):
|
||||
${0}
|
||||
|
||||
admin.site.register($1, $1Admin)
|
||||
|
||||
snippet tabularinline
|
||||
class ${0:ModelName}Inline(admin.TabularInline):
|
||||
model = $1
|
||||
|
||||
snippet stackedinline
|
||||
class ${0:ModelName}Inline(admin.StackedInline):
|
||||
model = $1
|
||||
|
||||
snippet r2r
|
||||
return render_to_response('${1:template.html}', {
|
||||
${2}
|
||||
}${0:, context_instance=RequestContext(request)}
|
||||
)
|
@ -1,12 +0,0 @@
|
||||
snippet ec
|
||||
; http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = ${1:space_or_tab}
|
||||
indent_size = ${2:indent_size}
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
@ -1,71 +0,0 @@
|
||||
extends html
|
||||
|
||||
snippet % <% %>
|
||||
<% ${0} %>
|
||||
snippet = <%= %>
|
||||
<%= ${0} %>
|
||||
snippet # <%# %>
|
||||
<%# ${0} %>
|
||||
snippet end
|
||||
<% end %>
|
||||
snippet for
|
||||
<%= for ${1:item} <- ${2:items} ${3:@conn} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet if
|
||||
<%= if ${1} do %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<%= if ${1} do %>
|
||||
${2:${VISUAL}}
|
||||
<% else %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet cond
|
||||
<%= cond do %>
|
||||
<% ${1} -> %>
|
||||
${2:${VISUAL}}
|
||||
|
||||
<% true -> %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet unless
|
||||
<%= unless ${1} do %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ft form_tag
|
||||
<%= form_tag(${1:"/users"}, method: ${2::post}) %>
|
||||
${0}
|
||||
</form>
|
||||
|
||||
snippet sl select
|
||||
<%= select ${1:f}, :${2:field}, ${3:[{"key", "value"}]}, prompt: ${4:"Prompt"} %>
|
||||
|
||||
snippet sb submit
|
||||
<%= submit ${1:"Submit"} %>
|
||||
|
||||
snippet rb radio_button
|
||||
<%= radio_button ${1:f}, :${2:field}, ${3:"value"} %>
|
||||
|
||||
|
||||
snippet et error_tag
|
||||
<%= error_tag ${1:f}, :${2:field} %>
|
||||
snippet ti text_input
|
||||
<%= text_input ${1:f}, :${2:field} %>
|
||||
snippet la label
|
||||
<%= label ${1:f}, :${2:field}, "${3:Label}" %>
|
||||
snippet pi password_input
|
||||
<%= password_input ${1:f}, :${2:password} %>
|
||||
snippet render
|
||||
<%= render "${1:index}.html", ${2:var: @var} %>
|
||||
snippet lin link
|
||||
<%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
|
||||
snippet ff form_for
|
||||
<%= form_for @changeset, ${1:"/users"}, fn f -> %>
|
||||
${0}
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
snippet pry
|
||||
<% require IEx; IEx.pry %>
|
@ -1,297 +0,0 @@
|
||||
snippet do
|
||||
do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet put IO.puts
|
||||
IO.puts("${0}")
|
||||
snippet ins IO.inspect
|
||||
IO.inspect(${0})
|
||||
snippet insl IO.inspect with label
|
||||
IO.inspect(${0}label: "${1:label}")
|
||||
snippet if if .. do .. end
|
||||
if ${1} do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet if: if .. do: ..
|
||||
if $1, do: ${0}
|
||||
snippet ife if .. do .. else .. end
|
||||
if $1 do
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet ife: if .. do: .. else:
|
||||
if $1, do: ${2}, else: ${0}
|
||||
snippet unless unless .. do .. end
|
||||
unless ${1} do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet unless: unless .. do: ..
|
||||
unless $1, do: ${0}
|
||||
snippet unlesse unless .. do .. else .. end
|
||||
unless $1 do
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet unlesse: unless .. do: .. else:
|
||||
unless $1, do: ${2}, else: ${0}
|
||||
snippet cond
|
||||
cond do
|
||||
${1} ->
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet case
|
||||
case ${1} do
|
||||
${2} ->
|
||||
${0}
|
||||
end
|
||||
snippet for
|
||||
for ${1:item} <- ${2:items} do
|
||||
${0}
|
||||
end
|
||||
snippet for:
|
||||
for ${1:item} <- ${2:items}, do: ${0}
|
||||
snippet fori
|
||||
for ${1:item} <- ${2:items}, into: ${3} do
|
||||
${0}
|
||||
end
|
||||
snippet wi
|
||||
with ${1:item} <- ${2:items} do
|
||||
${0}
|
||||
end
|
||||
snippet wie
|
||||
with(
|
||||
${1:item} <- ${2:items}
|
||||
) do
|
||||
${3}
|
||||
else
|
||||
${4} ->
|
||||
${0}
|
||||
end
|
||||
snippet sp
|
||||
@spec ${1:name}(${2:args}) :: ${3:returns}
|
||||
snippet op
|
||||
@opaque ${1:type_name} :: ${2:type}
|
||||
snippet ty
|
||||
@type ${1:type_name} :: ${2:type}
|
||||
snippet typ
|
||||
@typep ${1:type_name} :: ${2:type}
|
||||
snippet cb
|
||||
@callback ${1:name}(${2:args}) :: ${3:returns}
|
||||
snippet df
|
||||
def ${1:name}, do: ${2}
|
||||
snippet dfw
|
||||
def ${1:name}(${2:args}) when ${3:guard}, do:
|
||||
snippet def
|
||||
def ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
"""
|
||||
def ${2:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defs
|
||||
@spec ${1:name}(${2:arg types}) :: ${3:no_return}
|
||||
def $1(${4:args}) do
|
||||
${0}
|
||||
end
|
||||
snippet defsd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
"""
|
||||
@spec ${2:name}(${3:arg types}) :: ${4:no_return}
|
||||
def $2(${5:args}) do
|
||||
${0}
|
||||
end
|
||||
snippet defw
|
||||
def ${1:name}(${2:args}) when ${3:guard} do
|
||||
${0}
|
||||
end
|
||||
snippet defim
|
||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||
${0}
|
||||
end
|
||||
snippet defma
|
||||
defmacro ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defmo
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
${0}
|
||||
end
|
||||
snippet %M
|
||||
%__MODULE__{
|
||||
${1:key_name}: ${2:value}
|
||||
}
|
||||
snippet enfk
|
||||
@enforce_keys [:${1:key_name}]
|
||||
snippet dfp
|
||||
defp ${1:name}, do: ${2}
|
||||
snippet dfpw
|
||||
defp ${1:name}(${2:args}) when ${3:guard}, do: ${4}
|
||||
snippet defp
|
||||
defp ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defpw
|
||||
defp ${1:name}(${2:args}) when ${3:guard} do
|
||||
${0}
|
||||
end
|
||||
snippet defpr
|
||||
defprotocol ${1:name}, [${0:function}]
|
||||
snippet defr
|
||||
defrecord ${1:record_name}, ${0:fields}
|
||||
snippet doc
|
||||
@doc """
|
||||
${0}
|
||||
"""
|
||||
snippet docs
|
||||
@doc ~S"""
|
||||
${0}
|
||||
"""
|
||||
snippet docf
|
||||
@doc false
|
||||
snippet im
|
||||
@impl true
|
||||
snippet fn
|
||||
fn ${1:args} -> ${0} end
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${0}
|
||||
"""
|
||||
snippet mdocs
|
||||
@moduledoc ~S"""
|
||||
${0}
|
||||
"""
|
||||
snippet mdocf
|
||||
@moduledoc false
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${0}
|
||||
end
|
||||
snippet req
|
||||
require ${0:Logger}
|
||||
snippet imp
|
||||
import ${0:module_name}
|
||||
snippet ali
|
||||
alias ${0:module_name}
|
||||
snippet test
|
||||
test "${1:test name}" do
|
||||
${0}
|
||||
end
|
||||
snippet testc
|
||||
test "${1:test_name}", ctx do
|
||||
${0}
|
||||
end
|
||||
snippet testa
|
||||
test "${1:test_name}", %{${2:arg: arg}} do
|
||||
${0}
|
||||
end
|
||||
snippet des
|
||||
describe "${1:test group subject}" do
|
||||
${0}
|
||||
end
|
||||
snippet destag
|
||||
@describetag :${1:describe tag}
|
||||
snippet mtag
|
||||
@moduletag :${1:module tag}
|
||||
snippet dt
|
||||
doctest ${1:filename}
|
||||
snippet tp
|
||||
@tag :pending
|
||||
snippet exunit
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
${0}
|
||||
end
|
||||
snippet setup
|
||||
setup do
|
||||
${1}
|
||||
end
|
||||
snippet setupa
|
||||
setup_all do
|
||||
${1}
|
||||
end
|
||||
snippet try try .. rescue .. end
|
||||
try do
|
||||
${1:${VISUAL}}
|
||||
rescue
|
||||
${2} -> ${0}
|
||||
end
|
||||
snippet pry
|
||||
require IEx; IEx.pry
|
||||
${0}
|
||||
snippet ppry
|
||||
|> (fn x -> require IEx; IEx.pry; x end).()${0}
|
||||
snippet qu
|
||||
quote do
|
||||
${1}
|
||||
end
|
||||
snippet beh
|
||||
@behaviour ${1:Mix.Task}
|
||||
${0}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet >e pipe to each
|
||||
|> Enum.each(fn ${1} -> ${0} end)
|
||||
snippet >m pipe to map
|
||||
|> Enum.map(fn ${1} -> ${0} end)
|
||||
snippet >f pipe to filter
|
||||
|> Enum.filter(fn ${1} -> ${0} end)
|
||||
snippet >r pipe to reduce
|
||||
|> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> ${0} end)
|
||||
snippet >i pipe to inspect
|
||||
|> IO.inspect()
|
||||
snippet >il pipe to inspect with label
|
||||
|> IO.inspect(label: "${1:label}")
|
||||
snippet cs
|
||||
@doc false
|
||||
def child_spec(${1:_opts}) do
|
||||
%{
|
||||
id: __MODULE__,
|
||||
start: {__MODULE__, :start_link, ${2:[]}},
|
||||
restart: ${3::permanent},
|
||||
shutdown: ${4:5000},
|
||||
type: ${5::worker}
|
||||
}
|
||||
end
|
||||
snippet genserver basic genserver structure
|
||||
use GenServer
|
||||
|
||||
@doc false
|
||||
def start_link(init_args) do
|
||||
GenServer.start_link(__MODULE__, init_args, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(state) do
|
||||
{:ok, state}
|
||||
end
|
||||
snippet super basic supervisor structure
|
||||
use Supervisor
|
||||
|
||||
@doc false
|
||||
def start_link(init_args) do
|
||||
Supervisor.start_link(__MODULE__, init_args, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(_init_args) do
|
||||
children = [${1}]
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
snippet impl
|
||||
@impl true
|
||||
def ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet wl word list
|
||||
~w(${0})
|
||||
snippet al atom list
|
||||
~w(${0})a
|
@ -1,158 +0,0 @@
|
||||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1})
|
||||
${0}
|
||||
snippet imp
|
||||
import ${0:Http}
|
||||
snippet impe
|
||||
import ${1:Html} exposing (${0:..})
|
||||
snippet impae
|
||||
import ${1:Json.Encode} as ${2:Encode} exposing (${0:Value})
|
||||
snippet fn
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn1
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn2
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} =
|
||||
${0}
|
||||
snippet fn3
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} =
|
||||
${0}
|
||||
snippet fn0
|
||||
${1:fn} : ${2:a}
|
||||
$1 =
|
||||
${0}
|
||||
snippet case
|
||||
case ${1} of
|
||||
${2} ->
|
||||
${0}
|
||||
snippet -
|
||||
${1} ->
|
||||
${0}
|
||||
snippet let
|
||||
let
|
||||
${1} =
|
||||
${2}
|
||||
in
|
||||
${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
snippet ty
|
||||
type ${1:Msg}
|
||||
= ${0}
|
||||
snippet tya
|
||||
type alias ${1:Model} =
|
||||
${0}
|
||||
snippet test
|
||||
test "${1}" <| \_ -> $0
|
||||
snippet desc
|
||||
describe "${1}" [ $0 ]
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet program Elm 0.18 program
|
||||
import Html exposing (Html)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
type Msg
|
||||
= Noop
|
||||
|
||||
|
||||
main : Program Never Model Msg
|
||||
main =
|
||||
Html.program
|
||||
{ init = init
|
||||
, view = view
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
}
|
||||
|
||||
|
||||
init : ( Model, Cmd Msg )
|
||||
init =
|
||||
{} ! []
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
Noop ->
|
||||
model ! []
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
Sub.none
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
Html.text "Hello, sailor!"
|
||||
snippet element
|
||||
module Main exposing (Model, Msg(..), init, main, subscriptions, update, view)
|
||||
|
||||
import Browser
|
||||
import Html exposing (..)
|
||||
import Json.Encode
|
||||
|
||||
|
||||
main : Program Flags Model Msg
|
||||
main =
|
||||
Browser.element
|
||||
{ init = init
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
, view = view
|
||||
}
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
type alias Flags =
|
||||
Json.Encode.Value
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init flags_ =
|
||||
( {}
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
type Msg
|
||||
= Noop
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
Noop ->
|
||||
( model
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
Sub.none
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
h1 [] [ text "Hello, world!" ]
|
@ -1,722 +0,0 @@
|
||||
# module
|
||||
snippet mod
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
# module and export all
|
||||
snippet modall
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
-compile([export_all]).
|
||||
|
||||
start() ->
|
||||
${0}
|
||||
|
||||
stop() ->
|
||||
ok.
|
||||
snippet d
|
||||
erlang:display(${0}),
|
||||
snippet dt
|
||||
erlang:display({${1}, ${0}}),
|
||||
# define directive
|
||||
snippet def
|
||||
-define(${1:macro}, $2).
|
||||
# export directive
|
||||
snippet exp
|
||||
-export([${1:function}/${0:arity}]).
|
||||
# include directive
|
||||
snippet inc
|
||||
-include("${1:file}").
|
||||
# include_lib directive
|
||||
snippet incl
|
||||
-include_lib("${1:lib}/include/${1}.hrl").${2}
|
||||
# behavior directive
|
||||
snippet beh
|
||||
-behaviour(${1:behaviour}).
|
||||
snippet ifd
|
||||
-ifdef(${1:TEST}).
|
||||
${0}
|
||||
-endif.
|
||||
snippet ifnd
|
||||
-ifndef(${1:TEST}).
|
||||
${0}
|
||||
-endif.
|
||||
snippet undef
|
||||
-undef(${1:macro}).
|
||||
# if expression
|
||||
snippet if
|
||||
if
|
||||
${1:guard} ->
|
||||
$0
|
||||
end
|
||||
# case expression
|
||||
snippet case
|
||||
case ${1:expression} of
|
||||
${2:pattern} ->
|
||||
$0;
|
||||
end
|
||||
# anonymous function
|
||||
snippet fun
|
||||
fun (${1:Parameters}) -> $2 end
|
||||
# try...catch
|
||||
snippet try
|
||||
try
|
||||
${1:${VISUAL}}
|
||||
catch
|
||||
${2:_:_} -> ${0:got_some_exception}
|
||||
end
|
||||
snippet rcv "Receive Expression"
|
||||
receive
|
||||
${1: ${2:pattern}${3: when ${4:guard}} ->
|
||||
$5
|
||||
${6:after
|
||||
${7:expression} ->
|
||||
$8
|
||||
end
|
||||
# record directive
|
||||
snippet rec
|
||||
-record(${1:record}, {${2:field}=${3:value}}).
|
||||
# todo comment
|
||||
snippet todo
|
||||
%% TODO: ${0}
|
||||
## Snippets below (starting with '%') are in EDoc format.
|
||||
## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details
|
||||
# doc comment
|
||||
snippet %d
|
||||
%% @doc ${0}
|
||||
# end of doc comment
|
||||
snippet %e
|
||||
%% @end
|
||||
# specification comment
|
||||
snippet %s
|
||||
%% @spec ${0}
|
||||
# private function marker
|
||||
snippet %p
|
||||
%% @private
|
||||
# OTP application
|
||||
snippet application
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(application).
|
||||
|
||||
-export([start/2, stop/1]).
|
||||
|
||||
start(_Type, _StartArgs) ->
|
||||
case ${0:root_supervisor}:start_link() of
|
||||
{ok, Pid} ->
|
||||
{ok, Pid};
|
||||
Other ->
|
||||
{error, Other}
|
||||
end.
|
||||
|
||||
stop(_State) ->
|
||||
ok.
|
||||
# OTP supervisor
|
||||
snippet supervisor
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% Supervisor callbacks
|
||||
-export([init/1]).
|
||||
|
||||
-define(SERVER, ?MODULE).
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
Server = {${0:my_server}, {${2}, start_link, []},
|
||||
permanent, 2000, worker, [${2}]},
|
||||
Children = [Server],
|
||||
RestartStrategy = {one_for_one, 0, 1},
|
||||
{ok, {RestartStrategy, Children}}.
|
||||
# OTP gen_server
|
||||
snippet gen_server
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(gen_server).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% gen_server callbacks
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
|
||||
|
||||
-define(SERVER, ?MODULE).
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
%%%===================================================================
|
||||
%%% API
|
||||
%%%===================================================================
|
||||
|
||||
start_link() ->
|
||||
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_server callbacks
|
||||
%%%===================================================================
|
||||
|
||||
init([]) ->
|
||||
{ok, #state{}}.
|
||||
|
||||
handle_call(_Request, _From, State) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, State}.
|
||||
|
||||
handle_cast(_Msg, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(_Info, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
ok.
|
||||
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# OTP gen_fsm
|
||||
snippet gen_fsm
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(gen_fsm).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% gen_fsm callbacks
|
||||
-export([init/1, state_name/2, state_name/3, handle_event/3, handle_sync_event/4,
|
||||
handle_info/3, terminate/3, code_change/4]).
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
%%%===================================================================
|
||||
%%% API
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc
|
||||
%% Creates a gen_fsm process which calls Module:init/1 to
|
||||
%% initialize. To ensure a synchronized start-up procedure, this
|
||||
%% function does not return until Module:init/1 has returned.
|
||||
%%
|
||||
%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
start_link() ->
|
||||
gen_fsm:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_fsm callbacks
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a gen_fsm is started using gen_fsm:start/[3,4] or
|
||||
%% gen_fsm:start_link/[3,4], this function is called by the new
|
||||
%% process to initialize.
|
||||
%%
|
||||
%% @spec init(Args) -> {ok, StateName, State} |
|
||||
%% {ok, StateName, State, Timeout} |
|
||||
%% ignore |
|
||||
%% {stop, StopReason}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
init([]) ->
|
||||
{ok, state_name, #state{}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% There should be one instance of this function for each possible
|
||||
%% state name. Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:send_event/2, the instance of this function with the same
|
||||
%% name as the current state name StateName is called to handle
|
||||
%% the event. It is also called if a timeout occurs.
|
||||
%%
|
||||
%% @spec state_name(Event, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
state_name(_Event, State) ->
|
||||
{next_state, state_name, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% There should be one instance of this function for each possible
|
||||
%% state name. Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:sync_send_event/[2,3], the instance of this function with
|
||||
%% the same name as the current state name StateName is called to
|
||||
%% handle the event.
|
||||
%%
|
||||
%% @spec state_name(Event, From, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {reply, Reply, NextStateName, NextState} |
|
||||
%% {reply, Reply, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState} |
|
||||
%% {stop, Reason, Reply, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
state_name(_Event, _From, State) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, state_name, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:send_all_state_event/2, this function is called to handle
|
||||
%% the event.
|
||||
%%
|
||||
%% @spec handle_event(Event, StateName, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_event(_Event, StateName, State) ->
|
||||
{next_state, StateName, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:sync_send_all_state_event/[2,3], this function is called
|
||||
%% to handle the event.
|
||||
%%
|
||||
%% @spec handle_sync_event(Event, From, StateName, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {reply, Reply, NextStateName, NextState} |
|
||||
%% {reply, Reply, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState} |
|
||||
%% {stop, Reason, Reply, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_sync_event(_Event, _From, StateName, State) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, StateName, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% This function is called by a gen_fsm when it receives any
|
||||
%% message other than a synchronous or asynchronous event
|
||||
%% (or a system message).
|
||||
%%
|
||||
%% @spec handle_info(Info,StateName,State)->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_info(_Info, StateName, State) ->
|
||||
{next_state, StateName, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% This function is called by a gen_fsm when it is about to
|
||||
%% terminate. It should be the opposite of Module:init/1 and do any
|
||||
%% necessary cleaning up. When it returns, the gen_fsm terminates with
|
||||
%% Reason. The return value is ignored.
|
||||
%%
|
||||
%% @spec terminate(Reason, StateName, State) -> void()
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
terminate(_Reason, _StateName, _State) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Convert process state when code is changed
|
||||
%%
|
||||
%% @spec code_change(OldVsn, StateName, State, Extra) ->
|
||||
%% {ok, StateName, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
code_change(_OldVsn, StateName, State, _Extra) ->
|
||||
{ok, StateName, State}.
|
||||
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# OTP gen_event
|
||||
snippet gen_event
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(gen_event).
|
||||
|
||||
%% API
|
||||
-export([start_link/0,
|
||||
add_handler/2]).
|
||||
|
||||
%% gen_event callbacks
|
||||
-export([init/1,
|
||||
handle_event/2,
|
||||
handle_call/2,
|
||||
handle_info/2,
|
||||
terminate/2,
|
||||
code_change/3]).
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_event callbacks
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc
|
||||
%% Creates an event manager
|
||||
%%
|
||||
%% @spec start_link() -> {ok, Pid} | {error, Error}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
start_link() ->
|
||||
gen_event:start_link({local, ?MODULE}).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc
|
||||
%% Adds an event handler
|
||||
%%
|
||||
%% @spec add_handler(Handler, Args) -> ok | {'EXIT', Reason} | term()
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
add_handler(Handler, Args) ->
|
||||
gen_event:add_handler(?MODULE, Handler, Args).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_event callbacks
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a new event handler is added to an event manager,
|
||||
%% this function is called to initialize the event handler.
|
||||
%%
|
||||
%% @spec init(Args) -> {ok, State}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
init([]) ->
|
||||
{ok, #state{}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever an event manager receives an event sent using
|
||||
%% gen_event:notify/2 or gen_event:sync_notify/2, this function is
|
||||
%% called for each installed event handler to handle the event.
|
||||
%%
|
||||
%% @spec handle_event(Event, State) ->
|
||||
%% {ok, State} |
|
||||
%% {swap_handler, Args1, State1, Mod2, Args2} |
|
||||
%% remove_handler
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_event(_Event, State) ->
|
||||
{ok, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever an event manager receives a request sent using
|
||||
%% gen_event:call/3,4, this function is called for the specified
|
||||
%% event handler to handle the request.
|
||||
%%
|
||||
%% @spec handle_call(Request, State) ->
|
||||
%% {ok, Reply, State} |
|
||||
%% {swap_handler, Reply, Args1, State1, Mod2, Args2} |
|
||||
%% {remove_handler, Reply}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_call(_Request, State) ->
|
||||
Reply = ok,
|
||||
{ok, Reply, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% This function is called for each installed event handler when
|
||||
%% an event manager receives any other message than an event or a
|
||||
%% synchronous request (or a system message).
|
||||
%%
|
||||
%% @spec handle_info(Info, State) ->
|
||||
%% {ok, State} |
|
||||
%% {swap_handler, Args1, State1, Mod2, Args2} |
|
||||
%% remove_handler
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_info(_Info, State) ->
|
||||
{ok, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever an event handler is deleted from an event manager, this
|
||||
%% function is called. It should be the opposite of Module:init/1 and
|
||||
%% do any necessary cleaning up.
|
||||
%%
|
||||
%% @spec terminate(Reason, State) -> void()
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
terminate(_Reason, _State) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Convert process state when code is changed
|
||||
%%
|
||||
%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# EUnit snippets
|
||||
snippet eunit
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
snippet ieunit
|
||||
-ifdef(TEST).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
|
||||
-endif.
|
||||
snippet itest
|
||||
-ifdef(TEST).
|
||||
|
||||
${1}_test() ->
|
||||
${0}
|
||||
|
||||
-endif.
|
||||
snippet test
|
||||
${1}_test() ->
|
||||
${0}
|
||||
snippet as
|
||||
?assert(${0})
|
||||
snippet asn
|
||||
?assertNot(${0})
|
||||
snippet aseq
|
||||
?assertEqual(${1}, ${0})
|
||||
snippet asneq
|
||||
?assertNotEqual(${1}, ${0})
|
||||
snippet asmat
|
||||
?assertMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet asnmat
|
||||
?assertNotMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet aserr
|
||||
?assertError(${1:Pattern}, ${0:Expression})
|
||||
snippet asex
|
||||
?assertExit(${1:Pattern}, ${0:Expression})
|
||||
snippet asexc
|
||||
?assertException(${1:Class}, ${2:Pattern}, ${0:Expression})
|
||||
# common_test test_SUITE
|
||||
snippet testsuite
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
%% Test server callbacks
|
||||
-export([suite/0, all/0, groups/0,
|
||||
init_per_suite/1, end_per_suite/1,
|
||||
init_per_group/2, end_per_group/2,
|
||||
init_per_testcase/2, end_per_testcase/2]).
|
||||
|
||||
%% Test cases
|
||||
-export([
|
||||
]).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% COMMON TEST CALLBACK FUNCTIONS
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: suite() -> Info
|
||||
%%
|
||||
%% Info = [tuple()]
|
||||
%% List of key/value pairs.
|
||||
%%
|
||||
%% Description: Returns list of tuples to set default properties
|
||||
%% for the suite.
|
||||
%%
|
||||
%% Note: The suite/0 function is only meant to be used to return
|
||||
%% default data values, not perform any other operations.
|
||||
%%--------------------------------------------------------------------
|
||||
suite() ->
|
||||
[{timetrap,{minutes,10}}].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_suite(Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the suite.
|
||||
%%
|
||||
%% Description: Initialization before the suite.
|
||||
%%
|
||||
%% Note: This function is free to add any key/value pairs to the Config
|
||||
%% variable, but should NOT alter/remove any existing entries.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_suite(Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%%
|
||||
%% Description: Cleanup after the suite.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_suite(_Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_group(GroupName, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% GroupName = atom()
|
||||
%% Name of the test case group that is about to run.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding configuration data for the group.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping all test cases and subgroups in the group.
|
||||
%%
|
||||
%% Description: Initialization before each test case group.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_group(_GroupName, Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_group(GroupName, Config0) ->
|
||||
%% void() | {save_config,Config1}
|
||||
%%
|
||||
%% GroupName = atom()
|
||||
%% Name of the test case group that is finished.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding configuration data for the group.
|
||||
%%
|
||||
%% Description: Cleanup after each test case group.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_group(_GroupName, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_testcase(TestCase, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% TestCase = atom()
|
||||
%% Name of the test case that is about to run.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the test case.
|
||||
%%
|
||||
%% Description: Initialization before each test case.
|
||||
%%
|
||||
%% Note: This function is free to add any key/value pairs to the Config
|
||||
%% variable, but should NOT alter/remove any existing entries.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_testcase(TestCase, Config0) ->
|
||||
%% void() | {save_config,Config1} | {fail,Reason}
|
||||
%%
|
||||
%% TestCase = atom()
|
||||
%% Name of the test case that is finished.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for failing the test case.
|
||||
%%
|
||||
%% Description: Cleanup after each test case.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: groups() -> [Group]
|
||||
%%
|
||||
%% Group = {GroupName,Properties,GroupsAndTestCases}
|
||||
%% GroupName = atom()
|
||||
%% The name of the group.
|
||||
%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]
|
||||
%% Group properties that may be combined.
|
||||
%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]
|
||||
%% TestCase = atom()
|
||||
%% The name of a test case.
|
||||
%% Shuffle = shuffle | {shuffle,Seed}
|
||||
%% To get cases executed in random order.
|
||||
%% Seed = {integer(),integer(),integer()}
|
||||
%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
|
||||
%% repeat_until_any_ok | repeat_until_any_fail
|
||||
%% To get execution of cases repeated.
|
||||
%% N = integer() | forever
|
||||
%%
|
||||
%% Description: Returns a list of test case group definitions.
|
||||
%%--------------------------------------------------------------------
|
||||
groups() ->
|
||||
[].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
|
||||
%%
|
||||
%% GroupsAndTestCases = [{group,GroupName} | TestCase]
|
||||
%% GroupName = atom()
|
||||
%% Name of a test case group.
|
||||
%% TestCase = atom()
|
||||
%% Name of a test case.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping all groups and test cases.
|
||||
%%
|
||||
%% Description: Returns the list of groups and test cases that
|
||||
%% are to be executed.
|
||||
%%--------------------------------------------------------------------
|
||||
all() ->
|
||||
[].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% TEST CASES
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: TestCase(Config0) ->
|
||||
%% ok | exit() | {skip,Reason} | {comment,Comment} |
|
||||
%% {save_config,Config1} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the test case.
|
||||
%% Comment = term()
|
||||
%% A comment about the test case that will be printed in the html log.
|
||||
%%
|
||||
%% Description: Test case function. (The name of it must be specified in
|
||||
%% the all/0 list or in a test case group for the test case
|
||||
%% to be executed).
|
||||
%%--------------------------------------------------------------------
|
||||
|
@ -1,138 +0,0 @@
|
||||
# .erb and .rhmtl files
|
||||
|
||||
# Includes html.snippets
|
||||
extends html
|
||||
|
||||
# Rails *****************************
|
||||
snippet rc
|
||||
<% ${0} %>
|
||||
snippet rce
|
||||
<%= ${1} %>
|
||||
snippet %
|
||||
<% ${0} %>
|
||||
snippet =
|
||||
<%= ${1} %>
|
||||
snippet end
|
||||
<% end %>
|
||||
snippet ead
|
||||
<% ${1}.each do |${2}| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet for
|
||||
<% for ${2:item} in ${1} %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet rp
|
||||
<%= render partial: '${0:item}' %>
|
||||
snippet rpl
|
||||
<%= render partial: '${1:item}', locals: { :${2:name} => '${3:value}'${0} } %>
|
||||
snippet rps
|
||||
<%= render partial: '${1:item}', status: ${0:500} %>
|
||||
snippet rpc
|
||||
<%= render partial: '${1:item}', collection: ${0:items} %>
|
||||
snippet lia
|
||||
<%= link_to '${1:link text...}', action: '${0:index}' %>
|
||||
snippet liai
|
||||
<%= link_to '${1:link text...}', action: '${2:edit}', id: ${0:@item} %>
|
||||
snippet lic
|
||||
<%= link_to '${1:link text...}', controller: '${0:items}' %>
|
||||
snippet lica
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
|
||||
snippet licai
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
|
||||
snippet lib
|
||||
<%= link_to '${1:link text...}' do %>
|
||||
<% end %>
|
||||
snippet yield
|
||||
<%= yield ${1::content_symbol} %>
|
||||
snippet conf
|
||||
<% content_for :${1:head} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
|
||||
snippet cs
|
||||
<%= collection_select(:${1:object}, :${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %>
|
||||
snippet ct
|
||||
<%= content_tag '${1:DIV}', ${2:content}${0:,options} %>
|
||||
snippet ff
|
||||
<%= form_for @${1:model} do |f| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet ffi
|
||||
<%= ${1:f}.input :${0:attribute} %>
|
||||
snippet ffcb
|
||||
<%= ${1:f}.check_box :${0:attribute} %>
|
||||
snippet ffe
|
||||
<% error_messages_for :${1:model} %>
|
||||
|
||||
<%= form_for @${2:model} do |f| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet ffff
|
||||
<%= ${1:f}.file_field :${0:attribute} %>
|
||||
snippet ffhf
|
||||
<%= ${1:f}.hidden_field :${0:attribute} %>
|
||||
snippet ffl
|
||||
<%= ${1:f}.label :${2:attribute}, '${0:$2}' %>
|
||||
snippet ffpf
|
||||
<%= ${1:f}.password_field :${0:attribute} %>
|
||||
snippet ffrb
|
||||
<%= ${1:f}.radio_button :${2:attribute}, :${0:tag_value} %>
|
||||
snippet ffs
|
||||
<%= ${1:f}.submit "${0:submit}" %>
|
||||
snippet ffta
|
||||
<%= ${1:f}.text_area :${0:attribute} %>
|
||||
snippet fftf
|
||||
<%= ${1:f}.text_field :${0:attribute} %>
|
||||
snippet fcs
|
||||
<%= ${1:f}.collection_select(:${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %>
|
||||
snippet fields
|
||||
<%= fields_for :${1:model}, @$1 do |${2:f}| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet i18
|
||||
I18n.t('${1:type.key}')
|
||||
snippet it
|
||||
<%= image_tag "${1}"${0} %>
|
||||
snippet jit
|
||||
<%= javascript_include_tag ${0::all} %>
|
||||
snippet jsit
|
||||
<%= javascript_include_tag "${0}" %>
|
||||
snippet lim
|
||||
<%= link_to ${1:model}.${2:name}, ${3:$1}_path(${0:$1}) %>
|
||||
snippet linp
|
||||
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${0:@$3}) %>
|
||||
snippet linpp
|
||||
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${0:@$2}) %>
|
||||
snippet lip
|
||||
<%= link_to "${1:Link text...}", ${2:model}_path(${0:@$2}) %>
|
||||
snippet lipp
|
||||
<%= link_to "${1:Link text...}", ${0:model}s_path %>
|
||||
snippet lt
|
||||
<%= link_to "${1:name}", ${0:dest} %>
|
||||
snippet ntc
|
||||
<%= number_to_currency(${1}) %>
|
||||
snippet ofcfs
|
||||
<%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %>
|
||||
snippet ofs
|
||||
<%= options_for_select ${1:collection}, ${2:value_method} %>
|
||||
snippet rf
|
||||
<%= render file: "${1:file}"${0} %>
|
||||
snippet rt
|
||||
<%= render template: "${1:file}"${0} %>
|
||||
snippet slt
|
||||
<%= stylesheet_link_tag ${1::all}, cache: ${0:true} %>
|
||||
snippet sslt
|
||||
<%= stylesheet_link_tag "${0}" %>
|
||||
snippet if
|
||||
<% if ${1} %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<% if ${1} %>
|
||||
${2}
|
||||
<% else %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet pry
|
||||
<% require 'pry'; binding.pry %>
|
@ -1,71 +0,0 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env falcon
|
||||
|
||||
# Import
|
||||
snippet imp
|
||||
import ${0:module}
|
||||
|
||||
# Function
|
||||
snippet fun
|
||||
function ${2:function_name}(${3})
|
||||
${0}
|
||||
end
|
||||
|
||||
# Class
|
||||
snippet class
|
||||
class ${1:class_name}(${2:class_params})
|
||||
${0:/* members/methods */}
|
||||
end
|
||||
|
||||
# If
|
||||
snippet if
|
||||
if $1
|
||||
${0}
|
||||
end
|
||||
|
||||
# If else
|
||||
snippet ife
|
||||
if $1
|
||||
${0}
|
||||
else
|
||||
${1}
|
||||
end
|
||||
|
||||
# If else if
|
||||
snippet eif
|
||||
elif $1
|
||||
${0}
|
||||
|
||||
# Switch case
|
||||
snippet switch
|
||||
switch ${1:expression}
|
||||
case ${2:item}
|
||||
case ${0:item}
|
||||
default
|
||||
end
|
||||
|
||||
# Select
|
||||
snippet select
|
||||
select ${1:variable}
|
||||
case ${2:TypeSpec}
|
||||
case ${0:TypeSpec}
|
||||
default
|
||||
end
|
||||
|
||||
# For/in Loop
|
||||
snippet forin
|
||||
for ${1:element} in ${2:container}
|
||||
${0}
|
||||
end
|
||||
|
||||
# For/to Loop
|
||||
snippet forto
|
||||
for ${1:lowerbound} to ${2:upperbound}
|
||||
${0}
|
||||
end
|
||||
|
||||
# While Loop
|
||||
snippet wh
|
||||
while ${1:conidition}
|
||||
${0}
|
||||
end
|
@ -1,103 +0,0 @@
|
||||
snippet impl
|
||||
implicit none
|
||||
${0}
|
||||
snippet prog
|
||||
program ${1:main}
|
||||
${0}
|
||||
end program $1
|
||||
snippet mod
|
||||
module ${1:modulename}
|
||||
${0}
|
||||
end module $1
|
||||
snippet proc
|
||||
procedure ${1:name}
|
||||
${0}
|
||||
end procedure $1
|
||||
snippet iface
|
||||
interface ${1:name}
|
||||
${0}
|
||||
end interface $1
|
||||
snippet doc
|
||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
! File: ${2:`vim_snippets#Filename('$1')`}
|
||||
! Author: `g:snips_author`
|
||||
! Email: `g:snips_email`
|
||||
! Github: `g:snips_github`
|
||||
! Description: $1
|
||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
${0}
|
||||
snippet dox
|
||||
!> @brief ${1}
|
||||
!!
|
||||
!> ${2}
|
||||
!> @author `g:snips_author`
|
||||
${0}
|
||||
snippet doxp
|
||||
!> @param[${1}]${0}
|
||||
# Variables definitions
|
||||
# Boolean
|
||||
snippet bool
|
||||
logical :: ${0}
|
||||
# Integer
|
||||
snippet int
|
||||
integer :: ${0}
|
||||
snippet real
|
||||
real :: ${0}
|
||||
# Double Precision
|
||||
snippet double
|
||||
double precision :: ${0}
|
||||
# Char
|
||||
snippet str
|
||||
character(len=${1:*}) :: ${0:}
|
||||
# Types
|
||||
snippet type
|
||||
type(${1:name})
|
||||
${0}
|
||||
end type
|
||||
snippet const
|
||||
${1:type}, parameter :: $2 = ${0}
|
||||
snippet arr
|
||||
${1:type}, ${2:allocatable, }dimension(${3::}) :: ${0}
|
||||
snippet intent
|
||||
${1:type}, intent(inout) :: ${0}
|
||||
# Array
|
||||
snippet /
|
||||
(/ $1 /) ${2:,&} ${0}
|
||||
snippet if
|
||||
if ($1) then
|
||||
${0}
|
||||
end if
|
||||
snippet case
|
||||
select case (${1:expr})
|
||||
case ($2)
|
||||
case default
|
||||
$3
|
||||
end select ${0}
|
||||
snippet do
|
||||
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
|
||||
${0}
|
||||
end do
|
||||
snippet dow
|
||||
do while ($1)
|
||||
$2
|
||||
end do
|
||||
snippet sub
|
||||
subroutine ${1:name}($2)
|
||||
${0}
|
||||
end subroutine $1
|
||||
snippet func
|
||||
function ${1:name}($2) result($3)
|
||||
${0}
|
||||
end function $1
|
||||
snippet pr
|
||||
write(*,*) ${0}
|
||||
snippet dpr
|
||||
write(*,*) '$1 = ', $1
|
||||
snippet read
|
||||
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
|
||||
snippet write
|
||||
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
|
||||
snippet open
|
||||
open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) ${0}
|
||||
snippet close
|
||||
close(unit = ${1:fp}) ${0}
|
@ -1,74 +0,0 @@
|
||||
extends html
|
||||
|
||||
# Freemarker version
|
||||
snippet ver "${.version}"
|
||||
\${.version}
|
||||
# Interpolation
|
||||
snippet int "${interpolation}"
|
||||
\${${0:interpolation${VISUAL}}\}
|
||||
# Interpolation with default string
|
||||
snippet intd "${interpolation!"default_string"}"
|
||||
\${${0:interpolation${VISUAL}}!"${1:default_string}"\}
|
||||
# Comment
|
||||
snippet com "<#-- comment -->"
|
||||
<#-- ${0:comment${VISUAL}} -->
|
||||
# Variable assignment on a single line
|
||||
snippet ass "<#assign variable_name = value />"
|
||||
<#assign ${1:variable_name} = ${0:value${VISUAL}} />
|
||||
# Variable assignments on multiple lines
|
||||
snippet assm "<#assign <#-- multiple lines --> />"
|
||||
<#assign
|
||||
${1:variable_name} = ${0:value${VISUAL}}
|
||||
/>
|
||||
# Local variable assignment on a single
|
||||
snippet loc "<#local variable_name = value />"
|
||||
<#local ${1:variable_name} = ${0:value${VISUAL}} />
|
||||
# Local variable assignments on multiple lines
|
||||
snippet locm "<#local <#-- multiple lines --> />"
|
||||
<#local
|
||||
${1:variable_name} = ${0:value${VISUAL}}
|
||||
/>
|
||||
# Include Freemarker file
|
||||
snippet inc "<#include \"file.ftl\" />"
|
||||
<#include "${0:file.ftl${VISUAL}}" />
|
||||
# If statement
|
||||
snippet if "<#if condition>...</#if>"
|
||||
<#if ${1:true}>
|
||||
${0:${VISUAL}}
|
||||
</#if>
|
||||
# If/else statement
|
||||
snippet ife "<#if condition>...<#else>...</#if>"
|
||||
<#if ${1:true}>
|
||||
${0:${VISUAL}}
|
||||
<#else>
|
||||
${2}
|
||||
</#if>
|
||||
# Iteration over a sequence
|
||||
snippet lis "<#list sequence as element>...</#list>"
|
||||
<#list ${1:sequence} as ${2:element}>
|
||||
${0:${VISUAL}}
|
||||
</#list>
|
||||
# Iteration over an hashmap
|
||||
snippet lish "<#list hashmap?keys as element>...</#list>"
|
||||
<#list ${1:hashmap}?keys as ${2:key}>
|
||||
\${$2\}: \${$1[$2]\}${0:${VISUAL}}
|
||||
</#list>
|
||||
# Macro statement
|
||||
snippet mac "<#macro macro_name param1>...</#macro>"
|
||||
<#macro ${1:macro_name} ${2:param1}>
|
||||
${0:${VISUAL}}
|
||||
</#macro>
|
||||
# Function statement
|
||||
snippet fun "<#function function_name param1>...</#function>"
|
||||
<#function ${1:function_name} ${2:param1}>
|
||||
${0:${VISUAL}}
|
||||
</#function>
|
||||
# Attempt statement (try-catch to prevent runtime exceptions)
|
||||
snippet att "<#attempt>...<#recover></#attempt>"
|
||||
<#attempt>
|
||||
${0:${VISUAL}}
|
||||
<#recover>
|
||||
</#attempt>
|
||||
# Then built-in for booleans
|
||||
snippet ?th "?then(true, false)"
|
||||
?then(${1:true}, ${0:false${VISUAL}})
|
@ -1,80 +0,0 @@
|
||||
snippet doc
|
||||
/// ${0}
|
||||
snippet comment
|
||||
// ${0}
|
||||
snippet let
|
||||
let ${1} = ${0}
|
||||
snippet lit
|
||||
[<Literal>]
|
||||
let ${1} = ${0}
|
||||
snippet rec
|
||||
type ${1} = { ${0} }
|
||||
snippet arec
|
||||
{| ${0} |}
|
||||
snippet fn
|
||||
let ${1} =
|
||||
${0}
|
||||
snippet fnr
|
||||
let rec ${1} =
|
||||
${0}
|
||||
snippet lam
|
||||
(fun ${1} -> ${0})
|
||||
snippet mod
|
||||
module ${1} =
|
||||
${0}
|
||||
snippet for
|
||||
for ${1} in ${2} do
|
||||
${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2}
|
||||
snippet ife
|
||||
if ${1} then
|
||||
${2}
|
||||
else
|
||||
${0}
|
||||
snippet ifee
|
||||
if ${1} then
|
||||
${2}
|
||||
elif ${3} then
|
||||
${4}
|
||||
else
|
||||
${0}
|
||||
snippet eif
|
||||
elif ${1} then
|
||||
${0}
|
||||
snippet el
|
||||
else
|
||||
${0}
|
||||
snippet try
|
||||
try
|
||||
${1}
|
||||
with ${0}
|
||||
snippet match
|
||||
match ${1} with
|
||||
| ${2} -> ${0}
|
||||
snippet |
|
||||
| ${1} -> ${0}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet pr
|
||||
printfn "${1}" ${0}
|
||||
snippet pri
|
||||
printfn \$"${0}"
|
||||
snippet amap
|
||||
|> Array.map (fun ${1} -> ${0})
|
||||
snippet lmap
|
||||
|> List.map (fun ${1} -> ${0})
|
||||
snippet smap
|
||||
|> Seq.map (fun ${1} -> ${0})
|
||||
snippet atap
|
||||
|> Array.map (fun x -> printfn "%A" x; x) // tap
|
||||
snippet ltap
|
||||
|> List.map (fun x -> printfn "%A" x; x) // tap
|
||||
snippet stap
|
||||
|> Seq.map (fun x -> printfn "%A" x; x) // tap
|
||||
snippet main
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
${0}
|
||||
0
|
@ -1,2 +0,0 @@
|
||||
snippet co
|
||||
Co-authored-by: ${1} <${2}>
|
@ -1,98 +0,0 @@
|
||||
snippet fn "fn"
|
||||
fn ${1:function_name}(${2}) -> ${3:Nil} {
|
||||
${0:${VISUAL:todo}}
|
||||
}
|
||||
|
||||
snippet pfn "pub fn"
|
||||
pub fn ${1:function_name}(${2}) -> ${3:Nil} {
|
||||
${0:${VISUAL:todo}}
|
||||
}
|
||||
|
||||
snippet test "test fn"
|
||||
pub fn ${1:name}_test() {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet af "anonymous fn"
|
||||
fn(${1}) { ${0:${VISUAL}} }
|
||||
|
||||
snippet let "let binding"
|
||||
let ${1} = ${0}
|
||||
|
||||
snippet l "let binding"
|
||||
let ${1} = ${0}
|
||||
|
||||
snippet as "assert binding"
|
||||
assert ${1} = ${0}
|
||||
|
||||
snippet tr "try binding"
|
||||
try ${1} = ${0}
|
||||
|
||||
snippet - "->"
|
||||
-> ${0}
|
||||
|
||||
snippet case "case expression"
|
||||
case ${1} {
|
||||
${2} -> ${0}
|
||||
}
|
||||
|
||||
snippet ty "type"
|
||||
type ${1:Name} {
|
||||
${0:$1}
|
||||
}
|
||||
|
||||
snippet pty "pub type"
|
||||
pub type ${1:Name} {
|
||||
${0:$1}
|
||||
}
|
||||
|
||||
snippet tya "type alias"
|
||||
type ${1:Name} =
|
||||
${0:$1}
|
||||
|
||||
snippet ptya "pub type alias"
|
||||
pub type ${1:Name} =
|
||||
${0:$1}
|
||||
|
||||
snippet ext "external type"
|
||||
external type ${0}
|
||||
|
||||
snippet pext "pub external type"
|
||||
pub external type ${0}
|
||||
|
||||
snippet exfn "external fn"
|
||||
external fn ${1:function_name}(${2}) -> ${3}
|
||||
= "${4}" "${0}"
|
||||
|
||||
snippet pexfn "pub external fn"
|
||||
pub external fn ${1:function_name}(${2}) -> ${3}
|
||||
= "${4}" "${0}"
|
||||
|
||||
snippet im "import"
|
||||
import ${0:gleam/result}
|
||||
|
||||
snippet im. "import exposing"
|
||||
import ${1:gleam/result}.{${0}}
|
||||
|
||||
snippet p "|>"
|
||||
|> ${0}
|
||||
|
||||
snippet tup "tuple()"
|
||||
tuple(${0:${VISUAL}})
|
||||
|
||||
snippet bl "block"
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet tf "fn(Type) -> Type"
|
||||
fn(${1}) -> ${0}
|
||||
|
||||
snippet seq "should.equal"
|
||||
should.equal(${0:${VISUAL}})
|
||||
|
||||
snippet strue "should.be_true"
|
||||
should.be_true(${0:${VISUAL}})
|
||||
|
||||
snippet sfalse "should.be_false"
|
||||
should.be_true(${0:${VISUAL}})
|
@ -1,280 +0,0 @@
|
||||
snippet v "shorthand variable declaration"
|
||||
${1} := ${2}
|
||||
|
||||
snippet vr "variable initialization"
|
||||
var ${1:t} ${0:string}
|
||||
|
||||
snippet var "variable declaration"
|
||||
var ${1} ${2} = ${3}
|
||||
|
||||
snippet vars "variables declaration"
|
||||
var (
|
||||
${1} ${2} = ${3}
|
||||
)
|
||||
|
||||
snippet ap "append"
|
||||
append(${1:slice}, ${0:value})
|
||||
|
||||
snippet bl "bool"
|
||||
bool
|
||||
|
||||
snippet bt "byte"
|
||||
byte
|
||||
|
||||
snippet br "break"
|
||||
break
|
||||
|
||||
snippet ch "channel"
|
||||
chan ${0:int}
|
||||
|
||||
snippet cs "case"
|
||||
case ${1:value}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
snippet co "constants with iota"
|
||||
const (
|
||||
${1:NAME1} = iota
|
||||
${0:NAME2}
|
||||
)
|
||||
|
||||
snippet cn "continue"
|
||||
continue
|
||||
|
||||
snippet df "defer"
|
||||
defer ${0:func}()
|
||||
|
||||
snippet dfr "defer recover"
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}()
|
||||
|
||||
snippet im "import"
|
||||
import (
|
||||
"${1:package}"
|
||||
)
|
||||
|
||||
snippet in "interface"
|
||||
interface{}
|
||||
|
||||
snippet inf "full interface "
|
||||
interface ${1:name} {
|
||||
${2:/* methods */}
|
||||
}
|
||||
|
||||
snippet if "if condition"
|
||||
if $1 {
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
|
||||
|
||||
snippet ife "if else condition"
|
||||
if $1 {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet el "else"
|
||||
else {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet ir "if error not nil, return err"
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet f "false"
|
||||
false
|
||||
|
||||
snippet ft "fallthrough"
|
||||
fallthrough
|
||||
|
||||
snippet fl "float"
|
||||
float32
|
||||
|
||||
snippet f3 "float32"
|
||||
float32
|
||||
|
||||
snippet f6 "float64"
|
||||
float64
|
||||
|
||||
snippet for "for loop"
|
||||
for ${1}{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet fori "for int loop"
|
||||
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet forr "for range loop"
|
||||
for ${1:e} := range ${2:collection} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet fun "function"
|
||||
func ${1:funcName}(${2}) ${3:error} {
|
||||
${4}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet fum "method"
|
||||
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
|
||||
${6}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet fumh "http handler function on receiver"
|
||||
func (${1:receiver} ${2:type}) ${3:funcName}(${4:w} http.ResponseWriter, ${5:r} *http.Request) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet lf "log printf"
|
||||
log.Printf("%${1:s}", ${2:var})
|
||||
|
||||
snippet lp "log println"
|
||||
log.Println("${1}")
|
||||
|
||||
snippet mk "make"
|
||||
make(${1:[]string}, ${0:0})
|
||||
|
||||
snippet mp "map"
|
||||
map[${1:string}]${0:int}
|
||||
|
||||
snippet main "func main()"
|
||||
func main() {
|
||||
${1}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet nw "new"
|
||||
new(${0:type})
|
||||
|
||||
snippet pa "package"
|
||||
package ${1:main}
|
||||
|
||||
snippet pn "panic"
|
||||
panic("${0:msg}")
|
||||
|
||||
snippet pf "fmt.Printf()"
|
||||
fmt.Printf("%${1:s}\n", ${2:var})
|
||||
|
||||
snippet pl "fmt.Println()"
|
||||
fmt.Println("${1:s}")
|
||||
|
||||
snippet rn "range"
|
||||
range ${0}
|
||||
|
||||
snippet rt "return"
|
||||
return ${0}
|
||||
|
||||
snippet rs "result"
|
||||
result
|
||||
|
||||
snippet sl "select"
|
||||
select {
|
||||
case ${1:v1} := <-${2:chan1}
|
||||
${3}
|
||||
default:
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet sr "string"
|
||||
string
|
||||
|
||||
snippet st "struct"
|
||||
struct ${1:name} {
|
||||
${2:/* data */}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet sw "switch"
|
||||
switch ${1:var} {
|
||||
case ${2:value1}:
|
||||
${3}
|
||||
case ${4:value2}:
|
||||
${5}
|
||||
default:
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet ps "fmt.Sprintf"
|
||||
fmt.Sprintf("%${1:s}", ${2:var})
|
||||
|
||||
snippet t "true"
|
||||
true
|
||||
|
||||
snippet g "goroutine named function"
|
||||
go ${1:funcName}(${0})
|
||||
|
||||
snippet ga "goroutine anonymous function"
|
||||
go func(${1} ${2:type}) {
|
||||
${3:/* code */}
|
||||
}(${0})
|
||||
|
||||
snippet test "test function"
|
||||
func Test${1:name}(t *testing.T) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet testt "table test function"
|
||||
func Test${1:name}(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
}{
|
||||
{
|
||||
name: "${2:test name}",
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
${0:${VISUAL}}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
snippet bench "benchmark function"
|
||||
func Benchmark${1:name}(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
${2}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet cl "composite literals"
|
||||
type ${1:name} struct {
|
||||
${2:attrName} ${3:attrType}
|
||||
}
|
||||
|
||||
snippet om "if key in a map"
|
||||
if ${1:value}, ok := ${2:map}[${3:key}]; ok == true {
|
||||
${4:/* code */}
|
||||
}
|
||||
|
||||
|
||||
snippet gg "Grouped globals with anonymous struct"
|
||||
var ${1:var} = struct{
|
||||
${2:name} ${3:type}
|
||||
}{
|
||||
$2: ${4:value},
|
||||
}
|
||||
|
||||
|
||||
snippet ja "Marshalable json alias"
|
||||
type ${1:parentType}Alias $1
|
||||
|
||||
func (p *$1) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)})
|
||||
}
|
||||
|
||||
|
||||
snippet errwr "Error handling with fmt.Errorf"
|
||||
if ${1}err != nil {
|
||||
return fmt.Errorf("${2} %w", err)
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
snippet t
|
||||
%table
|
||||
%tr
|
||||
%th
|
||||
${1:headers}
|
||||
%tr
|
||||
%td
|
||||
${0:headers}
|
||||
snippet ul
|
||||
%ul
|
||||
%li
|
||||
${0:item}
|
||||
%li
|
||||
snippet rp
|
||||
= render :partial => "${0:item}"
|
||||
snippet rpc
|
||||
= render :partial => "${1:item}", :collection => ${0:@$1s}
|
||||
snippet rpl
|
||||
= render :partial => "${1:item}", :locals => { :${2:$1} => ${0:@$1} }
|
||||
snippet rpo
|
||||
= render :partial => "${1:item}", :object => ${0:@$1}
|
||||
snippet lt
|
||||
= link_to ${1:name}, ${2:dest}
|
||||
snippet mt
|
||||
= mail_to ${1:email_address}, ${2:name}
|
||||
snippet mts
|
||||
= mail_to ${1:email_address}, ${2:name}, :subject => ${3}, :body => ${4}
|
||||
snippet ife
|
||||
- if $1
|
||||
${2:${VISUAL}}
|
||||
- else
|
||||
${0}
|
||||
snippet ifp
|
||||
- if $1.presence?
|
||||
${0:${VISUAL}}
|
||||
snippet ntc
|
||||
= number_to_currency(${1})
|
@ -1,14 +0,0 @@
|
||||
snippet if # {{#if value}} ... {{/if}}
|
||||
{{#if ${1:value}}}
|
||||
${0:${VISUAL}}
|
||||
{{/if}}
|
||||
snippet ifn # {{#unless value}} ... {{/unless}}
|
||||
{{#unless ${1:value}}}
|
||||
${0:${VISUAL}}
|
||||
{{/unless}}
|
||||
snippet ife # {{#if value}} ... {{else}} .. {{/if}}
|
||||
{{#if ${1:value}}}
|
||||
${2:${VISUAL}}
|
||||
{{else}}
|
||||
${3}
|
||||
{{/if}}
|
@ -1,151 +0,0 @@
|
||||
snippet lang
|
||||
{-# LANGUAGE ${0:OverloadedStrings} #-}
|
||||
snippet haddock
|
||||
{-# OPTIONS_HADDOCK ${0:hide} #-}
|
||||
snippet ghc
|
||||
{-# OPTIONS_GHC ${0:-fno-warn-unused-imports} #-}
|
||||
snippet inline
|
||||
{-# INLINE ${0:name} #-}
|
||||
snippet info
|
||||
-- |
|
||||
-- Module : ${1:`substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`}
|
||||
-- Copyright : ${2:Author} ${3:2011-2012}
|
||||
-- License : ${4:BSD3}
|
||||
--
|
||||
-- Maintainer : ${5:email@something.com}
|
||||
-- Stability : ${6:experimental}
|
||||
-- Portability : ${7:unknown}
|
||||
--
|
||||
-- ${0:Description}
|
||||
--
|
||||
snippet imp
|
||||
import ${0:Data.Text}
|
||||
snippet import
|
||||
import ${0:Data.Text}
|
||||
snippet import2
|
||||
import ${1:Data.Text} (${0:head})
|
||||
snippet impq
|
||||
import qualified ${1:Data.Text} as ${0:T}
|
||||
snippet importq
|
||||
import qualified ${1:Data.Text} as ${0:T}
|
||||
snippet inst
|
||||
instance ${1:Monoid} ${2:Type} where
|
||||
${0}
|
||||
snippet ty
|
||||
type ${1:Type} = ${0:Type}
|
||||
snippet type
|
||||
type ${1:Type} = ${0:Type}
|
||||
snippet da
|
||||
data ${1:Type} = ${2:$1} ${0:Int}
|
||||
snippet data
|
||||
data ${1:Type} = ${2:$1} ${0:Int}
|
||||
snippet newtype
|
||||
newtype ${1:Type} = ${2:$1} ${0:Int}
|
||||
snippet class
|
||||
class ${1:Class} a where
|
||||
${0}
|
||||
snippet module
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
|
||||
) where
|
||||
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
|
||||
|
||||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`
|
||||
( ${1}
|
||||
) where
|
||||
|
||||
`expand('%') =~ 'Main' ? "\nmain :: IO ()\nmain = undefined" : ""`
|
||||
snippet main
|
||||
main :: IO ()
|
||||
main = ${0:undefined}
|
||||
snippet const
|
||||
${1:name} :: ${2:a}
|
||||
$1 = ${0:undefined}
|
||||
snippet fn
|
||||
${1:fn} :: ${2:a} -> ${3:a}
|
||||
$1 ${4} = ${0:undefined}
|
||||
snippet fn0
|
||||
${1:fn} :: ${2:a}
|
||||
$1 = ${0:undefined}
|
||||
snippet fn1
|
||||
${1:fn} :: ${2:a} -> ${3:a}
|
||||
$1 ${4} = ${0:undefined}
|
||||
snippet fn2
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} = ${0:undefined}
|
||||
snippet fn3
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} = ${0:undefined}
|
||||
snippet => "Type constraint"
|
||||
(${1:Class} ${2:a}) => $2
|
||||
snippet ap
|
||||
${1:map} ${2:fn} ${0:list}
|
||||
snippet \
|
||||
\\${1:x} -> ${0:expression}
|
||||
snippet (\
|
||||
(\\${1:x} -> ${0:expression})
|
||||
snippet <-
|
||||
${1:a} <- ${0:m a}
|
||||
snippet ->
|
||||
${1:m a} -> ${0:a}
|
||||
snippet tup
|
||||
(${1:a}, ${0:b})
|
||||
snippet tup2
|
||||
(${1:a}, ${2:b}, ${0:c})
|
||||
snippet tup3
|
||||
(${1:a}, ${2:b}, ${3:c}, ${0:d})
|
||||
snippet rec
|
||||
${1:Record} { ${2:recFieldA} = ${3:undefined}
|
||||
, ${4:recFieldB} = ${0:undefined}
|
||||
}
|
||||
snippet case
|
||||
case ${1:something} of
|
||||
${2} -> ${0}
|
||||
snippet let
|
||||
let ${1} = ${2}
|
||||
in ${3}
|
||||
snippet where
|
||||
where
|
||||
${1:fn} = ${0:undefined}
|
||||
snippet spec
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where
|
||||
|
||||
import Test.Hspec
|
||||
import Test.QuickCheck
|
||||
|
||||
main :: IO ()
|
||||
main = hspec spec
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
describe "${1}" $ do
|
||||
it "${2}" $
|
||||
$0
|
||||
snippet specf
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (main, spec) where
|
||||
|
||||
import Test.Hspec
|
||||
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
|
||||
|
||||
main :: IO ()
|
||||
main = hspecWith defaultConfig {configFastFail = True} spec
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
describe "${1}" $ do
|
||||
it "${2}" $
|
||||
$0
|
||||
snippet desc
|
||||
describe "${1}" $ do
|
||||
$0
|
||||
snippet it
|
||||
it "${1}" $
|
||||
$0
|
||||
snippet itp
|
||||
it "${1}" $ property $
|
||||
$0
|
||||
snippet sb
|
||||
\`shouldBe\` $0
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
@ -1,591 +0,0 @@
|
||||
snippet service_sample_spec
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
{{- if .Values.$1.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.$1.service.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- if .Values.$1.service.labels }}
|
||||
{{ toYaml .Values.$1.service.labels | indent 4 }}
|
||||
{{- end }}
|
||||
app: {{ template "$2.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "$2.$1.fullname" . }}
|
||||
spec:
|
||||
clusterIP: "{{ .Values.$1.service.clusterIP }}"
|
||||
{{- if .Values.$1.service.externalIPs }}
|
||||
externalIPs:
|
||||
{{ toYaml .Values.$1.service.externalIPs | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.$1.service.loadBalancerIP }}
|
||||
loadBalancerIP: "{{ .Values.$1.service.loadBalancerIP }}"
|
||||
{{- end }}
|
||||
{{- if .Values.$1.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml .Values.$1.service.loadBalancerSourceRanges | indent 4 }}
|
||||
{{- end }}
|
||||
healthCheckNodePort: {{ .Values.$1.service.healthCheckNodePort }}
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.$1.service.targetPorts.http }}
|
||||
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.http))) }}
|
||||
nodePort: {{ .Values.$1.service.nodePorts.http }}
|
||||
{{- end }}
|
||||
- name: https
|
||||
port: 443
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.$1.service.targetPorts.https }}
|
||||
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.https))) }}
|
||||
nodePort: {{ .Values.$1.service.nodePorts.https }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.tcp }}
|
||||
- name: "{{ $key }}-tcp"
|
||||
port: {{ $key }}
|
||||
protocol: TCP
|
||||
targetPort: "{{ $key }}-tcp"
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.udp }}
|
||||
- name: "{{ $key }}-udp"
|
||||
port: {{ $key }}
|
||||
protocol: UDP
|
||||
targetPort: "{{ $key }}-udp"
|
||||
{{- end }}
|
||||
selector:
|
||||
app: {{ template "${2:chartName}.name" . }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
type: "{{ .Values.${1:value_key}.service.type }}"
|
||||
|
||||
snippet service_spec
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
{{- if .Values.$1.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.$1.service.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- if .Values.$1.service.labels }}
|
||||
{{ toYaml .Values.$1.service.labels | indent 4 }}
|
||||
{{- end }}
|
||||
app: {{ template "$2.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "${2:chartName}.${1:value_key}.fullname" . }}
|
||||
# spec
|
||||
${0}
|
||||
|
||||
snippet annotations_spec
|
||||
{{- if .Values.$1.service.annotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.${1:value_key}.service.annotations | indent 4 }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet labels_spec
|
||||
labels:
|
||||
{{- if .Values.$1.service.labels }}
|
||||
{{ toYaml .Values.$1.service.labels | indent 4 }}
|
||||
{{- end }}
|
||||
app: {{ template "$2.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "${2:chartName}.${1:value_key}.fullname" . }}
|
||||
${0}
|
||||
|
||||
snippet service_spec
|
||||
spec:
|
||||
type: "{{ .Values.$1.service.type }}"
|
||||
clusterIP: "{{ .Values.$1.service.clusterIP }}"
|
||||
{{- if .Values.$1.service.externalIPs }}
|
||||
externalIPs:
|
||||
{{ toYaml .Values.$1.service.externalIPs | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if .Values.$1.service.loadBalancerIP }}
|
||||
loadBalancerIP: "{{ .Values.$1.service.loadBalancerIP }}"
|
||||
{{- end }}
|
||||
{{- if .Values.$1.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ toYaml .Values.$1.service.loadBalancerSourceRanges | indent 4 }}
|
||||
{{- end }}
|
||||
{{- if and (semverCompare ">=1.7-0" .Capabilities.KubeVersion.GitVersion) (.Values.$1.service.externalTrafficPolicy) }}
|
||||
externalTrafficPolicy: "{{ .Values.$1.service.externalTrafficPolicy }}"
|
||||
{{- end }}
|
||||
{{- if and (semverCompare ">=1.7-0" .Capabilities.KubeVersion.GitVersion) (.Values.$1.service.healthCheckNodePort) }}
|
||||
healthCheckNodePort: {{ .Values.${1:value_key}.service.healthCheckNodePort }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet ports_spec
|
||||
ports:
|
||||
${0}
|
||||
|
||||
snippet portHTTP_spec
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.$1.service.targetPorts.http }}
|
||||
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.http))) }}
|
||||
nodePort: {{ .Values.${1:value_key}.service.nodePorts.http }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet portHTTPS_spec
|
||||
- name: https
|
||||
port: 443
|
||||
protocol: TCP
|
||||
targetPort: {{ .Values.$1.service.targetPorts.https }}
|
||||
{{- if (and (eq .Values.$1.service.type "NodePort") (not (empty .Values.$1.service.nodePorts.https))) }}
|
||||
nodePort: {{ .Values.${1:value_key}.service.nodePorts.https }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet portTCP_spec
|
||||
{{- range $key, $value := .Values.tcp }}
|
||||
- name: "{{ $key }}-tcp"
|
||||
port: {{ $key }}
|
||||
protocol: TCP
|
||||
targetPort: "{{ $key }}-tcp"
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet portUDP_spec
|
||||
{{- range $key, $value := .Values.udp }}
|
||||
- name: "{{ $key }}-udp"
|
||||
port: {{ $key }}
|
||||
protocol: UDP
|
||||
targetPort: "{{ $key }}-udp"
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
|
||||
snippet selector_spec
|
||||
selector:
|
||||
app: {{ template "${2:chartName}.name" . }}
|
||||
component: "{{ .Values.${1:value_key}.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
${0}
|
||||
|
||||
|
||||
snippet deploy_sample_spec
|
||||
{{- if .Values.$1.enabled }}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "$2.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "$2.$1.fullname" . }}
|
||||
spec:
|
||||
replicas: {{ .Values.$1.replicaCount }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
template:
|
||||
metadata:
|
||||
{{- if .Values.$1.podAnnotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.$1.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "$2.name" . }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
{{- if .Values.$1.podLabels }}
|
||||
{{ toYaml .Values.$1.podLabels | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.imagePullSecrets | indent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ template "${2:chartName}.name" . }}-{{ .Values.$1.name }}
|
||||
image: "{{ .Values.$1.image.repository }}:{{ .Values.$1.image.tag }}"
|
||||
imagePullPolicy: "{{ .Values.$1.image.pullPolicy }}"
|
||||
args:
|
||||
{{- range $key, $value := .Values.$1.extraArgs }}
|
||||
{{- if $value }}
|
||||
- --{{ $key }}={{ $value }}
|
||||
{{- else }}
|
||||
- --{{ $key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 5
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
resources:
|
||||
{{ toYaml .Values.$1.resources | indent 12 }}
|
||||
{{- if .Values.$1.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.$1.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.$1.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.$1.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.$1.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.${1:value_key}.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: 60
|
||||
{{- end }}
|
||||
|
||||
|
||||
|
||||
snippet deploy_spec
|
||||
{{- if .Values.$1.enabled }}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "$2.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
name: {{ template "${2:chartName}.${1:value_key}.fullname" . }}
|
||||
# spec
|
||||
# containers_spec
|
||||
# livenessProbe_spec
|
||||
# PersistentVolumeClaim_spec
|
||||
# initContainers_spec
|
||||
# resources_spec
|
||||
# nodeselector_spec
|
||||
# tolerations_spec
|
||||
# affinity_spec
|
||||
${0}
|
||||
|
||||
snippet spec_spec
|
||||
spec:
|
||||
replicas: {{ .Values.$1.replicaCount }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
template:
|
||||
metadata:
|
||||
{{- if .Values.$1.podAnnotations }}
|
||||
annotations:
|
||||
{{ toYaml .Values.$1.podAnnotations | indent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app: {{ template "${2:chartName}.name" . }}
|
||||
component: "{{ .Values.$1.name }}"
|
||||
release: {{ .Release.Name }}
|
||||
{{- if .Values.$1.podLabels }}
|
||||
{{ toYaml .Values.${1:value_key}.podLabels | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.imagePullSecrets | indent 8 }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet imagePullSecrets_spec
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.imagePullSecrets | indent 8 }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet imagePullPolicy_spec
|
||||
imagePullPolicy: ${1:imagePullPolicy}
|
||||
${0}
|
||||
|
||||
snippet containers_spec
|
||||
containers:
|
||||
- name: {{ template "${2:chartName}.name" . }}-{{ .Values.$1.name }}
|
||||
image: "{{ .Values.$1.image.repository }}:{{ .Values.$1.image.tag }}"
|
||||
imagePullPolicy: "{{ .Values.${1:value_key}.image.pullPolicy }}"
|
||||
${0}
|
||||
snippet args_spec
|
||||
args:
|
||||
{{- range $key, $value := .Values.${1:value_key}.extraArgs }}
|
||||
{{- if $value }}
|
||||
- --{{ $key }}={{ $value }}
|
||||
{{- else }}
|
||||
- --{{ $key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
${0}
|
||||
snippet livenessProbe_spec
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 5
|
||||
${0}
|
||||
snippet readinessProbe_spec
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /go/api/v1/health
|
||||
port: 8153
|
||||
initialDelaySeconds: {{ .Values.$1.healthCheck.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.$1.healthCheck.periodSeconds }}
|
||||
failureThreshold: {{ .Values.$1.healthCheck.failureThreshold }}
|
||||
${0}
|
||||
snippet resources_spec
|
||||
resources:
|
||||
{{ toYaml .Values.${1:value_key}.resources | indent 12 }}
|
||||
${0}
|
||||
snippet nodeselector_spec
|
||||
{{- if .Values.$1.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.${1:value_key}.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
${0}
|
||||
snippet tolerations_spec
|
||||
{{- if .Values.$1.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml .Values.${1:value_key}.tolerations | indent 8 }}
|
||||
{{- end }}
|
||||
${0}
|
||||
snippet affinity_spec
|
||||
{{- if .Values.$1.affinity }}
|
||||
affinity:
|
||||
{{ toYaml .Values.${1:value_key}.affinity | indent 8 }}
|
||||
{{- end }}
|
||||
terminationGracePeriodSeconds: 60
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet PersistentVolumeClaim_spec
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "${2}.$1.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "${2:chartName}.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.$1.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.$1.persistence.size | quote }}
|
||||
{{- if .Values.$1.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.$1.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.${1:value_key}.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet configMap_spec
|
||||
{{- if .Values.artifactory.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "${2:chartName}.fullname" . }}-${1:value_key}-config
|
||||
labels:
|
||||
app: {{ template "${2}.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
${3:nameOfConfigFile}.conf: |
|
||||
# data goes here
|
||||
{{- end -}}
|
||||
${0}
|
||||
|
||||
snippet initContainers_spec
|
||||
{{- if .Values.$1.initContainers }}
|
||||
initContainers:
|
||||
- name: wait-workers
|
||||
image: "{{ .Values.$1.image.repository }}:{{ .Values.$1.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.${1:value_key}.image.pullPolicy }}
|
||||
# env
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
until printf "." && nc -z -w 2 {{ template "${2:chartName}.fullname" . }} {{ .Values.postgresql.service.port }}; do
|
||||
sleep 2;
|
||||
done;
|
||||
|
||||
echo 'PostgreSQL OK ✓'
|
||||
# args
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet pvc_spec
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "$2.fullname" . }}
|
||||
labels:
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
app: {{ template "${2:chartName}.fullname" . }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
${0}
|
||||
|
||||
snippet pv_nfs_spec
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ template "$2.fullname" . }}-data-pv
|
||||
labels:
|
||||
app: {{ template "$2.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
id: {{ template "${2:chartName}.name" . }}-data-pv
|
||||
type: nfs-volume
|
||||
spec:
|
||||
capacity:
|
||||
storage: {{ .Values.$1.persistence.nfs.capacity }}
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
nfs:
|
||||
server: {{ .Values.$1.persistence.nfs.ip }}
|
||||
path: "{{ .Values.${1:value_key}.persistence.nfs.haDataMount }}"
|
||||
readOnly: false
|
||||
${0}
|
||||
|
||||
snippet pvc_hostpath_spec
|
||||
{{- if and .Values.persistence.enabled .Values.persistence.$1.hostPath (not
|
||||
.Values.persistence.$1.existingClaim) -}}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ template "${2:chartName}.fullname" . }}-$1
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.$1.accessMode | quote }}
|
||||
capacity:
|
||||
storage: {{ .Values.persistence.$1.size | quote }}
|
||||
hostPath:
|
||||
path: {{ .Values.persistence.${1:value_key}.hostPath | quote }}
|
||||
{{- end -}}
|
||||
${0}
|
||||
|
||||
snippet deploy_values
|
||||
$1:
|
||||
name: ${1:value_key}
|
||||
image:
|
||||
repository:
|
||||
tag:
|
||||
pullPolicy: IfNotPresent
|
||||
hostNetwork: false
|
||||
dnsPolicy: ClusterFirst
|
||||
daemonset:
|
||||
useHostPort: false
|
||||
podLabels: {}
|
||||
scope:
|
||||
enabled: false
|
||||
namespace: "" # defaults to .Release.Namespace
|
||||
extraArgs: {}
|
||||
extraEnvs: []
|
||||
kind: Deployment
|
||||
updateStrategy: {}
|
||||
minReadySeconds: 0
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
nodeSelector: {}
|
||||
podAnnotations: {}
|
||||
replicaCount: 1
|
||||
minAvailable: 1
|
||||
resources: {}
|
||||
autoscaling:
|
||||
enabled: false
|
||||
extraContainers: {}
|
||||
extraVolumeMounts: {}
|
||||
extraVolumes: {}
|
||||
extraInitContainers: []
|
||||
lifecycle: {}
|
||||
revisionHistoryLimit: 10
|
||||
${0}
|
||||
|
||||
snippet rbac_values
|
||||
${1:value_key}:
|
||||
rbac:
|
||||
create: true
|
||||
serviceAccount:
|
||||
create: true
|
||||
name:
|
||||
imagePullSecrets: []
|
||||
${0}
|
||||
|
||||
snippet service_values
|
||||
${1:value_key}:
|
||||
service:
|
||||
annotations: {}
|
||||
labels: {}
|
||||
clusterIP: ""
|
||||
externalIPs: []
|
||||
loadBalancerIP: ""
|
||||
loadBalancerSourceRanges: []
|
||||
externalTrafficPolicy: ""
|
||||
healthCheckNodePort: 0
|
||||
targetPorts:
|
||||
http: http
|
||||
https: https
|
||||
type: LoadBalancer
|
||||
nodePorts:
|
||||
http: ""
|
||||
https: ""
|
||||
${0}
|
||||
|
||||
snippet readinessProbe_values
|
||||
${1:value_key}:
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
port: 10254
|
||||
${0}
|
||||
|
||||
snippet livenessProbe_values
|
||||
${1:value_key}:
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
port: 10254
|
||||
${0}
|
@ -1,858 +0,0 @@
|
||||
# Some useful Unicode entities
|
||||
# Non-Breaking Space
|
||||
snippet nbs
|
||||
|
||||
# ←
|
||||
snippet left
|
||||
←
|
||||
# →
|
||||
snippet right
|
||||
→
|
||||
# ↑
|
||||
snippet up
|
||||
↑
|
||||
# ↓
|
||||
snippet down
|
||||
↓
|
||||
# ↩
|
||||
snippet return
|
||||
↩
|
||||
# ⇤
|
||||
snippet backtab
|
||||
⇤
|
||||
# ⇥
|
||||
snippet tab
|
||||
⇥
|
||||
# ⇧
|
||||
snippet shift
|
||||
⇧
|
||||
# ⌃
|
||||
snippet ctrl
|
||||
⌃
|
||||
# ⌅
|
||||
snippet enter
|
||||
⌅
|
||||
# ⌘
|
||||
snippet cmd
|
||||
⌘
|
||||
# ⌥
|
||||
snippet option
|
||||
⌥
|
||||
# ⌦
|
||||
snippet delete
|
||||
⌦
|
||||
# ⌫
|
||||
snippet backspace
|
||||
⌫
|
||||
# ⎋
|
||||
snippet esc
|
||||
⎋
|
||||
# comment
|
||||
snippet //
|
||||
<!-- ${1} -->${0}
|
||||
# HTML Doctype 4.01 Strict
|
||||
snippet docts
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
# HTML Doctype 4.01 Transitional
|
||||
snippet doct
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
# HTML Doctype 5
|
||||
snippet doct5
|
||||
<!DOCTYPE HTML>
|
||||
# XHTML Doctype 1.0 Frameset
|
||||
snippet docxf
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
||||
# XHTML Doctype 1.0 Strict
|
||||
snippet docxs
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
# XHTML Doctype 1.0 Transitional
|
||||
snippet docxt
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
# XHTML Doctype 1.1
|
||||
snippet docx
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
# Attributes
|
||||
snippet attr
|
||||
${1:attribute}="${0:property}"
|
||||
snippet attr+
|
||||
${1:attribute}="${2:property}" attr+
|
||||
snippet .
|
||||
class="${1}"
|
||||
snippet #
|
||||
id="${1}"
|
||||
snippet alt
|
||||
alt="${1}"
|
||||
snippet charset
|
||||
charset="${1:utf-8}"
|
||||
snippet data
|
||||
data-${1}="${2:$1}"
|
||||
snippet for
|
||||
for="${1}"
|
||||
snippet height
|
||||
height="${1}"
|
||||
snippet href
|
||||
href="${1:#}"
|
||||
snippet lang
|
||||
lang="${1:en}"
|
||||
snippet media
|
||||
media="${1}"
|
||||
snippet name
|
||||
name="${1}"
|
||||
snippet rel
|
||||
rel="${1}"
|
||||
snippet scope
|
||||
scope="${1:row}"
|
||||
snippet src
|
||||
src="${1}"
|
||||
snippet title=
|
||||
title="${1}"
|
||||
snippet type
|
||||
type="${1}"
|
||||
snippet value
|
||||
value="${1}"
|
||||
snippet width
|
||||
width="${1}"
|
||||
# Elements
|
||||
snippet a
|
||||
<a href="${1:#}">${0:$1}</a>
|
||||
snippet a.
|
||||
<a class="${1}" href="${2:#}">${0:$1}</a>
|
||||
snippet a#
|
||||
<a id="${1}" href="${2:#}">${0:$1}</a>
|
||||
snippet a:ext
|
||||
<a href="http://${1:example.com}">${0:$1}</a>
|
||||
snippet a:mail
|
||||
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${0:email me}</a>
|
||||
snippet ac
|
||||
<a href="`@+`">${0:`@+`}</a>
|
||||
snippet abbr
|
||||
<abbr title="${1}">${0}</abbr>
|
||||
snippet address
|
||||
<address>
|
||||
${0}
|
||||
</address>
|
||||
snippet area
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}">
|
||||
snippet area+
|
||||
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}">
|
||||
area+
|
||||
snippet area:c
|
||||
<area shape="circle" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet area:d
|
||||
<area shape="default" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet area:p
|
||||
<area shape="poly" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet area:r
|
||||
<area shape="rect" coords="${1}" href="${2}" alt="${0}">
|
||||
snippet article
|
||||
<article>
|
||||
${0}
|
||||
</article>
|
||||
snippet article.
|
||||
<article class="${1}">
|
||||
${0}
|
||||
</article>
|
||||
snippet article#
|
||||
<article id="${1}">
|
||||
${0}
|
||||
</article>
|
||||
snippet aside
|
||||
<aside>
|
||||
${0}
|
||||
</aside>
|
||||
snippet aside.
|
||||
<aside class="${1}">
|
||||
${0}
|
||||
</aside>
|
||||
snippet aside#
|
||||
<aside id="${1}">
|
||||
${0}
|
||||
</aside>
|
||||
snippet audio
|
||||
<audio src="${1}">${0}</audio>
|
||||
snippet b
|
||||
<b>${0}</b>
|
||||
snippet base
|
||||
<base href="${1}" target="${0}">
|
||||
snippet bdi
|
||||
<bdi>${0}</bdo>
|
||||
snippet bdo
|
||||
<bdo dir="${1}">${0}</bdo>
|
||||
snippet bdo:l
|
||||
<bdo dir="ltr">${0}</bdo>
|
||||
snippet bdo:r
|
||||
<bdo dir="rtl">${0}</bdo>
|
||||
snippet blockquote
|
||||
<blockquote>
|
||||
${0}
|
||||
</blockquote>
|
||||
snippet body
|
||||
<body>
|
||||
${0}
|
||||
</body>
|
||||
snippet br
|
||||
<br>
|
||||
snippet button
|
||||
<button type="${1:submit}">${0}</button>
|
||||
snippet button.
|
||||
<button class="${1:button}" type="${2:submit}">${0}</button>
|
||||
snippet button#
|
||||
<button id="${1}" type="${2:submit}">${0}</button>
|
||||
snippet button:s
|
||||
<button type="submit">${0}</button>
|
||||
snippet button:r
|
||||
<button type="reset">${0}</button>
|
||||
snippet canvas
|
||||
<canvas>
|
||||
${0}
|
||||
</canvas>
|
||||
snippet caption
|
||||
<caption>${0}</caption>
|
||||
snippet cite
|
||||
<cite>${0}</cite>
|
||||
snippet code
|
||||
<code>${0}</code>
|
||||
snippet col
|
||||
<col>
|
||||
snippet colgroup
|
||||
<colgroup>
|
||||
${0}
|
||||
</colgroup>
|
||||
snippet colgroup+
|
||||
<colgroup>
|
||||
<col>
|
||||
col+${0}
|
||||
</colgroup>
|
||||
snippet command
|
||||
<command type="command" label="${1}" icon="${0}">
|
||||
snippet command:c
|
||||
<command type="checkbox" label="${1}" icon="${0}">
|
||||
snippet command:r
|
||||
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}">
|
||||
snippet datagrid
|
||||
<datagrid>
|
||||
${0}
|
||||
</datagrid>
|
||||
snippet datalist
|
||||
<datalist>
|
||||
${0}
|
||||
</datalist>
|
||||
snippet datatemplate
|
||||
<datatemplate>
|
||||
${0}
|
||||
</datatemplate>
|
||||
snippet dd
|
||||
<dd>${0}</dd>
|
||||
snippet dd.
|
||||
<dd class="${1}">${0}</dd>
|
||||
snippet dd#
|
||||
<dd id="${1}">${0}</dd>
|
||||
snippet del
|
||||
<del>${0}</del>
|
||||
snippet details
|
||||
<details>${0}</details>
|
||||
snippet dfn
|
||||
<dfn>${0}</dfn>
|
||||
snippet dialog
|
||||
<dialog>
|
||||
${0}
|
||||
</dialog>
|
||||
snippet div
|
||||
<div>
|
||||
${0}
|
||||
</div>
|
||||
snippet div.
|
||||
<div class="${1}">
|
||||
${0}
|
||||
</div>
|
||||
snippet div#
|
||||
<div id="${1}">
|
||||
${0}
|
||||
</div>
|
||||
snippet dl
|
||||
<dl>
|
||||
${0}
|
||||
</dl>
|
||||
snippet dl.
|
||||
<dl class="${1}">
|
||||
${0}
|
||||
</dl>
|
||||
snippet dl#
|
||||
<dl id="${1}">
|
||||
${0}
|
||||
</dl>
|
||||
snippet dl+
|
||||
<dl>
|
||||
<dt>${1}</dt>
|
||||
<dd>${2}</dd>
|
||||
dt+${0}
|
||||
</dl>
|
||||
snippet dt
|
||||
<dt>${0}</dt>
|
||||
snippet dt.
|
||||
<dt class="${1}">${0}</dt>
|
||||
snippet dt#
|
||||
<dt id="${1}">${0}</dt>
|
||||
snippet dt+
|
||||
<dt>${1}</dt>
|
||||
<dd>${2}</dd>
|
||||
dt+${0}
|
||||
snippet em
|
||||
<em>${0}</em>
|
||||
snippet embed
|
||||
<embed src="${1}" type="${0}">
|
||||
snippet fieldset
|
||||
<fieldset>
|
||||
${0}
|
||||
</fieldset>
|
||||
snippet fieldset.
|
||||
<fieldset class="${1}">
|
||||
${0}
|
||||
</fieldset>
|
||||
snippet fieldset#
|
||||
<fieldset id="${1}">
|
||||
${0}
|
||||
</fieldset>
|
||||
snippet fieldset+
|
||||
<fieldset>
|
||||
<legend><span>${1}</span></legend>
|
||||
${2}
|
||||
</fieldset>
|
||||
fieldset+${0}
|
||||
snippet figcaption
|
||||
<figcaption>${0}</figcaption>
|
||||
snippet figure
|
||||
<figure>${0}</figure>
|
||||
snippet figure#
|
||||
<figure id="${1}">
|
||||
${0}
|
||||
</figure>
|
||||
snippet figure.
|
||||
<figure class="${1}">
|
||||
${0}
|
||||
</figure>
|
||||
snippet footer
|
||||
<footer>
|
||||
${0}
|
||||
</footer>
|
||||
snippet footer.
|
||||
<footer class="${1}">
|
||||
${0}
|
||||
</footer>
|
||||
snippet footer#
|
||||
<footer id="${1}">
|
||||
${0}
|
||||
</footer>
|
||||
snippet form
|
||||
<form action="${1}" method="${2:post}">
|
||||
${0}
|
||||
</form>
|
||||
snippet form.
|
||||
<form class="${1}" action="${2}" method="${3:post}">
|
||||
${0}
|
||||
</form>
|
||||
snippet form#
|
||||
<form id="${1}" action="${2}" method="${3:post}">
|
||||
${0}
|
||||
</form>
|
||||
snippet h1
|
||||
<h1>${0}</h1>
|
||||
snippet h1.
|
||||
<h1 class="${1}">${0}</h1>
|
||||
snippet h1#
|
||||
<h1 id="${1}">${0}</h1>
|
||||
snippet h2
|
||||
<h2>${0}</h2>
|
||||
snippet h2.
|
||||
<h2 class="${1}">${0}</h2>
|
||||
snippet h2#
|
||||
<h2 id="${1}">${0}</h2>
|
||||
snippet h3
|
||||
<h3>${0}</h3>
|
||||
snippet h3.
|
||||
<h3 class="${1}">${0}</h3>
|
||||
snippet h3#
|
||||
<h3 id="${1}">${0}</h3>
|
||||
snippet h4
|
||||
<h4>${0}</h4>
|
||||
snippet h4.
|
||||
<h4 class="${1}">${0}</h4>
|
||||
snippet h4#
|
||||
<h4 id="${1}">${0}</h4>
|
||||
snippet h5
|
||||
<h5>${0}</h5>
|
||||
snippet h5.
|
||||
<h5 class="${1}">${0}</h5>
|
||||
snippet h5#
|
||||
<h5 id="${1}">${0}</h5>
|
||||
snippet h6
|
||||
<h6>${0}</h6>
|
||||
snippet h6.
|
||||
<h6 class="${1}">${0}</h6>
|
||||
snippet h6#
|
||||
<h6 id="${1}">${0}</h6>
|
||||
snippet head
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${0}
|
||||
</head>
|
||||
snippet header
|
||||
<header>
|
||||
${0}
|
||||
</header>
|
||||
snippet header.
|
||||
<header class="${1}">
|
||||
${0}
|
||||
</header>
|
||||
snippet header#
|
||||
<header id="${1}">
|
||||
${0}
|
||||
</header>
|
||||
snippet hgroup
|
||||
<hgroup>
|
||||
${0}
|
||||
</hgroup>
|
||||
snippet hgroup.
|
||||
<hgroup class="${1}>
|
||||
${0}
|
||||
</hgroup>
|
||||
snippet hr
|
||||
<hr>
|
||||
snippet html
|
||||
<html>
|
||||
${0}
|
||||
</html>
|
||||
snippet xhtml
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
${0}
|
||||
</html>
|
||||
snippet html5
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
</head>
|
||||
<body>
|
||||
$0
|
||||
</body>
|
||||
</html>
|
||||
snippet html5l
|
||||
<!DOCTYPE html>
|
||||
<html lang="${1:en}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
${3:link}
|
||||
</head>
|
||||
<body>
|
||||
$0
|
||||
</body>
|
||||
</html>
|
||||
snippet i
|
||||
<i>${0}</i>
|
||||
snippet iframe
|
||||
<iframe src="${1}" frameborder="0"></iframe>
|
||||
snippet iframe.
|
||||
<iframe class="${1}" src="${2}" frameborder="0"></iframe>
|
||||
snippet iframe#
|
||||
<iframe id="${1}" src="${2}" frameborder="0"></iframe>
|
||||
snippet img
|
||||
<img src="${1}" alt="${2}">
|
||||
snippet img.
|
||||
<img class="${1}" src="${2}" alt="${3}">
|
||||
snippet img#
|
||||
<img id="${1}" src="${2}" alt="${3}">
|
||||
snippet input
|
||||
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}">
|
||||
snippet input.
|
||||
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}">
|
||||
snippet input:text
|
||||
<input type="text" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:submit
|
||||
<input type="submit" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:hidden
|
||||
<input type="hidden" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:button
|
||||
<input type="button" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:image
|
||||
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}">
|
||||
snippet input:checkbox
|
||||
<input type="checkbox" name="${1}" id="${2:$1}">
|
||||
snippet input:radio
|
||||
<input type="radio" name="${1}" id="${2:$1}">
|
||||
snippet input:color
|
||||
<input type="color" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:date
|
||||
<input type="date" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:datetime
|
||||
<input type="datetime" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:datetime-local
|
||||
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:email
|
||||
<input type="email" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:file
|
||||
<input type="file" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:month
|
||||
<input type="month" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:number
|
||||
<input type="number" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:password
|
||||
<input type="password" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:range
|
||||
<input type="range" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:reset
|
||||
<input type="reset" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:search
|
||||
<input type="search" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:time
|
||||
<input type="time" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:url
|
||||
<input type="url" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet input:week
|
||||
<input type="week" name="${1}" id="${2:$1}" value="${3}">
|
||||
snippet ins
|
||||
<ins>${0}</ins>
|
||||
snippet kbd
|
||||
<kbd>${0}</kbd>
|
||||
snippet label
|
||||
<label for="${0:$1}">${1}</label>
|
||||
snippet label:i
|
||||
<label for="${2:$1}">${1}</label>
|
||||
<input type="${3:text/submit/hidden/button}" name="${4:$2}" id="${5:$2}" value="${6}" />
|
||||
snippet label:s
|
||||
<label for="${2:$1}">${1}</label>
|
||||
<select name="${3:$2}" id="${4:$2}">
|
||||
<option value="${5}">${0:$5}</option>
|
||||
</select>
|
||||
snippet legend
|
||||
<legend>${0}</legend>
|
||||
snippet legend+
|
||||
<legend><span>${0}</span></legend>
|
||||
snippet li
|
||||
<li>${0}</li>
|
||||
snippet li.
|
||||
<li class="${1}">${0}</li>
|
||||
snippet li+
|
||||
<li>${1}</li>
|
||||
li+
|
||||
snippet lia
|
||||
<li><a href="${0:#}">${1}</a></li>
|
||||
snippet lia+
|
||||
<li><a href="${2:#}">${1}</a></li>
|
||||
lia+
|
||||
snippet link
|
||||
<link rel="${1}" href="${2}" title="${3}" type="${4}">
|
||||
snippet link:atom
|
||||
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml">
|
||||
snippet link:s
|
||||
<link rel="stylesheet" href="${1:style.css}">
|
||||
snippet link:css
|
||||
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
|
||||
snippet link:favicon
|
||||
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon">
|
||||
snippet link:rss
|
||||
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml">
|
||||
snippet link:touch
|
||||
<link rel="apple-touch-icon" href="${1:favicon.png}">
|
||||
snippet main
|
||||
<main role="main">
|
||||
${0}
|
||||
</main>
|
||||
snippet map
|
||||
<map name="${1}">
|
||||
${0}
|
||||
</map>
|
||||
snippet map.
|
||||
<map class="${1}" name="${2}">
|
||||
${0}
|
||||
</map>
|
||||
snippet map#
|
||||
<map name="${1}" id="${2:$1}>
|
||||
${0}
|
||||
</map>
|
||||
snippet map+
|
||||
<map name="${1}">
|
||||
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
|
||||
</map>
|
||||
snippet mark
|
||||
<mark>${0}</mark>
|
||||
snippet menu
|
||||
<menu>
|
||||
${0}
|
||||
</menu>
|
||||
snippet menu:c
|
||||
<menu type="context">
|
||||
${0}
|
||||
</menu>
|
||||
snippet menu:t
|
||||
<menu type="toolbar">
|
||||
${0}
|
||||
</menu>
|
||||
snippet meta
|
||||
<meta http-equiv="${1}" content="${2}">
|
||||
snippet meta:s
|
||||
<meta ${0}>
|
||||
snippet meta:d
|
||||
<meta name="description" content="${0}">
|
||||
snippet meta:compat
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}">
|
||||
snippet meta:refresh
|
||||
<meta http-equiv="refresh" content="3;url=${0}">
|
||||
snippet meta:utf5
|
||||
<meta charset="utf-8">
|
||||
snippet meta:utf
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
|
||||
snippet meter
|
||||
<meter>${0}</meter>
|
||||
snippet nav
|
||||
<nav>
|
||||
${0}
|
||||
</nav>
|
||||
snippet nav.
|
||||
<nav class="${1}">
|
||||
${0}
|
||||
</nav>
|
||||
snippet nav#
|
||||
<nav id="${1}">
|
||||
${0}
|
||||
</nav>
|
||||
snippet noscript
|
||||
<noscript>
|
||||
${0}
|
||||
</noscript>
|
||||
snippet object
|
||||
<object data="${1}" type="${2}">
|
||||
${3}
|
||||
</object>
|
||||
# Embed QT Movie
|
||||
snippet movie
|
||||
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
|
||||
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
|
||||
<param name="src" value="$1">
|
||||
<param name="controller" value="$4">
|
||||
<param name="autoplay" value="$5">
|
||||
<embed src="${1:movie.mov}"
|
||||
width="${2:320}" height="${3:240}"
|
||||
controller="${4:true}" autoplay="${5:true}"
|
||||
scale="tofit" cache="true"
|
||||
pluginspage="http://www.apple.com/quicktime/download/">
|
||||
</object>
|
||||
snippet ol
|
||||
<ol>
|
||||
${0}
|
||||
</ol>
|
||||
snippet ol.
|
||||
<ol class="${1}">
|
||||
${0}
|
||||
</ol>
|
||||
snippet ol#
|
||||
<ol id="${1}">
|
||||
${0}
|
||||
</ol>
|
||||
snippet ol+
|
||||
<ol>
|
||||
<li>${1}</li>
|
||||
li+${0}
|
||||
</ol>
|
||||
snippet opt
|
||||
<option value="${1}">${0:$1}</option>
|
||||
snippet opt+
|
||||
<option value="${1}">${2:$1}</option>
|
||||
opt+${0}
|
||||
snippet optt
|
||||
<option>${0}</option>
|
||||
snippet optgroup
|
||||
<optgroup>
|
||||
<option value="${1}">${2:$1}</option>
|
||||
opt+${0}
|
||||
</optgroup>
|
||||
snippet output
|
||||
<output>${0}</output>
|
||||
snippet p
|
||||
<p>${0}</p>
|
||||
snippet p.
|
||||
<p class="${1}">${0}</p>
|
||||
snippet p#
|
||||
<p id="${1}">${0}</p>
|
||||
snippet param
|
||||
<param name="${1}" value="${2}">
|
||||
snippet pre
|
||||
<pre>
|
||||
${0}
|
||||
</pre>
|
||||
snippet progress
|
||||
<progress>${0}</progress>
|
||||
snippet q
|
||||
<q>${0}</q>
|
||||
snippet rp
|
||||
<rp>${0}</rp>
|
||||
snippet rt
|
||||
<rt>${0}</rt>
|
||||
snippet ruby
|
||||
<ruby>
|
||||
<rp><rt>${0}</rt></rp>
|
||||
</ruby>
|
||||
snippet s
|
||||
<s>${0}</s>
|
||||
snippet samp
|
||||
<samp>
|
||||
${0}
|
||||
</samp>
|
||||
snippet script
|
||||
<script>
|
||||
${0}
|
||||
</script>
|
||||
snippet scripts
|
||||
<script src="${0}.js"></script>
|
||||
snippet scriptt
|
||||
<script type="${1}" id="${2}">
|
||||
${0}
|
||||
</script>
|
||||
snippet scriptsrc
|
||||
<script src="${0}.js" charset="utf-8"></script>
|
||||
snippet section
|
||||
<section>
|
||||
${0}
|
||||
</section>
|
||||
snippet section.
|
||||
<section class="${1}">
|
||||
${0}
|
||||
</section>
|
||||
snippet section#
|
||||
<section id="${1}">
|
||||
${0}
|
||||
</section>
|
||||
snippet select
|
||||
<select name="${1}" id="${2:$1}">
|
||||
${0}
|
||||
</select>
|
||||
snippet select.
|
||||
<select name="${1}" id="${2:$1}" class="${3}>
|
||||
${0}
|
||||
</select>
|
||||
snippet select+
|
||||
<select name="${1}" id="${2:$1}">
|
||||
<option value="${3}">${4:$3}</option>
|
||||
opt+${0}
|
||||
</select>
|
||||
snippet small
|
||||
<small>${0}</small>
|
||||
snippet source
|
||||
<source src="${1}" type="${2}" media="${0}">
|
||||
snippet span
|
||||
<span>${0}</span>
|
||||
snippet span.
|
||||
<span class="${1}">${0}</span>
|
||||
snippet span#
|
||||
<span id="${1}">${0}</span>
|
||||
snippet strong
|
||||
<strong>${0}</strong>
|
||||
snippet style
|
||||
<style type="text/css" media="${1:all}">
|
||||
${0}
|
||||
</style>
|
||||
snippet sub
|
||||
<sub>${0}</sub>
|
||||
snippet summary
|
||||
<summary>
|
||||
${0}
|
||||
</summary>
|
||||
snippet sup
|
||||
<sup>${0}</sup>
|
||||
snippet table
|
||||
<table>
|
||||
${0}
|
||||
</table>
|
||||
snippet table.
|
||||
<table class="${1}">
|
||||
${0}
|
||||
</table>
|
||||
snippet table#
|
||||
<table id="${1}">
|
||||
${0}
|
||||
</table>
|
||||
snippet tbody
|
||||
<tbody>
|
||||
${0}
|
||||
</tbody>
|
||||
snippet td
|
||||
<td>${0}</td>
|
||||
snippet td.
|
||||
<td class="${1}">${0}</td>
|
||||
snippet td#
|
||||
<td id="${1}">${0}</td>
|
||||
snippet td+
|
||||
<td>${1}</td>
|
||||
td+${0}
|
||||
snippet textarea
|
||||
<textarea name="${1}" id="${2:$1}" rows="${3:8}" cols="${4:40}">${5}</textarea>
|
||||
snippet tfoot
|
||||
<tfoot>
|
||||
${0}
|
||||
</tfoot>
|
||||
snippet th
|
||||
<th>${0}</th>
|
||||
snippet th.
|
||||
<th class="${1}">${0}</th>
|
||||
snippet th#
|
||||
<th id="${1}">${0}</th>
|
||||
snippet th+
|
||||
<th>${1}</th>
|
||||
th+${0}
|
||||
snippet thead
|
||||
<thead>
|
||||
${0}
|
||||
</thead>
|
||||
snippet time
|
||||
<time datetime="${1}" pubdate="${2:$1}">${0:$1}</time>
|
||||
snippet title
|
||||
<title>${0:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
|
||||
snippet tr
|
||||
<tr>
|
||||
${0}
|
||||
</tr>
|
||||
snippet tr+
|
||||
<tr>
|
||||
<td>${1}</td>
|
||||
td+${0}
|
||||
</tr>
|
||||
snippet track
|
||||
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}
|
||||
snippet ul
|
||||
<ul>
|
||||
${0}
|
||||
</ul>
|
||||
snippet ul.
|
||||
<ul class="${1}">
|
||||
${0}
|
||||
</ul>
|
||||
snippet ul#
|
||||
<ul id="${1}">
|
||||
${0}
|
||||
</ul>
|
||||
snippet ul+
|
||||
<ul>
|
||||
<li>${1}</li>
|
||||
li+${0}
|
||||
</ul>
|
||||
snippet var
|
||||
<var>${0}</var>
|
||||
snippet video
|
||||
<video src="${1}" height="${2}" width="${3}" preload="${4:none}" autoplay="${5:autoplay}">${6}</video>
|
||||
snippet video.
|
||||
<video class="${1}" src="${2}" height="${3}" width="${4}" preload="${5:none}" autoplay="${6:autoplay}">${7}</video>
|
||||
snippet wbr
|
||||
<wbr>
|
||||
snippet viewport
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
@ -1,142 +0,0 @@
|
||||
# Generic tags
|
||||
|
||||
extends html
|
||||
|
||||
snippet %
|
||||
{% ${1} %}
|
||||
snippet %%
|
||||
{% ${1:tag_name} %}
|
||||
${0}
|
||||
{% end$1 %}
|
||||
snippet {
|
||||
{{ ${1} }}
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape
|
||||
{% autoescape ${1:off} %}
|
||||
${0}
|
||||
{% endautoescape %}
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${0}
|
||||
{% endblock %}
|
||||
snippet #
|
||||
{# ${0:comment} #}
|
||||
snippet comment
|
||||
{% comment %}
|
||||
${0}
|
||||
{% endcomment %}
|
||||
snippet cycle
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
snippet debug
|
||||
{% debug %}
|
||||
snippet extends
|
||||
{% extends "${0:base.html}" %}
|
||||
snippet filter
|
||||
{% filter ${1} %}
|
||||
${0}
|
||||
{% endfilter %}
|
||||
snippet firstof
|
||||
{% firstof ${1} %}
|
||||
snippet for
|
||||
{% for ${1} in ${2} %}
|
||||
${0}
|
||||
{% endfor %}
|
||||
snippet empty
|
||||
{% empty %}
|
||||
${0}
|
||||
snippet if
|
||||
{% if ${1} %}
|
||||
${0}
|
||||
{% endif %}
|
||||
snippet el
|
||||
{% else %}
|
||||
${1}
|
||||
snippet eif
|
||||
{% elif ${1} %}
|
||||
${0}
|
||||
snippet ifchanged
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
snippet ifequal
|
||||
{% ifequal ${1} ${2} %}
|
||||
${0}
|
||||
{% endifequal %}
|
||||
snippet ifnotequal
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${0}
|
||||
{% endifnotequal %}
|
||||
snippet include
|
||||
{% include "${0}" %}
|
||||
snippet load
|
||||
{% load ${0} %}
|
||||
snippet now
|
||||
{% now "${0:jS F Y H:i}" %}
|
||||
snippet regroup
|
||||
{% regroup ${1} by ${2} as ${0} %}
|
||||
snippet spaceless
|
||||
{% spaceless %}${0}{% endspaceless %}
|
||||
snippet ssi
|
||||
{% ssi ${0} %}
|
||||
snippet trans
|
||||
{% trans "${0:string}" %}
|
||||
snippet url
|
||||
{% url ${1} as ${0} %}
|
||||
snippet widthratio
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${0:100} %}
|
||||
snippet with
|
||||
{% with ${1} as ${2} %}
|
||||
${0}
|
||||
{% endwith %}
|
||||
|
||||
# Template Filters
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
|
||||
snippet add
|
||||
add:"${0}"
|
||||
snippet center
|
||||
center:"${0}"
|
||||
snippet cut
|
||||
cut:"${0}"
|
||||
snippet date
|
||||
date:"${0}"
|
||||
snippet default
|
||||
default:"${0}"
|
||||
snippet defaultifnone
|
||||
default_if_none:"${0}"
|
||||
snippet dictsort
|
||||
dictsort:"${0}"
|
||||
snippet dictsortrev
|
||||
dictsortreversed:"${0}"
|
||||
snippet divisibleby
|
||||
divisibleby:"${0}"
|
||||
snippet floatformat
|
||||
floatformat:"${0}"
|
||||
snippet getdigit
|
||||
get_digit:"${0}"
|
||||
snippet join
|
||||
join:"${0}"
|
||||
snippet lengthis
|
||||
length_is:"${0}"
|
||||
snippet pluralize
|
||||
pluralize:"${0}"
|
||||
snippet removetags
|
||||
removetags:"${0}"
|
||||
snippet slice
|
||||
slice:"${0}"
|
||||
snippet stringformat
|
||||
stringformat:"${0}"
|
||||
snippet time
|
||||
time:"${0}"
|
||||
snippet truncatewords
|
||||
truncatewords:${0}
|
||||
snippet truncatewordshtml
|
||||
truncatewords_html:${0}
|
||||
snippet urlizetrunc
|
||||
urlizetrunc:${0}
|
||||
snippet wordwrap
|
||||
wordwrap:${0}
|
@ -1,55 +0,0 @@
|
||||
# Generic tags
|
||||
|
||||
snippet {
|
||||
{{ ${0} }}
|
||||
|
||||
# Template tags
|
||||
|
||||
snippet extends
|
||||
{% extends "${0:base.html}" %}
|
||||
snippet autoescape
|
||||
{% autoescape ${0:xhtml_escape | None} %}
|
||||
snippet apply
|
||||
{% apply ${1:function} %}
|
||||
${0}
|
||||
{% end %}
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${0}
|
||||
{% end %}
|
||||
snippet for
|
||||
{% for ${1:item} in ${2} %}
|
||||
${0}
|
||||
{% end %}
|
||||
snippet from
|
||||
{% from ${1:x} import ${0:y} %}
|
||||
snippet if
|
||||
{% if $1 %}
|
||||
${0}
|
||||
{% end %}
|
||||
snippet eif
|
||||
{% elif $0 %}
|
||||
snippet el
|
||||
{% else %}
|
||||
snippet import
|
||||
{% import ${0:module} %}
|
||||
snippet include
|
||||
{% include "${0:filename}" %}
|
||||
snippet module
|
||||
{% module ${0:expression} %}
|
||||
snippet raw
|
||||
{% raw ${0:expression} %}
|
||||
snippet set
|
||||
{% set ${1:x} = ${0:y} %}
|
||||
snippet try
|
||||
{% try %}
|
||||
${1:${VISUAL}}
|
||||
{% except %}
|
||||
${2}
|
||||
{% finallly %}
|
||||
${0}
|
||||
{% end %}
|
||||
snippet wh
|
||||
{% while $1 %}
|
||||
${0}
|
||||
{% end %}
|
@ -1,46 +0,0 @@
|
||||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`
|
||||
${0}
|
||||
snippet imp
|
||||
import ${0:List}
|
||||
snippet fn
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn1
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn2
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} =
|
||||
${0}
|
||||
snippet fn3
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} =
|
||||
${0}
|
||||
snippet fn0
|
||||
${1:fn} : ${2:a}
|
||||
$1 =
|
||||
${0}
|
||||
snippet case
|
||||
case ${1} of
|
||||
${2} =>
|
||||
${0}
|
||||
snippet let
|
||||
let
|
||||
${1} =
|
||||
${2}
|
||||
in
|
||||
${0}
|
||||
snippet wh
|
||||
where
|
||||
${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
${0}
|
||||
snippet \ "Lambda function (\x => ...)"
|
||||
(\\${1:_} => ${0})
|
@ -1,18 +0,0 @@
|
||||
# Angular HTML
|
||||
snippet rep
|
||||
div(ng-repeat='${1} in ${2}')
|
||||
|
||||
snippet repf
|
||||
div(ng-repeat='${1} in ${2}' | ${3})
|
||||
|
||||
snippet repi
|
||||
div(ng-repeat='${1} in ${2}' track by $index)
|
||||
|
||||
snippet hide
|
||||
div(ng-hide='${1}')
|
||||
|
||||
snippet show
|
||||
div(ng-show='${1}')
|
||||
|
||||
snippet if
|
||||
div(ng-if='${1}')
|
@ -1,297 +0,0 @@
|
||||
## Access Modifiers
|
||||
snippet po
|
||||
protected ${0}
|
||||
snippet pu
|
||||
public ${0}
|
||||
snippet pr
|
||||
private ${0}
|
||||
##
|
||||
## Annotations
|
||||
snippet before
|
||||
@Before
|
||||
static void ${1:intercept}(${2:args}) { ${0} }
|
||||
snippet mm
|
||||
@ManyToMany
|
||||
${0}
|
||||
snippet mo
|
||||
@ManyToOne
|
||||
${0}
|
||||
snippet om
|
||||
@OneToMany${1:(cascade=CascadeType.ALL)}
|
||||
${0}
|
||||
snippet oo
|
||||
@OneToOne
|
||||
${1}
|
||||
##
|
||||
## Basic Java packages and import
|
||||
snippet im
|
||||
import ${0}
|
||||
snippet j.b
|
||||
java.beans.
|
||||
snippet j.i
|
||||
java.io.
|
||||
snippet j.m
|
||||
java.math.
|
||||
snippet j.n
|
||||
java.net.
|
||||
snippet j.u
|
||||
java.util.
|
||||
##
|
||||
## Class
|
||||
snippet cl
|
||||
class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
|
||||
snippet pcl
|
||||
public class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
|
||||
snippet in
|
||||
interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent}
|
||||
snippet tc
|
||||
public class ${1:`vim_snippets#Filename("$1")`} extends ${0:TestCase}
|
||||
##
|
||||
## Class Enhancements
|
||||
snippet ext
|
||||
extends ${0}
|
||||
snippet imp
|
||||
implements ${0}
|
||||
##
|
||||
## Comments
|
||||
snippet /*
|
||||
/*
|
||||
* ${0}
|
||||
*/
|
||||
##
|
||||
## Constants
|
||||
snippet co
|
||||
static public final ${1:String} ${2:var} = ${3};
|
||||
snippet cos
|
||||
static public final String ${1:var} = "${2}";
|
||||
##
|
||||
## Control Statements
|
||||
snippet case
|
||||
case ${1}:
|
||||
${0}
|
||||
snippet def
|
||||
default:
|
||||
${0}
|
||||
snippet el
|
||||
else
|
||||
snippet eif
|
||||
else if (${1}) ${0}
|
||||
snippet if
|
||||
if (${1}) ${0}
|
||||
snippet sw
|
||||
switch (${1}) {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Create a Method
|
||||
snippet m
|
||||
${1:void} ${2:method}(${3}) ${4:throws }
|
||||
##
|
||||
## Create a Variable
|
||||
snippet v
|
||||
${1:String} ${2:var}${3: = null}${4};
|
||||
##
|
||||
## Declaration for ArrayList
|
||||
snippet d.al
|
||||
List<${1:Object}> ${2:list} = new ArrayList<$1>();${0}
|
||||
## Declaration for HashMap
|
||||
snippet d.hm
|
||||
Map<${1:Object}, ${2:Object}> ${3:map} = new HashMap<$1, $2>();${0}
|
||||
## Declaration for HashSet
|
||||
snippet d.hs
|
||||
Set<${1:Object}> ${2:set} = new HashSet<$1>();${0}
|
||||
## Declaration for Stack
|
||||
snippet d.st
|
||||
Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0}
|
||||
##
|
||||
## Singleton Pattern
|
||||
snippet singlet
|
||||
private static class Holder {
|
||||
private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1();
|
||||
}
|
||||
|
||||
private $1() { }
|
||||
|
||||
public static $1 getInstance() {
|
||||
return Holder.INSTANCE;
|
||||
}
|
||||
##
|
||||
## Enhancements to Methods, variables, classes, etc.
|
||||
snippet ab
|
||||
abstract ${0}
|
||||
snippet fi
|
||||
final ${0}
|
||||
snippet st
|
||||
static ${0}
|
||||
snippet sy
|
||||
synchronized ${0}
|
||||
##
|
||||
## Error Methods
|
||||
snippet err
|
||||
System.err.print("${0:Message}");
|
||||
snippet errf
|
||||
System.err.printf("${1:Message}", ${0:exception});
|
||||
snippet errln
|
||||
System.err.println("${0:Message}");
|
||||
##
|
||||
## Exception Handling
|
||||
snippet as
|
||||
assert ${1:test} : "${2:Failure message}";
|
||||
snippet ae
|
||||
assertEquals("${1:Failure message}", ${2:expected}, ${3:actual});
|
||||
snippet aae
|
||||
assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals});
|
||||
snippet af
|
||||
assertFalse("${1:Failure message}", $2);
|
||||
snippet at
|
||||
assertTrue("${1:Failure message}", $2);
|
||||
snippet an
|
||||
assertNull("${1:Failure message}", ${2:object});
|
||||
snippet ann
|
||||
assertNotNull("${1:Failure message}", ${2:object});
|
||||
snippet ass
|
||||
assertSame("${1:Failure message}", ${2:expected}, ${3:actual});
|
||||
snippet asns
|
||||
assertNotSame("${1:Failure message}", ${2:expected}, ${3:actual});
|
||||
snippet fa
|
||||
fail("${1:Failure message}");
|
||||
snippet ca
|
||||
catch(${1:Exception} ${2:e}) ${0}
|
||||
snippet thr
|
||||
throw ${0}
|
||||
snippet ths
|
||||
throws ${0}
|
||||
snippet try
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
} finally {
|
||||
}
|
||||
##
|
||||
## Find Methods
|
||||
snippet findall
|
||||
List<${1:listName}> ${2:items} = $1.findAll();
|
||||
snippet findbyid
|
||||
${1:var} ${2:item} = $1.findById(${3});
|
||||
##
|
||||
## Javadocs
|
||||
snippet /**
|
||||
/**
|
||||
* ${0}
|
||||
*/
|
||||
snippet @au
|
||||
@author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")`
|
||||
snippet @br
|
||||
@brief ${0:Description}
|
||||
snippet @fi
|
||||
@file ${0:`vim_snippets#Filename("$1")`}.java
|
||||
snippet @pa
|
||||
@param ${0:param}
|
||||
snippet @re
|
||||
@return ${0:param}
|
||||
##
|
||||
## Logger Methods
|
||||
snippet debug
|
||||
Logger.debug(${1:param});
|
||||
snippet error
|
||||
Logger.error(${1:param});
|
||||
snippet info
|
||||
Logger.info(${1:param});
|
||||
snippet warn
|
||||
Logger.warn(${1:param});
|
||||
##
|
||||
## Loops
|
||||
snippet enfor
|
||||
for (${1} : ${2}) ${0}
|
||||
snippet for
|
||||
for (${1}; ${2}; ${3}) ${0}
|
||||
snippet wh
|
||||
while (${1:true}) ${0}
|
||||
snippet wht
|
||||
while (true) ${0}
|
||||
##
|
||||
## Main method
|
||||
snippet psvm
|
||||
public static void main (String[] args) {
|
||||
${0}
|
||||
}
|
||||
snippet main
|
||||
public static void main (String[] args) {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Print Methods
|
||||
snippet sout
|
||||
System.out.println(${0});
|
||||
snippet serr
|
||||
System.err.println(${0});
|
||||
snippet print
|
||||
System.out.print("${0:Message}");
|
||||
snippet printf
|
||||
System.out.printf("${1:Message}", ${0:args});
|
||||
snippet println
|
||||
System.out.println(${0});
|
||||
snippet printlna
|
||||
System.out.println(Arrays.toString(${0}));
|
||||
##
|
||||
## Render Methods
|
||||
snippet ren
|
||||
render(${1:param});
|
||||
snippet rena
|
||||
renderArgs.put("${1}", ${2});
|
||||
snippet renb
|
||||
renderBinary(${1:param});
|
||||
snippet renj
|
||||
renderJSON(${1:param});
|
||||
snippet renx
|
||||
renderXml(${1:param});
|
||||
##
|
||||
## Setter and Getter Methods
|
||||
snippet set
|
||||
${1:public} void set${3:}(${2:String} ${0:}){
|
||||
this.$4 = $4;
|
||||
}
|
||||
snippet get
|
||||
${1:public} ${2:String} get${3:}(){
|
||||
return this.${0:};
|
||||
}
|
||||
##
|
||||
## Terminate Methods or Loops
|
||||
snippet re
|
||||
return ${0}
|
||||
snippet br
|
||||
break;
|
||||
##
|
||||
## Test Methods
|
||||
snippet t
|
||||
public void test${1:Name}() throws Exception {
|
||||
${0}
|
||||
}
|
||||
snippet test
|
||||
@Test
|
||||
public void test${1:Name}() throws Exception {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Utils
|
||||
snippet Sc
|
||||
Scanner
|
||||
##
|
||||
## Miscellaneous
|
||||
snippet action
|
||||
public static void ${1:index}(${2:args}) { ${0} }
|
||||
snippet rnf
|
||||
notFound(${1:param});
|
||||
snippet rnfin
|
||||
notFoundIfNull(${1:param});
|
||||
snippet rr
|
||||
redirect(${1:param});
|
||||
snippet ru
|
||||
unauthorized(${1:param});
|
||||
snippet unless
|
||||
(unless=${1:param});
|
@ -1,52 +0,0 @@
|
||||
# Snippet for bemjson. https://en.bem.info/platform/bemjson/
|
||||
|
||||
# Blocks
|
||||
snippet b
|
||||
{
|
||||
block : '${1:name}',
|
||||
content : [
|
||||
'${2:content}'
|
||||
]
|
||||
}
|
||||
|
||||
# btc - BEM block with text content
|
||||
snippet btc
|
||||
{
|
||||
block : '${1:name}',
|
||||
content: '${2:content}'
|
||||
}
|
||||
|
||||
# bwm - BEM block with modifier.
|
||||
snippet bwm
|
||||
{
|
||||
block : '${1:name}',
|
||||
mods: { ${2:modName}: '${3:modVal}' },
|
||||
content : [
|
||||
'${4:content}'
|
||||
]
|
||||
}
|
||||
|
||||
# Elems
|
||||
|
||||
# e - BEM elem
|
||||
snippet e
|
||||
{
|
||||
elem : '${1:name}',
|
||||
content : [
|
||||
'${2:content}'
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# mo - Mods
|
||||
snippet mo
|
||||
mods : { ${1:modName} : '${2:modVal}' },
|
||||
|
||||
# mi - BEM mix mod
|
||||
snippet mi
|
||||
mix : [ { ${1:block} : '${2:block}' } ],
|
||||
|
||||
# a - BEM attrs mod
|
||||
snippet a
|
||||
attrs : { ${1:attr} : '${2:val}' },
|
||||
|
@ -1,30 +0,0 @@
|
||||
snippet .attr
|
||||
.attr("${1}", ${2})
|
||||
snippet .style
|
||||
.style("${1}", ${2})
|
||||
snippet axis
|
||||
d3.svg.axis()
|
||||
.orient(${1})
|
||||
.scale(${2})
|
||||
snippet fd
|
||||
function(d) { ${1} }
|
||||
snippet fdi
|
||||
function(d, i) { ${1} }
|
||||
snippet marginconvention
|
||||
var ${1:margin} = { top: ${2:10}, right: ${3:10}, bottom: ${4:10}, left: ${5:10} };
|
||||
var ${6:width} = ${7:970} - $1.left - $1.right;
|
||||
var ${8:height} = ${9:500} - $1.top - $1.bottom;
|
||||
|
||||
var ${10:svg} = d3.select("${11}").append("svg")
|
||||
.attr("width", $6 + $1.left + $1.right)
|
||||
.attr("height", $8 + $1.top + $1.bottom)
|
||||
.append("g")
|
||||
.attr("transform", "translate(" + $1.left + "," + $1.top + ")")
|
||||
snippet nest
|
||||
d3.nest()
|
||||
.key(${1})
|
||||
.entries(${2})
|
||||
snippet scale
|
||||
d3.scale.linear()
|
||||
.domain(${1})
|
||||
.range(${2})
|
@ -1,175 +0,0 @@
|
||||
snippet des "Describe (js)"
|
||||
describe('${1:description}', function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet it "it (js)"
|
||||
it('${1:description}', function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet bef "before each (js)"
|
||||
beforeEach(function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet aft "after each (js)"
|
||||
afterEach(function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet befa "before all (js)"
|
||||
beforeAll(function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet afta "after all (js)"
|
||||
afterAll(function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet any "any (js)"
|
||||
jasmine.any($1)
|
||||
|
||||
snippet anyt "anything (js)"
|
||||
jasmine.anything()
|
||||
|
||||
snippet objc "object containing (js)"
|
||||
jasmine.objectContaining({
|
||||
${VISUAL}$0
|
||||
});
|
||||
|
||||
snippet arrc "array containing (js)"
|
||||
jasmine.arrayContaining([${1:value1}]);
|
||||
|
||||
snippet strm "string matching (js)"
|
||||
jasmine.stringMatching("${1:matcher}")
|
||||
|
||||
snippet ru "runs (js)"
|
||||
runs(function() {
|
||||
$0
|
||||
});
|
||||
|
||||
snippet wa "waits (js)"
|
||||
waits($1);
|
||||
|
||||
snippet ex "expect (js)"
|
||||
expect(${1:target})$0;
|
||||
|
||||
snippet ee "expect to equal (js)"
|
||||
expect(${1:target}).toEqual(${2:value});
|
||||
|
||||
snippet el "expect to be less than (js)"
|
||||
expect(${1:target}).toBeLessThan(${2:value});
|
||||
|
||||
snippet eg "expect to be greater than (js)"
|
||||
expect(${1:target}).toBeGreaterThan(${2:value});
|
||||
|
||||
snippet eb "expect to be (js)"
|
||||
expect(${1:target}).toBe(${2:value});
|
||||
|
||||
snippet em "expect to match (js)"
|
||||
expect(${1:target}).toMatch(${2:pattern});
|
||||
|
||||
snippet eha "expect to have attribute (js)"
|
||||
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||
|
||||
snippet et "expect to be truthy (js)"
|
||||
expect(${1:target}).toBeTruthy();
|
||||
|
||||
snippet ef "expect to be falsy (js)"
|
||||
expect(${1:target}).toBeFalsy();
|
||||
|
||||
snippet etbd "expect to be defined (js)"
|
||||
expect(${1:target}).toBeDefined();
|
||||
|
||||
snippet eud "expect to be defined (js)"
|
||||
expect(${1:target}).toBeUndefined();
|
||||
|
||||
snippet en "expect to be null (js)"
|
||||
expect(${1:target}).toBeNull();
|
||||
|
||||
snippet ec "expect to contain (js)"
|
||||
expect(${1:target}).toContain(${2:value});
|
||||
|
||||
snippet ev "expect to be visible (js)"
|
||||
expect(${1:target}).toBeVisible();
|
||||
|
||||
snippet eh "expect to be hidden (js)"
|
||||
expect(${1:target}).toBeHidden();
|
||||
|
||||
snippet eth "expect to throw (js)"
|
||||
expect(${1:target}).toThrow(${2:value});
|
||||
|
||||
snippet ethe "expect to throw error (js)"
|
||||
expect(${1:target}).toThrowError(${2:value});
|
||||
|
||||
snippet notx "expect not (js)"
|
||||
expect(${1:target}).not$0;
|
||||
|
||||
snippet note "expect not to equal (js)"
|
||||
expect(${1:target}).not.toEqual(${2:value});
|
||||
|
||||
snippet notl "expect to not be less than (js)"
|
||||
expect(${1:target}).not.toBeLessThan(${2:value});
|
||||
|
||||
snippet notg "expect to not be greater than (js)"
|
||||
expect(${1:target}).not.toBeGreaterThan(${2:value});
|
||||
|
||||
snippet notm "expect not to match (js)"
|
||||
expect(${1:target}).not.toMatch(${2:pattern});
|
||||
|
||||
snippet notha "expect to not have attribute (js)"
|
||||
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'});
|
||||
|
||||
snippet nott "expect not to be truthy (js)"
|
||||
expect(${1:target}).not.toBeTruthy();
|
||||
|
||||
snippet notf "expect not to be falsy (js)"
|
||||
expect(${1:target}).not.toBeFalsy();
|
||||
|
||||
snippet notd "expect not to be defined (js)"
|
||||
expect(${1:target}).not.toBeDefined();
|
||||
|
||||
snippet notn "expect not to be null (js)"
|
||||
expect(${1:target}).not.toBeNull();
|
||||
|
||||
snippet notc "expect not to contain (js)"
|
||||
expect(${1:target}).not.toContain(${2:value});
|
||||
|
||||
snippet notv "expect not to be visible (js)"
|
||||
expect(${1:target}).not.toBeVisible();
|
||||
|
||||
snippet noth "expect not to be hidden (js)"
|
||||
expect(${1:target}).not.toBeHidden();
|
||||
|
||||
snippet notth "expect not to throw (js)"
|
||||
expect(${1:target}).not.toThrow(${2:value});
|
||||
|
||||
snippet notthe "expect not to throw error (js)"
|
||||
expect(${1:target}).not.toThrowError(${2:value});
|
||||
|
||||
snippet s "spy on (js)"
|
||||
spyOn(${1:object}, '${2:method}')$0;
|
||||
|
||||
snippet sr "spy on and return (js)"
|
||||
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
|
||||
|
||||
snippet st "spy on and throw (js)"
|
||||
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
|
||||
|
||||
snippet sct "spy on and call through (js)"
|
||||
spyOn(${1:object}, '${2:method}').and.callThrough();
|
||||
|
||||
snippet scf "spy on and call fake (js)"
|
||||
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
|
||||
|
||||
snippet ethbc "expect to have been called (js)"
|
||||
expect(${1:target}).toHaveBeenCalled();
|
||||
|
||||
snippet nthbc "expect not to have been called (js)"
|
||||
expect(${1:target}).not.toHaveBeenCalled();
|
||||
|
||||
snippet ethbcw "expect to have been called with (js)"
|
||||
expect(${1:target}).toHaveBeenCalledWith(${2:arguments});
|
||||
|
@ -1,34 +0,0 @@
|
||||
snippet des "describe('thing', function() { ... })" b
|
||||
describe('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet it "it('should do', function() { ... })" b
|
||||
it('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet xit "xit('should do', function() { ... })" b
|
||||
xit('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet bef "before(function() { ... })" b
|
||||
before(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet befe "beforeEach(function() { ... })" b
|
||||
beforeEach(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet aft "after(function() { ... })" b
|
||||
after(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet afte "afterEach(function() { ... })" b
|
||||
afterEach(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet exp "expect(...)" b
|
||||
expect(${1:})${0};
|
||||
snippet expe "expect(...).to.equal(...)" b
|
||||
expect(${1:}).to.equal(${0});
|
||||
snippet expd "expect(...).to.deep.equal(...)" b
|
||||
expect(${1:}).to.deep.equal(${0});
|
@ -1,205 +0,0 @@
|
||||
snippet sapmlabel
|
||||
var $1 = new sap.m.Label({
|
||||
design : $2,
|
||||
text : $3,
|
||||
visible : $4,
|
||||
textAlign : $5,
|
||||
textDirection : $6,
|
||||
width : $7,
|
||||
required : $7
|
||||
});
|
||||
|
||||
snippet sapmtext
|
||||
var $1 = new sap.m.Text({
|
||||
text :$2,
|
||||
textDirection :$3,
|
||||
visible :$4,
|
||||
wrapping : $5,
|
||||
textAlign : $6,
|
||||
width :$7,
|
||||
maxLines :$8
|
||||
});
|
||||
|
||||
snippet sapmbutton
|
||||
var $1 = new sap.m.Button({
|
||||
text : $2,
|
||||
type : $3,
|
||||
width : $4,
|
||||
enabled :$5,
|
||||
visible :$6,
|
||||
icon : $7,
|
||||
iconFirst : $8,
|
||||
activeIcon :$9,
|
||||
iconDensityAware : $10,
|
||||
});
|
||||
snippet sapmflexbox
|
||||
var $1 = new sap.m.FlexBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
snippet sapmhbox
|
||||
var $1 = new sap.m.HBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapmvbox
|
||||
var $1 = new sap.m.VBox({
|
||||
visible : $2,
|
||||
height : $3,
|
||||
width : $4,
|
||||
displayInline :$5,
|
||||
direction :$6,
|
||||
fitContainer : $7,
|
||||
renderType : $8,
|
||||
justifyContent :$9,
|
||||
alignItems : $10,
|
||||
items:[]
|
||||
});
|
||||
|
||||
snippet sapcomponent
|
||||
sap.ui.controller("$1", {
|
||||
onInit: function(){
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onAfterRendering: function() {
|
||||
},
|
||||
onExit: function() {
|
||||
},
|
||||
});
|
||||
|
||||
snippet sapminput
|
||||
var $1 = new sap.m.Input({
|
||||
value :$2,
|
||||
width : $3,
|
||||
enabled :$4,
|
||||
visible :$5,
|
||||
valueState :$6,
|
||||
name : $7,
|
||||
placeholder : $8,
|
||||
editable : $9,
|
||||
type : $10,
|
||||
maxLength :$11,
|
||||
valueStateText :$12,
|
||||
showValueStateMessage :$13,
|
||||
dateFormat :$14,
|
||||
showValueHelp :$15,
|
||||
showSuggestion :$16,
|
||||
valueHelpOnly :$17,
|
||||
filterSuggests :$18,
|
||||
maxSuggestionWidth :$19,
|
||||
startSuggestion : $20,
|
||||
showTableSuggestionValueHelp : $21,
|
||||
description : $22,
|
||||
fieldWidth : $23,
|
||||
valueLiveUpdate :$24,
|
||||
suggestionItems :[$25],
|
||||
suggestionColumns : [$26],
|
||||
suggestionRows : [$27],
|
||||
liveChange : $28,
|
||||
valueHelpRequest :$29,
|
||||
suggest : $30,
|
||||
suggestionItemSelected : $31
|
||||
});
|
||||
snippet _sthis
|
||||
var _self = this;
|
||||
|
||||
snippet sapmresponsivepopup
|
||||
var $1 = new sap.m.ResponsivePopover({
|
||||
placement :$2 ,//sap.m.PlacementType (default: sap.m.PlacementType.Right)
|
||||
showHeader :$3 ,//boolean (default: true)
|
||||
title : $4,//string
|
||||
icon :$5 ,//sap.ui.core.URI
|
||||
modal :$6 ,// boolean
|
||||
offsetX :$7, //int
|
||||
offsetY :$8, //int
|
||||
contentWidth : $9,//sap.ui.core.CSSSize
|
||||
contentHeight :$10, //sap.ui.core.CSSSize
|
||||
horizontalScrolling :$11, //boolean
|
||||
verticalScrolling :$12, //boolean
|
||||
showCloseButton :$13, //boolean (default: true)
|
||||
//Aggregations
|
||||
content :$14, //sap.ui.core.Control[]
|
||||
customHeader :$15, //sap.m.IBar
|
||||
subHeader : $16, //sap.m.IBar
|
||||
beginButton :$17, //sap.m.Button
|
||||
endButton : $18, //sap.m.Button
|
||||
//Associations
|
||||
initialFocus : $19, //string | sap.ui.core.Control
|
||||
//Events
|
||||
beforeOpen :$20, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterOpen : $21, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
beforeClose : $22, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
|
||||
afterClose : $23 //fnList
|
||||
});
|
||||
|
||||
snippet sapicon
|
||||
var $1 = new sap.ui.core.Icon({
|
||||
src :$2 , //sap.ui.core.URI
|
||||
size :$3 , //sap.ui.core.CSSSize
|
||||
color :$4 , //sap.ui.core.CSSColor
|
||||
hoverColor : $5 , // sap.ui.core.CSSColor
|
||||
activeColor :$6 , //sap.ui.core.CSSColor
|
||||
width :$7 , //sap.ui.core.CSSSize
|
||||
height : $8 ,//sap.ui.core.CSSSize
|
||||
backgroundColor :$8 , //sap.ui.core.CSSColor
|
||||
hoverBackgroundColor :$9 , //sap.ui.core.CSSColor
|
||||
activeBackgroundColor :$10 , //sap.ui.core.CSSColor
|
||||
visible :$11 , //boolean (default: true)
|
||||
decorative : $12 ,//boolean (default: true)
|
||||
});
|
||||
snippet extendVerticalL
|
||||
sap.ui.layout.VerticalLayout.extend("$1", {
|
||||
metadata: {
|
||||
properties: {
|
||||
$2
|
||||
},
|
||||
aggregations: {
|
||||
$3
|
||||
},
|
||||
events: {
|
||||
$4
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
$5
|
||||
},
|
||||
|
||||
renderer: "$6"
|
||||
});
|
||||
snippet extendHorizontalL
|
||||
sap.ui.layout.HorizontalLayout.extend("$1", {
|
||||
metadata: {
|
||||
properties: {
|
||||
$2
|
||||
},
|
||||
aggregations: {
|
||||
$3
|
||||
},
|
||||
events: {
|
||||
$4
|
||||
}
|
||||
},
|
||||
init: function(){
|
||||
$5
|
||||
},
|
||||
|
||||
renderer: "$6"
|
||||
});
|
@ -1,589 +0,0 @@
|
||||
snippet add
|
||||
${1:obj}.add('${2:selector expression}')
|
||||
snippet addClass
|
||||
${1:obj}.addClass('${2:class name}')
|
||||
snippet after
|
||||
${1:obj}.after('${2:Some text <b>and bold!</b>}')
|
||||
snippet ajax
|
||||
$.ajax({
|
||||
url: '${1:mydomain.com/url}',
|
||||
type: '${2:POST}',
|
||||
dataType: '${3:xml/html/script/json}',
|
||||
data: $.param( $('${4:Element or Expression}') ),
|
||||
complete: function (jqXHR, textStatus) {
|
||||
${5:// callback}
|
||||
},
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
${6:// success callback}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
${0:// error callback}
|
||||
}
|
||||
});
|
||||
snippet ajaxcomplete
|
||||
${1:obj}.ajaxComplete(function (${1:e}, xhr, settings) {
|
||||
${0:// callback}
|
||||
});
|
||||
snippet ajaxerror
|
||||
${1:obj}.ajaxError(function (${1:e}, xhr, settings, thrownError) {
|
||||
${2:// error callback}
|
||||
});
|
||||
${0}
|
||||
snippet ajaxget
|
||||
$.get('${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (data, textStatus, jqXHR) {
|
||||
${0:// success callback}
|
||||
}
|
||||
);
|
||||
snippet ajaxpost
|
||||
$.post('${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (data, textStatus, jqXHR) {
|
||||
${0:// success callback}
|
||||
}
|
||||
);
|
||||
snippet ajaxprefilter
|
||||
$.ajaxPrefilter(function (${1:options}, ${2:originalOptions}, jqXHR) {
|
||||
${0: // Modify options, control originalOptions, store jqXHR, etc}
|
||||
});
|
||||
snippet ajaxsend
|
||||
${1:obj}.ajaxSend(function (${1:request, settings}) {
|
||||
${2:// error callback}
|
||||
});
|
||||
${0}
|
||||
snippet ajaxsetup
|
||||
$.ajaxSetup({
|
||||
url: "${1:mydomain.com/url}",
|
||||
type: "${2:POST}",
|
||||
dataType: "${3:xml/html/script/json}",
|
||||
data: $.param( $("${4:Element or Expression}") ),
|
||||
complete: function (jqXHR, textStatus) {
|
||||
${5:// callback}
|
||||
},
|
||||
success: function (data, textStatus, jqXHR) {
|
||||
${6:// success callback}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
${0:// error callback}
|
||||
}
|
||||
});
|
||||
snippet ajaxstart
|
||||
$.ajaxStart(function () {
|
||||
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress};
|
||||
});
|
||||
${0}
|
||||
snippet ajaxstop
|
||||
$.ajaxStop(function () {
|
||||
${1:// handler for when all AJAX calls have been completed};
|
||||
});
|
||||
${0}
|
||||
snippet ajaxsuccess
|
||||
$.ajaxSuccess(function (${1:e}, xhr, settings) {
|
||||
${2:// handler for when any AJAX call is successfully completed};
|
||||
});
|
||||
${0}
|
||||
snippet andself
|
||||
${1:obj}.andSelf()
|
||||
snippet animate
|
||||
${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})
|
||||
snippet append
|
||||
${1:obj}.append('${2:Some text <b>and bold!</b>}')
|
||||
snippet appendTo
|
||||
${1:obj}.appendTo('${2:selector expression}')
|
||||
snippet attr
|
||||
${1:obj}.attr('${2:attribute}', '${3:value}')
|
||||
snippet attrm
|
||||
${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})
|
||||
snippet before
|
||||
${1:obj}.before('${2:Some text <b>and bold!</b>}')
|
||||
snippet bind
|
||||
${1:obj}.bind('${2:event name}', function (${3:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet blur
|
||||
${1:obj}.blur(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet C
|
||||
$.Callbacks()
|
||||
snippet Cadd
|
||||
${1:callbacks}.add(${2:callbacks})
|
||||
snippet Cdis
|
||||
${1:callbacks}.disable()
|
||||
snippet Cempty
|
||||
${1:callbacks}.empty()
|
||||
snippet Cfire
|
||||
${1:callbacks}.fire(${2:args})
|
||||
snippet Cfired
|
||||
${1:callbacks}.fired()
|
||||
snippet Cfirew
|
||||
${1:callbacks}.fireWith(${2:this}, ${3:args})
|
||||
snippet Chas
|
||||
${1:callbacks}.has(${2:callback})
|
||||
snippet Clock
|
||||
${1:callbacks}.lock()
|
||||
snippet Clocked
|
||||
${1:callbacks}.locked()
|
||||
snippet Crem
|
||||
${1:callbacks}.remove(${2:callbacks})
|
||||
snippet change
|
||||
${1:obj}.change(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet children
|
||||
${1:obj}.children('${2:selector expression}')
|
||||
snippet clearq
|
||||
${1:obj}.clearQueue(${2:'queue name'})
|
||||
snippet click
|
||||
${1:obj}.click(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet clone
|
||||
${1:obj}.clone()
|
||||
snippet contains
|
||||
$.contains(${1:container}, ${0:contents});
|
||||
snippet css
|
||||
${1:obj}.css('${2:attribute}', '${3:value}')
|
||||
snippet csshooks
|
||||
$.cssHooks['${1:CSS prop}'] = {
|
||||
get: function (elem, computed, extra) {
|
||||
${2: // handle getting the CSS property}
|
||||
},
|
||||
set: function (elem, value) {
|
||||
${0: // handle setting the CSS value}
|
||||
}
|
||||
};
|
||||
snippet cssm
|
||||
${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})
|
||||
snippet D
|
||||
$.Deferred()
|
||||
snippet Dalways
|
||||
${1:deferred}.always(${2:callbacks})
|
||||
snippet Ddone
|
||||
${1:deferred}.done(${2:callbacks})
|
||||
snippet Dfail
|
||||
${1:deferred}.fail(${2:callbacks})
|
||||
snippet Disrej
|
||||
${1:deferred}.isRejected()
|
||||
snippet Disres
|
||||
${1:deferred}.isResolved()
|
||||
snippet Dnotify
|
||||
${1:deferred}.notify(${2:args})
|
||||
snippet Dnotifyw
|
||||
${1:deferred}.notifyWith(${2:this}, ${3:args})
|
||||
snippet Dpipe
|
||||
${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter})
|
||||
snippet Dprog
|
||||
${1:deferred}.progress(${2:callbacks})
|
||||
snippet Dprom
|
||||
${1:deferred}.promise(${2:target})
|
||||
snippet Drej
|
||||
${1:deferred}.reject(${2:args})
|
||||
snippet Drejw
|
||||
${1:deferred}.rejectWith(${2:this}, ${3:args})
|
||||
snippet Dres
|
||||
${1:deferred}.resolve(${2:args})
|
||||
snippet Dresw
|
||||
${1:deferred}.resolveWith(${2:this}, ${3:args})
|
||||
snippet Dstate
|
||||
${1:deferred}.state()
|
||||
snippet Dthen
|
||||
${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks})
|
||||
snippet Dwhen
|
||||
$.when(${1:deferreds})
|
||||
snippet data
|
||||
${1:obj}.data(${2:obj})
|
||||
snippet dataa
|
||||
$.data('${1:selector expression}', '${2:key}'${3:, 'value'})
|
||||
snippet dblclick
|
||||
${1:obj}.dblclick(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet delay
|
||||
${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'})
|
||||
snippet dele
|
||||
${1:obj}.delegate('${2:selector expression}', '${3:event name}', function (${4:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet deq
|
||||
${1:obj}.dequeue(${2:'queue name'})
|
||||
snippet deqq
|
||||
$.dequeue('${1:selector expression}'${2:, 'queue name'})
|
||||
snippet detach
|
||||
${1:obj}.detach('${2:selector expression}')
|
||||
snippet die
|
||||
${1:obj}.die(${2:event}, ${3:handler})
|
||||
snippet each
|
||||
${1:obj}.each(function (index) {
|
||||
${0:this.innerHTML = this + " is the element, " + index + " is the position";}
|
||||
});
|
||||
snippet el
|
||||
$('<${1}/>'${2:, {}})
|
||||
snippet eltrim
|
||||
$.trim('${1:string}')
|
||||
snippet empty
|
||||
${1:obj}.empty()
|
||||
snippet end
|
||||
${1:obj}.end()
|
||||
snippet eq
|
||||
${1:obj}.eq(${2:element index})
|
||||
snippet error
|
||||
${1:obj}.error(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet eventsmap
|
||||
{
|
||||
:f${0}
|
||||
}
|
||||
snippet extend
|
||||
$.extend(${1:true, }${2:target}, ${3:obj})
|
||||
snippet fadein
|
||||
${1:obj}.fadeIn('${2:slow/400/fast}')
|
||||
snippet fadeinc
|
||||
${1:obj}.fadeIn('slow/400/fast', function () {
|
||||
${0:// callback};
|
||||
});
|
||||
snippet fadeout
|
||||
${1:obj}.fadeOut('${2:slow/400/fast}')
|
||||
snippet fadeoutc
|
||||
${1:obj}.fadeOut('slow/400/fast', function () {
|
||||
${0:// callback};
|
||||
});
|
||||
snippet fadeto
|
||||
${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})
|
||||
snippet fadetoc
|
||||
${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function () {
|
||||
${0:// callback};
|
||||
});
|
||||
snippet filter
|
||||
${1:obj}.filter('${2:selector expression}')
|
||||
snippet filtert
|
||||
${1:obj}.filter(function (${2:index}) {
|
||||
${3}
|
||||
})
|
||||
snippet find
|
||||
${1:obj}.find('${2:selector expression}')
|
||||
snippet focus
|
||||
${1:obj}.focus(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet focusin
|
||||
${1:obj}.focusIn(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet focusout
|
||||
${1:obj}.focusOut(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet get
|
||||
${1:obj}.get(${2:element index})
|
||||
snippet getjson
|
||||
$.getJSON('${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (data, textStatus, jqXHR) {
|
||||
${0:// success callback}
|
||||
}
|
||||
);
|
||||
snippet getscript
|
||||
$.getScript('${1:mydomain.com/url}', function (script, textStatus, jqXHR) {
|
||||
${0:// callback}
|
||||
});
|
||||
snippet grep
|
||||
$.grep(${1:array}, function (item, index) {
|
||||
${2}
|
||||
}${0:, true});
|
||||
snippet hasc
|
||||
${1:obj}.hasClass('${2:className}')
|
||||
snippet hasd
|
||||
$.hasData('${0:selector expression}');
|
||||
snippet height
|
||||
${1:obj}.height(${2:integer})
|
||||
snippet hide
|
||||
${1:obj}.hide('${2:slow/400/fast}')
|
||||
snippet hidec
|
||||
${1:obj}.hide('${2:slow/400/fast}', function () {
|
||||
${0:// callback}
|
||||
});
|
||||
snippet hover
|
||||
${1:obj}.hover(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
}, function ($2) {
|
||||
${4:// event handler}
|
||||
});
|
||||
snippet html
|
||||
${1:obj}.html('${2:Some text <b>and bold!</b>}')
|
||||
snippet inarr
|
||||
$.inArray(${1:value}, ${0:array});
|
||||
snippet insa
|
||||
${1:obj}.insertAfter('${2:selector expression}')
|
||||
snippet insb
|
||||
${1:obj}.insertBefore('${2:selector expression}')
|
||||
snippet is
|
||||
${1:obj}.is('${2:selector expression}')
|
||||
snippet isarr
|
||||
$.isArray(${1:obj})
|
||||
snippet isempty
|
||||
$.isEmptyObject(${1:obj})
|
||||
snippet isfunc
|
||||
$.isFunction(${1:obj})
|
||||
snippet isnum
|
||||
$.isNumeric(${1:value})
|
||||
snippet isobj
|
||||
$.isPlainObject(${1:obj})
|
||||
snippet iswin
|
||||
$.isWindow(${1:obj})
|
||||
snippet isxml
|
||||
$.isXMLDoc(${1:node})
|
||||
snippet jj
|
||||
$('${1:selector}')
|
||||
snippet kdown
|
||||
${1:obj}.keydown(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet kpress
|
||||
${1:obj}.keypress(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet kup
|
||||
${1:obj}.keyup(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet last
|
||||
${1:obj}.last('${1:selector expression}')
|
||||
snippet live
|
||||
${1:obj}.live('${2:events}', function (${3:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet load
|
||||
${1:obj}.load(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet loadf
|
||||
${1:obj}.load('${2:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
function (responseText, textStatus, xhr) {
|
||||
${0:// success callback}
|
||||
}
|
||||
});
|
||||
snippet makearray
|
||||
$.makeArray(${0:obj});
|
||||
snippet map
|
||||
${1:obj}.map(function (${2:index}, ${3:element}) {
|
||||
${0:// callback}
|
||||
});
|
||||
snippet mapp
|
||||
$.map(${1:arrayOrObject}, function (${2:value}, ${3:indexOrKey}) {
|
||||
${0:// callback}
|
||||
});
|
||||
snippet merge
|
||||
$.merge(${1:target}, ${0:original});
|
||||
snippet mdown
|
||||
${1:obj}.mousedown(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet menter
|
||||
${1:obj}.mouseenter(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet mleave
|
||||
${1:obj}.mouseleave(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet mmove
|
||||
${1:obj}.mousemove(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet mout
|
||||
${1:obj}.mouseout(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet mover
|
||||
${1:obj}.mouseover(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet mup
|
||||
${1:obj}.mouseup(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet next
|
||||
${1:obj}.next('${2:selector expression}')
|
||||
snippet nexta
|
||||
${1:obj}.nextAll('${2:selector expression}')
|
||||
snippet nextu
|
||||
${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet not
|
||||
${1:obj}.not('${2:selector expression}')
|
||||
snippet off
|
||||
${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler})
|
||||
snippet offset
|
||||
${1:obj}.offset()
|
||||
snippet offsetp
|
||||
${1:obj}.offsetParent()
|
||||
snippet on
|
||||
${1:obj}.on('${2:events}', '${3:selector expression}', function (${4:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet one
|
||||
${1:obj}.one('${2:event name}', function (${3:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet outerh
|
||||
${1:obj}.outerHeight()
|
||||
snippet outerw
|
||||
${1:obj}.outerWidth()
|
||||
snippet param
|
||||
$.param(${1:obj})
|
||||
snippet parent
|
||||
${1:obj}.parent('${2:selector expression}')
|
||||
snippet parents
|
||||
${1:obj}.parents('${2:selector expression}')
|
||||
snippet parentsu
|
||||
${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet parsejson
|
||||
$.parseJSON(${1:data})
|
||||
snippet parsexml
|
||||
$.parseXML(${1:data})
|
||||
snippet pos
|
||||
${1:obj}.position()
|
||||
snippet prepend
|
||||
${1:obj}.prepend('${2:Some text <b>and bold!</b>}')
|
||||
snippet prependto
|
||||
${1:obj}.prependTo('${2:selector expression}')
|
||||
snippet prev
|
||||
${1:obj}.prev('${2:selector expression}')
|
||||
snippet preva
|
||||
${1:obj}.prevAll('${2:selector expression}')
|
||||
snippet prevu
|
||||
${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet promise
|
||||
${1:obj}.promise(${2:'fx'}, ${3:target})
|
||||
snippet prop
|
||||
${1:obj}.prop('${2:property name}')
|
||||
snippet proxy
|
||||
$.proxy(${1:function}, ${2:this})
|
||||
snippet pushstack
|
||||
${1:obj}.pushStack(${2:elements})
|
||||
snippet queue
|
||||
${1:obj}.queue(${2:name}${3:, newQueue})
|
||||
snippet queuee
|
||||
$.queue(${1:element}${2:, name}${3:, newQueue})
|
||||
snippet ready
|
||||
$(function () {
|
||||
${0}
|
||||
});
|
||||
snippet rem
|
||||
${1:obj}.remove()
|
||||
snippet rema
|
||||
${1:obj}.removeAttr('${2:attribute name}')
|
||||
snippet remc
|
||||
${1:obj}.removeClass('${2:class name}')
|
||||
snippet remd
|
||||
${1:obj}.removeData('${2:key name}')
|
||||
snippet remdd
|
||||
$.removeData(${1:element}${2:, 'key name}')
|
||||
snippet remp
|
||||
${1:obj}.removeProp('${2:property name}')
|
||||
snippet repa
|
||||
${1:obj}.replaceAll(${2:target})
|
||||
snippet repw
|
||||
${1:obj}.replaceWith(${2:content})
|
||||
snippet reset
|
||||
${1:obj}.reset(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet resize
|
||||
${1:obj}.resize(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet scroll
|
||||
${1:obj}.scroll(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet scrolll
|
||||
${1:obj}.scrollLeft(${2:value})
|
||||
snippet scrollt
|
||||
${1:obj}.scrollTop(${2:value})
|
||||
snippet sdown
|
||||
${1:obj}.slideDown('${2:slow/400/fast}')
|
||||
snippet sdownc
|
||||
${1:obj}.slideDown('${2:slow/400/fast}', function () {
|
||||
${0:// callback};
|
||||
});
|
||||
snippet select
|
||||
${1:obj}.select(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet serialize
|
||||
${1:obj}.serialize()
|
||||
snippet serializea
|
||||
${1:obj}.serializeArray()
|
||||
snippet show
|
||||
${1:obj}.show('${2:slow/400/fast}')
|
||||
snippet showc
|
||||
${1:obj}.show('${2:slow/400/fast}', function () {
|
||||
${0:// callback}
|
||||
});
|
||||
snippet sib
|
||||
${1:obj}.siblings('${2:selector expression}')
|
||||
snippet size
|
||||
${1:obj}.size()
|
||||
snippet slice
|
||||
${1:obj}.slice(${2:start}${3:, end})
|
||||
snippet stoggle
|
||||
${1:obj}.slideToggle('${2:slow/400/fast}')
|
||||
snippet stop
|
||||
${1:obj}.stop('${2:queue}', ${3:false}, ${4:false})
|
||||
snippet submit
|
||||
${1:obj}.submit(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet sup
|
||||
${1:obj}.slideUp('${2:slow/400/fast}')
|
||||
snippet supc
|
||||
${1:obj}.slideUp('${2:slow/400/fast}', function () {
|
||||
${0:// callback};
|
||||
});
|
||||
snippet text
|
||||
${1:obj}.text(${2:'some text'})
|
||||
snippet this
|
||||
$(this)
|
||||
snippet toarr
|
||||
${0:obj}.toArray()
|
||||
snippet tog
|
||||
${1:obj}.toggle(function (${2:e}) {
|
||||
${3:// event handler}
|
||||
}, function ($2) {
|
||||
${4:// event handler}
|
||||
});
|
||||
${0}
|
||||
snippet togclass
|
||||
${1:obj}.toggleClass('${2:class name}')
|
||||
snippet togsh
|
||||
${1:obj}.toggle('${2:slow/400/fast}')
|
||||
snippet trig
|
||||
${1:obj}.trigger('${2:event name}')
|
||||
snippet trigh
|
||||
${1:obj}.triggerHandler('${2:event name}')
|
||||
snippet $trim
|
||||
$.trim(${1:str})
|
||||
snippet $type
|
||||
$.type(${1:obj})
|
||||
snippet unbind
|
||||
${1:obj}.unbind('${2:event name}')
|
||||
snippet undele
|
||||
${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler})
|
||||
snippet uniq
|
||||
$.unique(${1:array})
|
||||
snippet unload
|
||||
${1:obj}.unload(function (${2:e}) {
|
||||
${0:// event handler}
|
||||
});
|
||||
snippet unwrap
|
||||
${1:obj}.unwrap()
|
||||
snippet val
|
||||
${1:obj}.val('${2:text}')
|
||||
snippet width
|
||||
${1:obj}.width(${2:integer})
|
||||
snippet wrap
|
||||
${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')
|
@ -1,190 +0,0 @@
|
||||
# Import
|
||||
snippet ir import React
|
||||
import React from 'react';
|
||||
|
||||
snippet irc import React and Component
|
||||
import React, { Component } from 'react';
|
||||
|
||||
snippet irh import React hooks
|
||||
import { use$1 } from 'react';
|
||||
|
||||
snippet ird import ReactDOM
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
snippet irp import PropTypes
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
# Lifecycle Methods
|
||||
snippet cdm componentDidMount
|
||||
componentDidMount() {
|
||||
${1}
|
||||
};
|
||||
|
||||
snippet cdup componentDidUpdate
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
${1}
|
||||
};
|
||||
|
||||
snippet cwm componentWillMount
|
||||
componentWillMount() {
|
||||
${1}
|
||||
};
|
||||
|
||||
snippet cwr componentWillReceiveProps
|
||||
componentWillReceiveProps(nextProps) {
|
||||
${1}
|
||||
};
|
||||
|
||||
snippet cwun componentWillUnmount
|
||||
componentWillUnmount() {
|
||||
${1}
|
||||
};
|
||||
|
||||
snippet cwu componentWillUpdate
|
||||
componentWillUpdate(nextProps, nextState) {
|
||||
${1}
|
||||
};
|
||||
|
||||
snippet scu shouldComponentUpdate
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
${1}
|
||||
}
|
||||
|
||||
# Props
|
||||
snippet spt static propTypes
|
||||
static propTypes = {
|
||||
${1}: PropTypes.${2}
|
||||
};
|
||||
|
||||
snippet pt propTypes
|
||||
${1}.propTypes = {
|
||||
${2}: PropTypes.${2}
|
||||
};
|
||||
|
||||
snippet sdp static defaultProps
|
||||
static defaultProps = {
|
||||
${1}: ${2}
|
||||
};
|
||||
|
||||
snippet dp defaultProps
|
||||
${1}.defaultProps = {
|
||||
${2}: ${3}
|
||||
};
|
||||
|
||||
snippet pp props
|
||||
props.${1};
|
||||
|
||||
snippet tp this props
|
||||
this.props.${1};
|
||||
|
||||
# State
|
||||
snippet st
|
||||
state = {
|
||||
${1}: ${2},
|
||||
};
|
||||
|
||||
snippet sst
|
||||
this.setState({
|
||||
${1}: ${2}
|
||||
});
|
||||
|
||||
snippet tst
|
||||
this.state.${1};
|
||||
|
||||
# Component
|
||||
snippet raf
|
||||
const ${1:ComponentName} = (${2:props}) => {
|
||||
${3:state}
|
||||
|
||||
return (
|
||||
<>
|
||||
${4}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
snippet rcla
|
||||
class ${1:ClassName} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
${2}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
snippet ercla
|
||||
export default class ${1:ClassName} extends Component {
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
${2}
|
||||
</>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
snippet ctor
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
${1:state}
|
||||
}
|
||||
|
||||
snippet ren
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
${2}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
snippet fup
|
||||
forceUpdate(${1:callback});
|
||||
|
||||
# Hooks
|
||||
snippet uses useState
|
||||
const [${1:state}, set${2}] = useState(${3:initialState});
|
||||
|
||||
snippet usee useEffect
|
||||
useEffect(() => {
|
||||
${1}
|
||||
});
|
||||
|
||||
snippet userd useReducer
|
||||
const [${1:state}, ${2:dispatch}] = useReducer(${3:reducer});
|
||||
|
||||
snippet userf useRef
|
||||
const ${1:refContainer} = useRef(${2:initialValue});
|
||||
|
||||
snippet usect useContext
|
||||
const ${1:value} = useContext(${2:MyContext});
|
||||
|
||||
snippet usecb useCallback
|
||||
const ${1:memoizedCallback} = useCallback(
|
||||
() => {
|
||||
${2}(${3})
|
||||
},
|
||||
[$3]
|
||||
);
|
||||
|
||||
snippet usem useMemo
|
||||
const ${1:memoizedCallback} = useMemo(() => ${2}(${3}), [$3]);
|
||||
|
||||
snippet usei useImperativeHandle
|
||||
useImperativeHandle(${1:ref}, ${2:createHandle});
|
||||
|
||||
snippet used useDebugValue
|
||||
useDebugValue(${1:value});
|
||||
|
||||
# ReactDOM methods
|
||||
snippet rdr ReactDOM.render
|
||||
ReactDOM.render(${1}, ${2});
|
||||
|
||||
snippet rdh ReactDOM.hydrate
|
||||
ReactDOM.hydrate(${1:element}, ${2:container}[, ${3:callback}]);
|
||||
|
||||
snippet rdcp ReactDOM.createPortal
|
||||
ReactDOM.createPortal(${1:child}, ${2:container});
|
@ -1,37 +0,0 @@
|
||||
snippet ist
|
||||
import { createStore } from 'redux';
|
||||
snippet con
|
||||
connect(${1:mapStateToProps}, ${2:mapDispatchToProps})(<${3:VISUAL}/>);
|
||||
snippet act
|
||||
const ${1:actionName} = (${2:arg}) => {
|
||||
return {
|
||||
type: ${3:VISUAL},
|
||||
$2
|
||||
};
|
||||
};
|
||||
snippet rdc
|
||||
const ${1:reducerName} = (state={}, action) => {
|
||||
switch(action.type) {
|
||||
case ${1:action}:
|
||||
return {
|
||||
...state,
|
||||
$2
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
};
|
||||
};
|
||||
snippet mstp
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
${1:propName}: state.$1,
|
||||
};
|
||||
};
|
||||
snippet mdtp
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
${1:propName}: () => {
|
||||
dispatch(${2:actionName}());
|
||||
},
|
||||
};
|
||||
};
|
@ -1,14 +0,0 @@
|
||||
snippet def
|
||||
define(["${1:#dependencies1}"], function (${2:#dependencies2}) {
|
||||
return ${0:TARGET};
|
||||
});
|
||||
|
||||
snippet defn
|
||||
define("${1:#name}", ["${2:#dependencies1}"], function (${3:#dependencies2}) {
|
||||
return ${0:TARGET};
|
||||
});
|
||||
|
||||
snippet reqjs
|
||||
require(["${1:#dependencies1}"], function (${2:#dependencies2}) {
|
||||
return ${0:TARGET};
|
||||
});
|
@ -1,51 +0,0 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env node
|
||||
# module exports
|
||||
snippet ex
|
||||
module.exports = ${1};
|
||||
# require
|
||||
snippet re
|
||||
const ${1} = require('${2:module_name}');
|
||||
# EventEmitter
|
||||
snippet on
|
||||
on('${1:event_name}', function(${2:stream}) {
|
||||
${3}
|
||||
});
|
||||
snippet emit
|
||||
emit('${1:event_name}', ${2:args});
|
||||
snippet once
|
||||
once('${1:event_name}', function(${2:stream}) {
|
||||
${3}
|
||||
});
|
||||
# http. User js function snippet as handler
|
||||
snippet http
|
||||
http.createServer(${1:handler}).listen(${2:port_number});
|
||||
# net
|
||||
snippet net
|
||||
net.createServer(function(${1:socket}){
|
||||
${1}.on('data', function('data'){
|
||||
${2}
|
||||
]});
|
||||
${1}.on('end', function(){
|
||||
${3}
|
||||
});
|
||||
}).listen(${4:8124});
|
||||
# Stream snippets
|
||||
snippet pipe
|
||||
pipe(${1:stream})${2}
|
||||
# Express snippets
|
||||
snippet eget
|
||||
${1:app}.get('${2:route}', ${3:handler});
|
||||
snippet epost
|
||||
${1:app}.post('${2:route}', ${3:handler});
|
||||
snippet eput
|
||||
${1:app}.put('${2:route}', ${3:handler});
|
||||
snippet edel
|
||||
${1:app}.delete('${2:route}', ${3:handler});
|
||||
# process snippets
|
||||
snippet stdin
|
||||
process.stdin
|
||||
snippet stdout
|
||||
process.stdout
|
||||
snippet stderr
|
||||
process.stderr
|
@ -1,363 +0,0 @@
|
||||
# Functions
|
||||
# prototype
|
||||
snippet proto
|
||||
${1:class_name}.prototype.${2:method_name} = function(${3}) {
|
||||
${0:${VISUAL}}
|
||||
};
|
||||
# Function
|
||||
snippet fun "function"
|
||||
function ${1:function_name}(${2}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Asynchronous Function
|
||||
snippet asf "async function"
|
||||
async function ${1:function_name}(${2}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Anonymous Function
|
||||
snippet anf "" w
|
||||
function(${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Anonymous Function assigned to variable
|
||||
snippet vaf
|
||||
var ${1:function_name} = function(${2}) {
|
||||
${0:${VISUAL}}
|
||||
};
|
||||
# Function assigned to variable
|
||||
snippet vf
|
||||
var ${1:function_name} = function $1(${2}) {
|
||||
${0:${VISUAL}}
|
||||
};
|
||||
# Immediate function
|
||||
snippet (f
|
||||
(function(${1}) {
|
||||
${0:${VISUAL}}
|
||||
}(${2}));
|
||||
# Minify safe iife
|
||||
snippet ;fe
|
||||
;(function(${1}) {
|
||||
${0:${VISUAL}}
|
||||
}(${2}))
|
||||
# self-defining function
|
||||
snippet sdf
|
||||
var ${1:function_name} = function (${2:argument}) {
|
||||
${3}
|
||||
|
||||
$1 = function ($2) {
|
||||
${0:${VISUAL}}
|
||||
};
|
||||
};
|
||||
# Flow control
|
||||
# if
|
||||
snippet if "if (condition) { ... }"
|
||||
if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# if ... else
|
||||
snippet ife "if (condition) { ... } else { ... }"
|
||||
if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
} else {
|
||||
${2}
|
||||
}
|
||||
# tertiary conditional
|
||||
snippet ter Ternary: `condition ? true : false`
|
||||
$1 ? $2: $0
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:expression}) {
|
||||
case '${3:case}':
|
||||
${4}
|
||||
break;
|
||||
${0}
|
||||
default:
|
||||
${2}
|
||||
}
|
||||
snippet case "case 'xyz': ... break"
|
||||
case '${1:case}':
|
||||
${0:${VISUAL}}
|
||||
break;
|
||||
snippet try "try { ... } catch(e) { ... }"
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:e}) {
|
||||
${2:/* handle error */}
|
||||
}
|
||||
snippet tryf "try { ... } catch(e) { ... } finally { ... }"
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:e}) {
|
||||
${2:/* handle error */}
|
||||
} finally {
|
||||
${3:/* be executed regardless of the try / catch result*/}
|
||||
}
|
||||
# throw Error
|
||||
snippet terr
|
||||
throw new Error('${1:error message}')
|
||||
# return
|
||||
snippet ret
|
||||
return ${0:result};
|
||||
snippet for "for (...) {...}"
|
||||
for (let ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet forr "reversed for (...) {...}"
|
||||
for (let ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet wh "(condition) { ... }"
|
||||
while (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet wht "(true) { ... }"
|
||||
while (true) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet do "do { ... } while (condition)"
|
||||
do {
|
||||
${0:${VISUAL}}
|
||||
} while ($1);
|
||||
# For in loop
|
||||
snippet fori
|
||||
for (let ${1:prop} in ${2:object}) {
|
||||
${0:$2[$1]}
|
||||
}
|
||||
# Objects
|
||||
# Object Method
|
||||
snippet :f
|
||||
${1:method_name}: function (${2:attribute}) {
|
||||
${0:${VISUAL}}
|
||||
},
|
||||
# hasOwnProperty
|
||||
snippet has
|
||||
hasOwnProperty(${0})
|
||||
# singleton
|
||||
snippet sing
|
||||
function ${1:Singleton} (${2:argument}) {
|
||||
// the cached instance
|
||||
var instance;
|
||||
|
||||
// rewrite the constructor
|
||||
$1 = function $1($2) {
|
||||
return instance;
|
||||
};
|
||||
|
||||
// carry over the prototype properties
|
||||
$1.prototype = this;
|
||||
|
||||
// the instance
|
||||
instance = new $1();
|
||||
|
||||
// reset the constructor pointer
|
||||
instance.constructor = $1;
|
||||
|
||||
${0}
|
||||
|
||||
return instance;
|
||||
}
|
||||
# Crockford's object function
|
||||
snippet obj
|
||||
function object(o) {
|
||||
function F() {}
|
||||
F.prototype = o;
|
||||
return new F();
|
||||
}
|
||||
# Define multiple properties
|
||||
snippet props
|
||||
var ${1:my_object} = Object.defineProperties(
|
||||
${2:new Object()},
|
||||
{
|
||||
${3:property} : {
|
||||
get : function $1_$3_getter() {
|
||||
// getter code
|
||||
},
|
||||
set : function $1_$3_setter(value) {
|
||||
// setter code
|
||||
},
|
||||
value : ${4:value},
|
||||
writeable : ${5:boolean},
|
||||
enumerable : ${6:boolean},
|
||||
configurable : ${0:boolean}
|
||||
}
|
||||
}
|
||||
);
|
||||
# Define single property
|
||||
snippet prop
|
||||
Object.defineProperty(
|
||||
${1:object},
|
||||
'${2:property}',
|
||||
{
|
||||
get : function $1_$2_getter() {
|
||||
// getter code
|
||||
},
|
||||
set : function $1_$2_setter(value) {
|
||||
// setter code
|
||||
},
|
||||
value : ${3:value},
|
||||
writeable : ${4:boolean},
|
||||
enumerable : ${5:boolean},
|
||||
configurable : ${0:boolean}
|
||||
}
|
||||
);
|
||||
# Documentation
|
||||
# docstring
|
||||
snippet /**
|
||||
/**
|
||||
* ${0:description}
|
||||
*
|
||||
*/
|
||||
snippet @par
|
||||
@param {${1:type}} ${2:name} ${0:description}
|
||||
snippet @ret
|
||||
@return {${1:type}} ${0:description}
|
||||
# JSON.parse
|
||||
snippet jsonp
|
||||
JSON.parse(${0:jstr});
|
||||
# JSON.stringify
|
||||
snippet jsons
|
||||
JSON.stringify(${0:object});
|
||||
# DOM selectors
|
||||
# Get elements
|
||||
snippet get
|
||||
getElementsBy${1:TagName}('${0}')
|
||||
# Get element
|
||||
snippet gett
|
||||
getElementBy${1:Id}('${0}')
|
||||
# Elements by class
|
||||
snippet by.
|
||||
${1:document}.getElementsByClassName('${0:class}')
|
||||
# Element by ID
|
||||
snippet by#
|
||||
${1:document}.getElementById('${0:element ID}')
|
||||
# Query selector
|
||||
snippet qs
|
||||
${1:document}.querySelector('${0:CSS selector}')
|
||||
# Query selector all
|
||||
snippet qsa
|
||||
${1:document}.querySelectorAll('${0:CSS selector}')
|
||||
# Debugging
|
||||
snippet de
|
||||
debugger;
|
||||
snippet cl "console.log"
|
||||
console.log(${0});
|
||||
snippet cd "console.debug"
|
||||
console.debug(${0});
|
||||
snippet ce "console.error"
|
||||
console.error(${0});
|
||||
snippet cw "console.warn"
|
||||
console.warn(${0});
|
||||
snippet ci "console.info"
|
||||
console.info(${0});
|
||||
snippet ct "console.trace"
|
||||
console.trace(${0:label});
|
||||
snippet ctime "console.time ... console.timeEnd"
|
||||
console.time("${1:label}");
|
||||
${0:${VISUAL}}
|
||||
console.timeEnd("$1");
|
||||
snippet ctimestamp "console.timeStamp"
|
||||
console.timeStamp("${1:label}");
|
||||
snippet ca "console.assert"
|
||||
console.assert(${1:expression}, ${0:obj});
|
||||
snippet cclear "console.clear"
|
||||
console.clear();
|
||||
snippet cdir "console.dir"
|
||||
console.dir(${0:obj});
|
||||
snippet cdirx "console.dirxml"
|
||||
console.dirxml(${1:object});
|
||||
snippet cgroup "console.group"
|
||||
console.group("${1:label}");
|
||||
${0:${VISUAL}}
|
||||
console.groupEnd();
|
||||
snippet cgroupc "console.groupCollapsed"
|
||||
console.groupCollapsed("${1:label}");
|
||||
${0:${VISUAL}}
|
||||
console.groupEnd();
|
||||
snippet cprof "console.profile"
|
||||
console.profile("${1:label}");
|
||||
${0:${VISUAL}}
|
||||
console.profileEnd();
|
||||
snippet ctable "console.table"
|
||||
console.table(${1:"${2:value}"});
|
||||
snippet clstr "console.log stringified"
|
||||
console.log(JSON.stringify(${0}, null, 2));
|
||||
# Misc
|
||||
snippet us
|
||||
'use strict';
|
||||
# setTimeout function
|
||||
snippet timeout
|
||||
setTimeout(function () {${0}}${2}, ${1:10});
|
||||
snippet const
|
||||
const ${1} = ${0};
|
||||
snippet constn
|
||||
const ${1} = new ${0};
|
||||
snippet let
|
||||
let ${1} = ${0};
|
||||
snippet im "import xyz from 'xyz'"
|
||||
import ${1} from '${2:$1}';
|
||||
snippet imas "import * as xyz from 'xyz'"
|
||||
import * as ${1} from '${2:$1}';
|
||||
snippet imm "import { member } from 'xyz'"
|
||||
import { ${1} } from '${2}';
|
||||
snippet cla
|
||||
class ${1} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet clax
|
||||
class ${1} extends ${2} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet clac
|
||||
class ${1} {
|
||||
constructor(${2}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
}
|
||||
snippet foro "for (const prop of object}) { ... }"
|
||||
for (const ${1:prop} of ${2:object}) {
|
||||
${0:$1}
|
||||
}
|
||||
snippet forl "for (let prop of object}) { ... }"
|
||||
for (let ${1:prop} of ${2:object}) {
|
||||
${0:$1}
|
||||
}
|
||||
snippet fun*
|
||||
function* ${1:function_name}(${2}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet c=>
|
||||
const ${1:function_name} = (${2}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ca=>
|
||||
const ${1:function_name} = async (${2}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet caf
|
||||
const ${1:function_name} = (${2}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet casf
|
||||
const ${1:function_name} = async (${2}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet =>
|
||||
(${1}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet af "() =>"
|
||||
(${1}) => ${0:${VISUAL}}
|
||||
snippet afb "() => {}"
|
||||
(${1}) => {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet sym
|
||||
const ${1} = Symbol('${0}');
|
||||
snippet ed
|
||||
export default ${0}
|
||||
snippet ${
|
||||
\${${1}}${0}
|
||||
snippet as "async"
|
||||
async ${0}
|
||||
snippet aw "await"
|
||||
await ${0:${VISUAL}}
|
@ -1,270 +0,0 @@
|
||||
snippet steps
|
||||
steps {
|
||||
sh '${1:make check}'
|
||||
junit '${2:reports/**/*.xml}'
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet stage
|
||||
stage('${1:Test}'){
|
||||
steps {
|
||||
sh '${2:make check}'
|
||||
junit '${3:reports/**/*.xml}'
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pipeline
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('${1:Build}') {
|
||||
steps {
|
||||
sh '${2:make}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pipeline_sample
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('${1:Build}') {
|
||||
steps {
|
||||
sh '${2:make}'
|
||||
}
|
||||
}
|
||||
stage('${3:Test}'){
|
||||
steps {
|
||||
sh '${4:make check}'
|
||||
junit '${5:reports/**/*.xml}'
|
||||
}
|
||||
}
|
||||
stage('${6:Deploy}') {
|
||||
steps {
|
||||
sh '${7:make publish}'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet d
|
||||
docker {
|
||||
image '${1:myregistry.com/node'}'
|
||||
label '${2:my-defined-label'}'
|
||||
registryUrl '${3:https://myregistry.com/'}'
|
||||
registryCredentialsId '${4:myPredefinedCredentialsInJenkins'}'
|
||||
}
|
||||
|
||||
|
||||
snippet df
|
||||
dockerfile {
|
||||
filename '${1:Dockerfile.build}'
|
||||
dir '${2:build}'
|
||||
label '${3:my-defined-label}'
|
||||
registryUrl '${4:https://myregistry.com/}'
|
||||
registryCredentialsId '${5:myPredefinedCredentialsInJenkins}'
|
||||
}
|
||||
|
||||
snippet pa
|
||||
post {
|
||||
always {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pc
|
||||
post {
|
||||
changed {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pf
|
||||
post {
|
||||
fixed {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pr
|
||||
post {
|
||||
regression {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pab
|
||||
post {
|
||||
aborted {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pfa
|
||||
post {
|
||||
failure {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet ps
|
||||
post {
|
||||
success {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pu
|
||||
post {
|
||||
unstable {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet pc
|
||||
post {
|
||||
cleanup {
|
||||
${1}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
|
||||
snippet psss
|
||||
pipeline {
|
||||
agent any
|
||||
stages {
|
||||
stage('${1:Build}') {
|
||||
steps {
|
||||
sh '${2:make}'
|
||||
}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet sss
|
||||
stages {
|
||||
stage('${1:Build}') {
|
||||
steps {
|
||||
sh '${2:make}'
|
||||
}
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
|
||||
|
||||
snippet parameters
|
||||
parameters{
|
||||
${1}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet paramtext
|
||||
text(name: "${1:BIOGRAPHY}" , defaultValue: "${2:default}" , description: "${3:Enter some information about the person}")
|
||||
${0}
|
||||
|
||||
snippet parambool
|
||||
booleanParam(name: "${1:TOGGLE}" , defaultValue: ${2:default}, description: "${3:Toggle this value}")
|
||||
${0}
|
||||
|
||||
snippet paramchoice
|
||||
choice(name: "${1:CHOICE}" , choices: ["${2:Choices}",] , description: "${3:Pick something}")
|
||||
${0}
|
||||
|
||||
snippet parampassword
|
||||
password(name: "${1:PASSWORD}" , defaultValue: "${2:SECRET}" , description: "${3:Enter a password}")
|
||||
${0}
|
||||
|
||||
snippet paramfile
|
||||
file(name: "${1:FILE}" , description: "${2:Choose a file to upload}")${0}
|
||||
${0}
|
||||
|
||||
snippet triggers
|
||||
triggers {
|
||||
cron('${1:H */4 * * 1-5}')
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet input
|
||||
input {
|
||||
message '${1:Should we continue?}'
|
||||
ok '${2:Yes, we should.}'
|
||||
submitter '${3:alice,bob}'
|
||||
parameters {
|
||||
string(name: '${4:PERSON}' , defaultValue: '${5:Mr Jenkins}' , description: '${6:Who should I say hello to?}')
|
||||
}
|
||||
}
|
||||
${0}
|
||||
|
||||
snippet whenbranch
|
||||
when {
|
||||
branch '${1:branch}'
|
||||
}
|
||||
${0}
|
||||
snippet whenbuildingTag
|
||||
when {
|
||||
buildingTag '${1:tag}'
|
||||
}
|
||||
${0}
|
||||
snippet whenchangelog
|
||||
when {
|
||||
changelog '${1:changelog}'
|
||||
}
|
||||
${0}
|
||||
snippet whenchangeset
|
||||
when {
|
||||
changeset '${1:changeSet}'
|
||||
}
|
||||
${0}
|
||||
snippet whenchangeRequest
|
||||
when {
|
||||
changeRequest '${1:changeRequest}'
|
||||
}
|
||||
${0}
|
||||
snippet whenenvironment
|
||||
when {
|
||||
environment '${1:environment}'
|
||||
}
|
||||
${0}
|
||||
snippet whenequals
|
||||
when {
|
||||
equals '${1:equals}'
|
||||
}
|
||||
${0}
|
||||
snippet whenexpression
|
||||
when {
|
||||
expression '${1:expression}'
|
||||
}
|
||||
${0}
|
||||
snippet whentag
|
||||
when {
|
||||
tag '${1:tag}'
|
||||
}
|
||||
${0}
|
||||
snippet whennot
|
||||
when {
|
||||
not '${1:not}'
|
||||
}
|
||||
${0}
|
||||
snippet whenallOf
|
||||
when {
|
||||
allOf '${1:allOf}'
|
||||
}
|
||||
${0}
|
||||
snippet whenanyOf
|
||||
when {
|
||||
anyOf '${1:anyOf}'
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
# Generic tags
|
||||
|
||||
extends html
|
||||
|
||||
snippet %
|
||||
{% ${1} %}
|
||||
snippet %%
|
||||
{% ${1:tag_name} %}
|
||||
${0}
|
||||
{% end$1 %}
|
||||
snippet {
|
||||
{{ ${1} }}
|
||||
# Template Tags
|
||||
|
||||
snippet autoescape
|
||||
{% autoescape ${1:off} %}
|
||||
${0}
|
||||
{% endautoescape %}
|
||||
snippet block
|
||||
{% block ${1} %}
|
||||
${0}
|
||||
{% endblock %}
|
||||
snippet #
|
||||
{# ${0:comment} #}
|
||||
snippet comment
|
||||
{% comment %}
|
||||
${0}
|
||||
{% endcomment %}
|
||||
snippet cycle
|
||||
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
|
||||
snippet debug
|
||||
{% debug %}
|
||||
snippet extends
|
||||
{% extends "${0:base.html}" %}
|
||||
snippet filter
|
||||
{% filter ${1} %}
|
||||
${0}
|
||||
{% endfilter %}
|
||||
snippet firstof
|
||||
{% firstof ${1} %}
|
||||
snippet for
|
||||
{% for ${1} in ${2} %}
|
||||
${0}
|
||||
{% endfor %}
|
||||
snippet empty
|
||||
{% empty %}
|
||||
${0}
|
||||
snippet if
|
||||
{% if ${1} %}
|
||||
${0}
|
||||
{% endif %}
|
||||
snippet el
|
||||
{% else %}
|
||||
${1}
|
||||
snippet eif
|
||||
{% elif ${1} %}
|
||||
${0}
|
||||
snippet ifchanged
|
||||
{% ifchanged %}${1}{% endifchanged %}
|
||||
snippet ifequal
|
||||
{% ifequal ${1} ${2} %}
|
||||
${0}
|
||||
{% endifequal %}
|
||||
snippet ifnotequal
|
||||
{% ifnotequal ${1} ${2} %}
|
||||
${0}
|
||||
{% endifnotequal %}
|
||||
snippet include
|
||||
{% include "${0}" %}
|
||||
snippet load
|
||||
{% load ${0} %}
|
||||
snippet now
|
||||
{% now "${0:jS F Y H:i}" %}
|
||||
snippet regroup
|
||||
{% regroup ${1} by ${2} as ${0} %}
|
||||
snippet spaceless
|
||||
{% spaceless %}${0}{% endspaceless %}
|
||||
snippet ssi
|
||||
{% ssi ${0} %}
|
||||
snippet trans
|
||||
{% trans %}${0}{% endtrans %}
|
||||
snippet url
|
||||
{% url ${1} as ${0} %}
|
||||
snippet widthratio
|
||||
{% widthratio ${1:this_value} ${2:max_value} ${0:100} %}
|
||||
snippet with
|
||||
{% with ${1} as ${2} %}
|
||||
${0}
|
||||
{% endwith %}
|
||||
|
||||
# Template Filters
|
||||
|
||||
# Note: Since SnipMate can't determine which template filter you are
|
||||
# expanding without the "|" character, these do not add the "|"
|
||||
# character. These save a few keystrokes still.
|
||||
|
||||
# Note: Template tags that take no arguments are not implemented.
|
||||
|
||||
snippet add
|
||||
add:"${0}"
|
||||
snippet center
|
||||
center:"${0}"
|
||||
snippet cut
|
||||
cut:"${0}"
|
||||
snippet date
|
||||
date:"${0}"
|
||||
snippet default
|
||||
default:"${0}"
|
||||
snippet defaultifnone
|
||||
default_if_none:"${0}"
|
||||
snippet dictsort
|
||||
dictsort:"${0}"
|
||||
snippet dictsortrev
|
||||
dictsortreversed:"${0}"
|
||||
snippet divisibleby
|
||||
divisibleby:"${0}"
|
||||
snippet floatformat
|
||||
floatformat:"${0}"
|
||||
snippet getdigit
|
||||
get_digit:"${0}"
|
||||
snippet join
|
||||
join:"${0}"
|
||||
snippet lengthis
|
||||
length_is:"${0}"
|
||||
snippet pluralize
|
||||
pluralize:"${0}"
|
||||
snippet removetags
|
||||
removetags:"${0}"
|
||||
snippet slice
|
||||
slice:"${0}"
|
||||
snippet stringformat
|
||||
stringformat:"${0}"
|
||||
snippet time
|
||||
time:"${0}"
|
||||
snippet truncatewords
|
||||
truncatewords:${0}
|
||||
snippet truncatewordshtml
|
||||
truncatewords_html:${0}
|
||||
snippet urlizetrunc
|
||||
urlizetrunc:${0}
|
||||
snippet wordwrap
|
||||
wordwrap:${0}
|
@ -1,99 +0,0 @@
|
||||
snippet @page
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
snippet jstl
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
||||
snippet jstl:c
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
|
||||
snippet jstl:fn
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
|
||||
snippet cpath
|
||||
${pageContext.request.contextPath}
|
||||
snippet cout
|
||||
<c:out value="${1}" default="${0}" />
|
||||
snippet cset
|
||||
<c:set var="${1}" value="${0}" />
|
||||
snippet cremove
|
||||
<c:remove var="${1}" scope="${0:page}" />
|
||||
snippet ccatch
|
||||
<c:catch var="${0}" />
|
||||
snippet cif
|
||||
<c:if test="\${${1}}">
|
||||
${0}
|
||||
</c:if>
|
||||
snippet cchoose
|
||||
<c:choose>
|
||||
${0}
|
||||
</c:choose>
|
||||
snippet cwhen
|
||||
<c:when test="\${${1}}">
|
||||
${0}
|
||||
</c:when>
|
||||
snippet cother
|
||||
<c:otherwise>
|
||||
${0}
|
||||
</c:otherwise>
|
||||
snippet cfore
|
||||
<c:forEach items="\${${1}}" var="${2}" varStatus="${3}">
|
||||
${0:<c:out value="$2" />}
|
||||
</c:forEach>
|
||||
snippet cfort
|
||||
<c:set var="${1}">${2:item1,item2,item3}</c:set>
|
||||
<c:forTokens var="${3}" items="\${$1}" delims="${4:,}">
|
||||
${0:<c:out value="$3" />}
|
||||
</c:forTokens>
|
||||
snippet cparam
|
||||
<c:param name="${1}" value="${0}" />
|
||||
snippet cparam+
|
||||
<c:param name="${1}" value="${2}" />
|
||||
cparam+${0}
|
||||
snippet cimport
|
||||
<c:import url="${1}" />
|
||||
snippet cimport+
|
||||
<c:import url="${1}">
|
||||
<c:param name="${2}" value="${3}" />
|
||||
cparam+${0}
|
||||
</c:import>
|
||||
snippet curl
|
||||
<c:url value="${1}" var="${2}" />
|
||||
<a href="\${$2}">${0}</a>
|
||||
snippet curl+
|
||||
<c:url value="${1}" var="${2}">
|
||||
<c:param name="${4}" value="${5}" />
|
||||
cparam+${0}
|
||||
</c:url>
|
||||
<a href="\${$2}">${3}</a>
|
||||
snippet credirect
|
||||
<c:redirect url="${0}" />
|
||||
snippet contains
|
||||
${fn:contains(${1:string}, ${0:substr})}
|
||||
snippet contains:i
|
||||
${fn:containsIgnoreCase(${1:string}, ${0:substr})}
|
||||
snippet endswith
|
||||
${fn:endsWith(${1:string}, ${0:suffix})}
|
||||
snippet escape
|
||||
${fn:escapeXml(${0:string})}
|
||||
snippet indexof
|
||||
${fn:indexOf(${1:string}, ${0:substr})}
|
||||
snippet join
|
||||
${fn:join(${1:collection}, ${0:delims})}
|
||||
snippet length
|
||||
${fn:length(${0:collection_or_string})}
|
||||
snippet replace
|
||||
${fn:replace(${1:string}, ${2:substr}, ${0:replace})}
|
||||
snippet split
|
||||
${fn:split(${1:string}, ${0:delims})}
|
||||
snippet startswith
|
||||
${fn:startsWith(${1:string}, ${0:prefix})}
|
||||
snippet substr
|
||||
${fn:substring(${1:string}, ${2:begin}, ${0:end})}
|
||||
snippet substr:a
|
||||
${fn:substringAfter(${1:string}, ${0:substr})}
|
||||
snippet substr:b
|
||||
${fn:substringBefore(${1:string}, ${0:substr})}
|
||||
snippet lc
|
||||
${fn:toLowerCase(${0:string})}
|
||||
snippet uc
|
||||
${fn:toUpperCase(${0:string})}
|
||||
snippet trim
|
||||
${fn:trim(${0:string})}
|
@ -1,114 +0,0 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env julia
|
||||
|
||||
# Functions
|
||||
snippet fun function definition
|
||||
function ${1}(${2})
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet ret return
|
||||
return(${0})
|
||||
|
||||
# Printing to console
|
||||
snippet pr print
|
||||
print("${1}")
|
||||
${0}
|
||||
|
||||
snippet prl print line
|
||||
println("${1}")
|
||||
${0}
|
||||
|
||||
# Includes
|
||||
snippet use load a package
|
||||
using ${0}
|
||||
|
||||
snippet incl include source code
|
||||
include("${1}")
|
||||
${0}
|
||||
|
||||
# Loops
|
||||
snippet forc for loop iterating over iterable container
|
||||
for ${1} in ${2}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet for standard for loop
|
||||
for ${1} = ${2}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet fornest nested for loop
|
||||
for ${1} = ${2}, ${3} = ${4}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet wh while loop
|
||||
while ${1} ${2:<=} ${3}
|
||||
${0}
|
||||
end
|
||||
|
||||
# Conditionals
|
||||
snippet if if statement
|
||||
if ${1}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet el else part of statement
|
||||
else
|
||||
${0}
|
||||
|
||||
snippet eif else if part of if statement
|
||||
else if ${1}
|
||||
${0}
|
||||
|
||||
snippet ife full if-else statement
|
||||
if ${1}
|
||||
${2}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet tern ternary operator
|
||||
${1} ? ${2} : ${3:nothing}
|
||||
|
||||
# Exceptions
|
||||
snippet try try catch
|
||||
try
|
||||
${1:${VISUAL}}
|
||||
catch ${2}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet fin finally statement
|
||||
finally
|
||||
${0}
|
||||
|
||||
snippet thr throw
|
||||
throw(${1})
|
||||
${0}
|
||||
|
||||
# Messages
|
||||
snippet @i
|
||||
@info "${1}" ${0}
|
||||
|
||||
snippet @w
|
||||
@warn "${1}" ${0}
|
||||
|
||||
snippet @e
|
||||
@error "${1}" ${0}
|
||||
|
||||
snippet @d
|
||||
@debug "${1}" ${0}
|
||||
|
||||
snippet @t @testset with @test
|
||||
@testset "${1}" begin
|
||||
${2}
|
||||
@test ${0}
|
||||
end
|
||||
|
||||
snippet @tt @testset with @test_throws
|
||||
@testset "${1}" begin
|
||||
${2}
|
||||
@test_throws ${0}
|
||||
end
|
@ -1,41 +0,0 @@
|
||||
snippet fun
|
||||
fun ${1:name}(${2}): ${3:String} {
|
||||
${4}
|
||||
}
|
||||
snippet pfun
|
||||
private fun ${1:name}(${2}): ${3:String} {
|
||||
${4}
|
||||
}
|
||||
snippet main
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
${0}
|
||||
}
|
||||
snippet ret
|
||||
return ${0}
|
||||
snippet whe
|
||||
when (${1:${VISUAL}}) {
|
||||
${2} -> ${3}
|
||||
}
|
||||
snippet cla
|
||||
class ${1} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet cobj
|
||||
companion object {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet obj
|
||||
object ${1} {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if (${1}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
@ -1,242 +0,0 @@
|
||||
#resource controller
|
||||
snippet l_rsc
|
||||
/*!
|
||||
* \class $1
|
||||
*
|
||||
* \author ${3:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
class ${1:`!v expand('%:t:r')`} extends ${2:BaseController} {
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
public function index() {
|
||||
}
|
||||
|
||||
public function create() {
|
||||
}
|
||||
|
||||
public function store() {
|
||||
}
|
||||
|
||||
public function show($id) {
|
||||
}
|
||||
|
||||
public function edit($id) {
|
||||
}
|
||||
|
||||
public function update($id) {
|
||||
}
|
||||
|
||||
public function destroy($id) {
|
||||
}
|
||||
}
|
||||
#service service provider
|
||||
snippet l_ssp
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${3:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Services};
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} extends ServiceProvider {
|
||||
|
||||
public function register() {
|
||||
$this->app->bind('${4}Service', function ($app) {
|
||||
return new ${5}(
|
||||
$app->make('Repositories\\${6}Interface')
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
#repository service provider
|
||||
snippet l_rsp
|
||||
/*!
|
||||
* \namespace $2
|
||||
* \class $3
|
||||
*
|
||||
* \author ${4:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${2:Repositories\\${1:}};
|
||||
|
||||
use Entities\\$1;
|
||||
use $2\\$1Repository;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ${3:`!v expand('%:t:r')`} extends ServiceProvider {
|
||||
/*!
|
||||
* \var defer
|
||||
* \brief Defer service
|
||||
*/
|
||||
protected $defer = ${5:true};
|
||||
|
||||
public function register() {
|
||||
$this->app->bind('$2\\$1Interface', function($app) {
|
||||
return new $1Repository(new $1());
|
||||
});
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief If $defer == true need this fn
|
||||
*/
|
||||
public function provides() {
|
||||
return ['$2\\$1Interface'];
|
||||
}
|
||||
}
|
||||
#model
|
||||
snippet l_md
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${3:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Entities};
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} extends \Eloquent {
|
||||
protected $table = '${4:`!p snip.rv = t[2].lower()`}';
|
||||
|
||||
public $timestamps = ${5:false};
|
||||
|
||||
protected $hidden = array(${6});
|
||||
|
||||
protected $guarded = array(${7:'id'});
|
||||
}
|
||||
#abstract repository
|
||||
snippet l_ar
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
* \implements $3
|
||||
*
|
||||
* \author ${4:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Repositories};
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
abstract class ${2:`!v expand('%:t:r')`} implements ${3:BaseRepositoryInterface} {
|
||||
protected $model;
|
||||
|
||||
/*!
|
||||
* \fn __construct
|
||||
*
|
||||
* \brief Take the model
|
||||
*/
|
||||
|
||||
public function __construct(Model $model) {
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn all
|
||||
*
|
||||
* \return Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function all($columns = array('*')) {
|
||||
return $this->model->all()->toArray();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn create
|
||||
*
|
||||
* \return Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public function create(array $attributes) {
|
||||
return $this->model->create($attributes);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn destroy
|
||||
*
|
||||
* \return int
|
||||
*/
|
||||
public function destroy($ids) {
|
||||
return $this->model->destroy($ids);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \fn find
|
||||
*
|
||||
* \return mixed
|
||||
*/
|
||||
public function find($id, $columns = array('*')) {
|
||||
return $this->model->find($id, $columns);
|
||||
}
|
||||
}
|
||||
|
||||
#repository
|
||||
snippet l_r
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $3
|
||||
* \implements $4
|
||||
*
|
||||
* \author ${5:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Repositories\\${2}};
|
||||
|
||||
class ${3:`!v expand('%:t:r')`} extends \\${6} implements ${4:$3RepositoryInterface} {
|
||||
${7}
|
||||
}
|
||||
#service
|
||||
snippet l_s
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${6:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace Services\\${1};
|
||||
|
||||
use ${3:Repositories\\${4:Interface}};
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} {
|
||||
protected $${5:repo};
|
||||
|
||||
/*!
|
||||
* \fn __construct
|
||||
*/
|
||||
public function __construct($4 $repo) {
|
||||
$this->$5 = $repo;
|
||||
}
|
||||
}
|
||||
#facade
|
||||
snippet l_f
|
||||
/*!
|
||||
* \namespace $1
|
||||
* \class $2
|
||||
*
|
||||
* \author ${5:`!v g:snips_author`}
|
||||
* \date `!v strftime('%d-%m-%y')`
|
||||
*/
|
||||
|
||||
namespace ${1:Services};
|
||||
|
||||
use \Illuminate\Support\Facades\Facade;
|
||||
|
||||
class ${2:`!v expand('%:t:r')`} extends Facade {
|
||||
/*!
|
||||
* \fn getFacadeAccessor
|
||||
*
|
||||
* \return string
|
||||
*/
|
||||
protected static function getFacadeAccessor() { return '${4:${3}Service}'; }
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
# Ledger <http://ledger-cli.org/>
|
||||
snippet ent
|
||||
`strftime("%Y/%m/%d")` ${1:transaction}
|
||||
${2:account} ${3:value}
|
||||
${0:account}
|
@ -1,18 +0,0 @@
|
||||
snippet defmo
|
||||
(defmodule ${1:`vim_snippets#Filename()`}
|
||||
(export ${2:all}))
|
||||
$0
|
||||
snippet def
|
||||
(defun $1 ($2)
|
||||
$0)
|
||||
snippet ltest
|
||||
(defmodule ${1:`vim_snippets#Filename()`}
|
||||
(behaviour ltest-unit)
|
||||
(export all))
|
||||
|
||||
(include-lib "ltest/include/ltest-macros.lfe")
|
||||
|
||||
$0
|
||||
snippet test
|
||||
(deftest $1
|
||||
$0)
|
@ -1,472 +0,0 @@
|
||||
# Port of Shopify Liquid Template Snippets
|
||||
# https://marketplace.visualstudio.com/items?itemName=killalau.vscode-liquid-snippets
|
||||
|
||||
snippet if
|
||||
{% if $1 %}
|
||||
${0:${VISUAL}}
|
||||
{% endif %}
|
||||
snippet else
|
||||
{% else %}
|
||||
snippet elsif
|
||||
{% elsif $1 %}
|
||||
snippet ifelse
|
||||
{% if $1 %}
|
||||
${2}
|
||||
{% else %}
|
||||
${0}
|
||||
{% endif %}
|
||||
snippet unless
|
||||
{% unless $1 %}
|
||||
${0:${VISUAL}}
|
||||
{% endunless %}
|
||||
snippet case
|
||||
{% case ${1:variable} %}
|
||||
{% when $2 %}
|
||||
${3}
|
||||
{% else %}
|
||||
${0}
|
||||
{% endcase %}
|
||||
snippet when
|
||||
{% when $1 %}
|
||||
${0:${VISUAL}}
|
||||
snippet cycle
|
||||
{% cycle '${1:odd}', '${2:even}' %}
|
||||
snippet cyclegroup
|
||||
{% cycle '${1:group name}': '${2:odd}', '${3:even}' %}
|
||||
snippet for
|
||||
{% for ${1:item} in ${2:collection} %}
|
||||
${0}
|
||||
{% endfor %}
|
||||
snippet limit
|
||||
limit: ${1:5}
|
||||
snippet offset
|
||||
offset: ${1:0}
|
||||
snippet reversed
|
||||
reversed
|
||||
snippet break
|
||||
{% break %}
|
||||
snippet continue
|
||||
{% continue %}
|
||||
snippet tablerow
|
||||
{% tablerow ${1:item} in ${2:collection} cols: ${3:2} %}
|
||||
${0}
|
||||
{% endtablerow %}
|
||||
snippet assign
|
||||
{% assign ${1:variable} = ${0:value} %}
|
||||
snippet increment
|
||||
{% increment ${0:variable} %}
|
||||
snippet decrement
|
||||
{% decrement ${0:variable} %}
|
||||
snippet capture
|
||||
{% capture ${1:variable} %}${0}{% endcapture %}
|
||||
snippet include
|
||||
{% include '${0:snippet}' %}
|
||||
snippet includewith
|
||||
{% include '${1:snippet}', ${2:variable}: ${0:value} %}
|
||||
snippet render
|
||||
{% render '${0:snippet}' %}
|
||||
snippet renderwith
|
||||
{% render '${1:snippet}', ${2:variable}: ${0:value} %}
|
||||
snippet section
|
||||
{% section '${1:snippet}' %}
|
||||
snippet raw
|
||||
{% raw %}${0}{% endraw %}
|
||||
snippet layout
|
||||
{% layout '${1:layout}' %}
|
||||
snippet layoutnone
|
||||
{% layout none %}
|
||||
snippet paginate
|
||||
{% paginate ${1:collection.products} by ${2:12} %}
|
||||
{% for ${3:product} in $1 %}
|
||||
${0}
|
||||
{% endfor %}
|
||||
{% endpaginate %}
|
||||
snippet schema
|
||||
{% schema %}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
{% endschema %}
|
||||
snippet stylesheet
|
||||
{% stylesheet %}
|
||||
${0}
|
||||
{% endstylesheet %}
|
||||
snippet stylesheet_scss
|
||||
{% stylesheet '${1:scss}' %}
|
||||
${0}
|
||||
{% endstylesheet %}
|
||||
snippet javascript
|
||||
{% javascript %}
|
||||
${0}
|
||||
{% endjavascript %}
|
||||
snippet comment-
|
||||
{%- comment -%}${0:${VISUAL}}{%- endcomment -%}
|
||||
snippet if-
|
||||
{%- if $1 -%}
|
||||
${0:${VISUAL}}
|
||||
{%- endif -%}
|
||||
snippet else-
|
||||
{%- else -%}
|
||||
snippet elsif-
|
||||
{%- elsif $1 -%}
|
||||
snippet ifelse-
|
||||
{%- if $1 -%}
|
||||
${2}
|
||||
{%- else -%}
|
||||
${0}
|
||||
{%- endif -%}
|
||||
snippet unless-
|
||||
{%- unless $1 -%}
|
||||
${0:${VISUAL}}
|
||||
{%- endunless -%}
|
||||
snippet case-
|
||||
{%- case ${1:variable} -%}
|
||||
{%- when $2 -%}
|
||||
${3}
|
||||
{%- else -%}
|
||||
${0}
|
||||
{%- endcase -%}
|
||||
snippet when-
|
||||
{%- when $1 -%}
|
||||
${0:${VISUAL}}
|
||||
snippet cycle-
|
||||
{%- cycle '${1:odd}', '${2:even}' -%}
|
||||
snippet cyclegroup-
|
||||
{%- cycle '${1:group name}': '${2:odd}', '${3:even}' -%}
|
||||
snippet for-
|
||||
{%- for ${1:item} in ${2:collection} -%}
|
||||
${0}
|
||||
{%- endfor -%}
|
||||
snippet continue-
|
||||
{%- continue -%}
|
||||
snippet tablerow-
|
||||
{%- tablerow ${1:item} in ${2:collection} cols: ${3:2} -%}
|
||||
${0}
|
||||
{%- endtablerow -%}
|
||||
snippet assign-
|
||||
{%- assign ${1:variable} = ${0:value} -%}
|
||||
snippet capture-
|
||||
{%- capture ${1:variable} -%}${0}{%- endcapture -%}
|
||||
snippet include-
|
||||
{%- include '${0:snippet}' -%}
|
||||
snippet includewith-
|
||||
{%- include '${1:snippet}', ${2:variable}: ${0:value} -%}
|
||||
snippet render-
|
||||
{%- render '${0:snippet}' -%}
|
||||
snippet renderwith-
|
||||
{%- render '${1:snippet}', ${2:variable}: ${0:value} -%}
|
||||
snippet section-
|
||||
{%- section '${1:snippet}' -%}
|
||||
snippet layout-
|
||||
{%- layout '${1:layout}' -%}
|
||||
snippet layoutnone-
|
||||
{%- layout none -%}
|
||||
snippet paginate-
|
||||
{%- paginate ${1:collection.products} by ${2:12} -%}
|
||||
{%- for ${3:product} in $1 -%}
|
||||
${0}
|
||||
{%- endfor -%}
|
||||
{%- endpaginate -%}
|
||||
snippet join
|
||||
| join: '${1:, }'
|
||||
snippet first
|
||||
| first
|
||||
snippet last
|
||||
| last
|
||||
snippet concat
|
||||
| concat: ${1:array}
|
||||
snippet map
|
||||
| map: '${1:key}'
|
||||
snippet reverse
|
||||
| reverse
|
||||
snippet size
|
||||
| size
|
||||
snippet sort
|
||||
| sort: '${1:key}'
|
||||
snippet uniq
|
||||
| uniq
|
||||
snippet img_tag
|
||||
| img_tag
|
||||
snippet img_tag_param
|
||||
| img_tag: '${1:alt}', '${2:class}'
|
||||
snippet script_tag
|
||||
| script_tag
|
||||
snippet stylesheet_tag
|
||||
| stylesheet_tag
|
||||
snippet abs
|
||||
| abs
|
||||
snippet ceil
|
||||
| ceil
|
||||
snippet divided_by
|
||||
| divided_by: ${1:2}
|
||||
snippet floor
|
||||
| floor
|
||||
snippet minus
|
||||
| minus: ${1:1}
|
||||
snippet plus
|
||||
| plus: ${1:1}
|
||||
snippet round
|
||||
| round: ${1:0}
|
||||
snippet times
|
||||
| times: ${1:1}
|
||||
snippet modulo
|
||||
| modulo: ${1:2}
|
||||
snippet money
|
||||
| money
|
||||
snippet money_with_currency
|
||||
| money_with_currency
|
||||
snippet money_without_trailing_zeros
|
||||
| money_without_trailing_zeros
|
||||
snippet money_without_currency
|
||||
| money_without_currency
|
||||
snippet append
|
||||
| append: '${1:string}'
|
||||
snippet camelcase
|
||||
| camelcase
|
||||
snippet capitalize
|
||||
| capitalize
|
||||
snippet downcase
|
||||
| downcase
|
||||
snippet escape
|
||||
| escape
|
||||
snippet handleize
|
||||
| handleize
|
||||
snippet md5
|
||||
| md5
|
||||
snippet newline_to_br
|
||||
| newline_to_br
|
||||
snippet pluralize
|
||||
| pluralize: '${1:item}', '${2:items}'
|
||||
snippet prepend
|
||||
| prepend: '${1:string}'
|
||||
snippet remove
|
||||
| remove: '${1:string}'
|
||||
snippet remove_first
|
||||
| remove_first: '${1:string}'
|
||||
snippet replace
|
||||
| replace: '${1:target}', '${2:replace}'
|
||||
snippet replace_first
|
||||
| replace_first: '${1:target}', '${2:replace}'
|
||||
snippet slice
|
||||
| slice: ${1:0}, ${2:5}
|
||||
snippet slice_single
|
||||
| slice: ${1:at}
|
||||
snippet split
|
||||
| split: '${1:,}'
|
||||
snippet strip
|
||||
| strip
|
||||
snippet lstrip
|
||||
| lstrip
|
||||
snippet rstrip
|
||||
| rstrip
|
||||
snippet strip_html
|
||||
| strip_html
|
||||
snippet strip_newlines
|
||||
| strip_newlines
|
||||
snippet truncate
|
||||
| truncate: ${1:20}, '${2:...}'
|
||||
snippet truncatewords
|
||||
| truncatewords: ${1:5}, '${2:...}'
|
||||
snippet upcase
|
||||
| upcase
|
||||
snippet url_encode
|
||||
| url_encode
|
||||
snippet url_escape
|
||||
| url_escape
|
||||
snippet url_param_escape
|
||||
| url_param_escape
|
||||
snippet asset_url
|
||||
| asset_url
|
||||
snippet asset_img_url
|
||||
| asset_img_url: '${1:medium}'
|
||||
snippet img_url
|
||||
| img_url: '${1:medium}'
|
||||
snippet _schema
|
||||
{% schema %}
|
||||
{
|
||||
"name": "${1}",
|
||||
"class": "${2}",
|
||||
"settings": [
|
||||
${0}
|
||||
]
|
||||
}
|
||||
{% endschema %}
|
||||
snippet _blocks
|
||||
"blocks": [
|
||||
{
|
||||
"type": "${1}",
|
||||
"name": "${2}",
|
||||
"settings": [
|
||||
${0}
|
||||
]
|
||||
}
|
||||
]
|
||||
snippet _text
|
||||
{
|
||||
"type": "text",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"default": "${3}",
|
||||
"info": "${4}",
|
||||
"placeholder": "${0}"
|
||||
}
|
||||
snippet _textarea
|
||||
{
|
||||
"type": "textarea",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"default": "${3}",
|
||||
"info": "${4}",
|
||||
"placeholder": "${0}"
|
||||
}
|
||||
snippet _image_picker
|
||||
{
|
||||
"type": "image_picker",
|
||||
"id": "${1}",
|
||||
"label": "${0}"
|
||||
}
|
||||
snippet _radio
|
||||
{
|
||||
"type": "radio",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"options": [
|
||||
{ "value": "${5}", "label": "${0}" }
|
||||
],
|
||||
"default": "${3}",
|
||||
"info": "${4}"
|
||||
}
|
||||
snippet _select
|
||||
{
|
||||
"type": "select",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"options": [
|
||||
{
|
||||
"group": "${5}",
|
||||
"value": "${6}",
|
||||
"label": "${0}"
|
||||
}
|
||||
],
|
||||
"default": "${3}",
|
||||
"info": "${4}"
|
||||
}
|
||||
snippet _checkbox
|
||||
{
|
||||
"type": "checkbox",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"default": ${3:true},
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _range
|
||||
{
|
||||
"type": "range",
|
||||
"id": "${1}",
|
||||
"min": ${2},
|
||||
"max": ${3},
|
||||
"step": ${4},
|
||||
"unit": "${5}",
|
||||
"label": "${6}",
|
||||
"default": ${0}
|
||||
}
|
||||
snippet _color
|
||||
{
|
||||
"type": "color",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"default": "${3}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _font
|
||||
{
|
||||
"type": "font_picker",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${3}",
|
||||
"default": "${0:helvetica_n4}"
|
||||
}
|
||||
snippet _collection
|
||||
{
|
||||
"type": "collection",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _product
|
||||
{
|
||||
"type": "product",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _blog
|
||||
{
|
||||
"type": "blog",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _page
|
||||
{
|
||||
"type": "page",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _link_list
|
||||
{
|
||||
"type": "link_list",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _url
|
||||
{
|
||||
"type": "url",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _video
|
||||
{
|
||||
"type": "video_url",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"accept": ["youtube", "vimeo"${0}],
|
||||
"default": "${3}",
|
||||
"info": "${4}",
|
||||
"placeholder": "${5}"
|
||||
}
|
||||
snippet _richtext
|
||||
{
|
||||
"type": "richtext",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"default": "<p>${0}</p>"
|
||||
}
|
||||
snippet _html
|
||||
{
|
||||
"type": "html",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"default": "<div>${0}</div>"
|
||||
}
|
||||
snippet _article
|
||||
{
|
||||
"type": "article",
|
||||
"id": "${1}",
|
||||
"label": "${2}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _header
|
||||
{
|
||||
"type": "header",
|
||||
"content": "${1}",
|
||||
"info": "${0}"
|
||||
}
|
||||
snippet _paragraph
|
||||
{
|
||||
"type": "paragraph",
|
||||
"content": "${0}"
|
||||
}
|
@ -1,190 +0,0 @@
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet inc
|
||||
#include <${1:stdio}.h>
|
||||
# #include "..."
|
||||
snippet Inc
|
||||
#include "${1:`vim_snippets#Filename("$1.h")`}"
|
||||
# ifndef...define...endif
|
||||
snippet ndef
|
||||
#ifndef $1
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif /* ifndef $1 */
|
||||
# define
|
||||
snippet def
|
||||
#define
|
||||
# ifdef...endif
|
||||
snippet ifdef
|
||||
#ifdef ${1:FOO}
|
||||
${2:#define }
|
||||
#endif
|
||||
# if
|
||||
snippet #if
|
||||
#if ${1:FOO}
|
||||
${0:${VISUAL}}
|
||||
#endif
|
||||
# header include guard
|
||||
snippet once
|
||||
#ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`}
|
||||
|
||||
#define $1
|
||||
|
||||
${0}
|
||||
|
||||
#endif /* end of include guard: $1 */
|
||||
##
|
||||
## Control Statements
|
||||
# if
|
||||
snippet if
|
||||
if(${1:true})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if(${1:true})
|
||||
{
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
else
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if(${1:true})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if(${1:true}) ${0};
|
||||
# ternary
|
||||
snippet t Ternary: `condition ? true : false`
|
||||
$1 ? $2 : $0
|
||||
# switch
|
||||
snippet switch
|
||||
switch(${1:/* variable */})
|
||||
{
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
default:
|
||||
${6}
|
||||
}
|
||||
# switch without default
|
||||
snippet switchndef
|
||||
switch(${1:/* variable */})
|
||||
{
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
}
|
||||
# case
|
||||
snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
snippet ret
|
||||
return ${0};
|
||||
##
|
||||
## Loops
|
||||
#foreach
|
||||
snippet fore
|
||||
foreach(${1:mixed} ${2:ele} in ${3:arr})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# for
|
||||
snippet for
|
||||
for(int ${2:i} = 0; $2 < ${1:count}; $2${3:++})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for(int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++})
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while($1)
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do{
|
||||
${0:${VISUAL}}
|
||||
}while ($1);
|
||||
##
|
||||
## Functions
|
||||
# function definition
|
||||
snippet fnc
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# function definition with zero parameters
|
||||
snippet defun0
|
||||
${1:void} ${2:function_name}()
|
||||
{
|
||||
${3}
|
||||
}
|
||||
# function definition with one parameter
|
||||
snippet defun1
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# function definition with two parameters
|
||||
snippet defun2
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
|
||||
{
|
||||
${7}
|
||||
}
|
||||
# function definition with three parameters
|
||||
snippet defun3
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function declaration
|
||||
snippet fund
|
||||
${1:void} ${2:function_name}(${3});
|
||||
##
|
||||
## Input/Output
|
||||
# printf
|
||||
snippet pr
|
||||
printf("${1:%s}\n"${2});
|
||||
# fprintf (again, this isn't as nice as TextMate's version, but it works)
|
||||
snippet fpr
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${3});
|
||||
snippet prd
|
||||
printf("${1:} = %d\n", $1);
|
||||
snippet prf
|
||||
printf("${1:} = %f\n", $1);
|
||||
snippet prx
|
||||
printf("${1:} = %${2}\n", $1);
|
||||
##
|
||||
# TODO section
|
||||
snippet todo
|
||||
/*! TODO: ${1:Todo description here} */
|
||||
|
||||
## Miscellaneous
|
||||
# This is kind of convenient
|
||||
snippet .
|
||||
[${1}]
|
||||
|
||||
|
||||
##
|
||||
## MHXY
|
||||
snippet head
|
||||
// code for ${1} by `$USER` create at `strftime("%Y-%m-%d %H:%M:%S")`
|
@ -1,108 +0,0 @@
|
||||
# Closure loop
|
||||
snippet forinlet
|
||||
for ${1:name} in ${2:array}
|
||||
let $1
|
||||
${3}
|
||||
# Array comprehension
|
||||
snippet fora
|
||||
for ${1:name} in ${2:array}
|
||||
${3}
|
||||
# Object comprehension
|
||||
snippet foro
|
||||
for ${1:key}, ${2:value} of ${3:object}
|
||||
${4}
|
||||
# Range comprehension (inclusive)
|
||||
snippet forr
|
||||
for ${1:name} from ${2:start} to ${3:finish}
|
||||
${4}
|
||||
snippet forrb
|
||||
for ${1:name} from ${2:start} to ${3:finish} by ${4:step}
|
||||
${5}
|
||||
# Range comprehension (exclusive)
|
||||
snippet forrex
|
||||
for ${1:name} from ${2:start} til ${3:finish}
|
||||
${4}
|
||||
snippet forrexb
|
||||
for ${1:name} from ${2:start} til ${3:finish} by ${4:step}
|
||||
${5}
|
||||
# Function
|
||||
snippet fun
|
||||
(${1:args}) ->
|
||||
${2}
|
||||
# Function (bound)
|
||||
snippet bfun
|
||||
(${1:args}) ~>
|
||||
${2}
|
||||
# Class
|
||||
snippet cla class ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${2}
|
||||
snippet cla class .. constructor: ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
(${2:args}) ->
|
||||
${3}
|
||||
|
||||
${4}
|
||||
snippet cla class .. extends ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
${3}
|
||||
snippet cla class .. extends .. constructor: ..
|
||||
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
(${3:args}) ->
|
||||
${4}
|
||||
|
||||
${5}
|
||||
# If
|
||||
snippet if
|
||||
if $1
|
||||
${2}
|
||||
# If __ Else
|
||||
snippet ife
|
||||
if $1
|
||||
${2}
|
||||
else
|
||||
${3}
|
||||
# Else if
|
||||
snippet elif
|
||||
else if $1
|
||||
${2}
|
||||
# Ternary If
|
||||
snippet ifte
|
||||
if $1 then $2 else $0
|
||||
# Unless
|
||||
snippet unl
|
||||
$1 unless $0
|
||||
# Switch
|
||||
snippet swi
|
||||
switch ${1:object}
|
||||
case ${2:value}
|
||||
${3}
|
||||
default void
|
||||
snippet mat
|
||||
match ${1:object}
|
||||
| ${2:value} => ${3}
|
||||
| otherwise => void
|
||||
|
||||
# Log
|
||||
snippet log
|
||||
console.log ${1}
|
||||
# stringify
|
||||
snippet str
|
||||
JSON.stringify ${1}, void, 2
|
||||
|
||||
# Try __ Catch
|
||||
snippet try
|
||||
try
|
||||
${1:${VISUAL}}
|
||||
catch ${2:error}
|
||||
${3}
|
||||
# Require
|
||||
snippet req
|
||||
${2:$1} = require '${1}'${3}
|
||||
# Require!
|
||||
snippet req!
|
||||
require! ${1}
|
||||
|
||||
# Export
|
||||
snippet exp
|
||||
${1:root} = exports ? this
|
@ -1,72 +0,0 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env lua
|
||||
$1
|
||||
snippet local
|
||||
local ${1:x} = ${0:1}
|
||||
snippet fun
|
||||
function ${1:fname}(${2:...})
|
||||
$0
|
||||
end
|
||||
snippet for
|
||||
for ${1:i}=${2:1},${3:10} do
|
||||
${0:print(i)}
|
||||
end
|
||||
snippet forp
|
||||
for ${1:i},${2:v} in pairs(${3:table_name}) do
|
||||
$0
|
||||
end
|
||||
snippet fori
|
||||
for ${1:i},${2:v} in ipairs(${3:table_name}) do
|
||||
$0
|
||||
end
|
||||
snippet if
|
||||
if $1 then
|
||||
$2
|
||||
end
|
||||
snippet ife
|
||||
if $1 then
|
||||
${2:-- if condition}
|
||||
else
|
||||
${0:-- else}
|
||||
end
|
||||
snippet elif
|
||||
elseif $1 then
|
||||
$0
|
||||
snippet repeat
|
||||
repeat
|
||||
$1
|
||||
until $0
|
||||
snippet while
|
||||
while $1 do
|
||||
$0
|
||||
end
|
||||
snippet wh
|
||||
while ${1:true} do
|
||||
${0}
|
||||
end
|
||||
snippet wht
|
||||
while true do
|
||||
${0}
|
||||
end
|
||||
snippet print
|
||||
print("${1:string}")
|
||||
snippet pr
|
||||
print($0)
|
||||
snippet prs
|
||||
print("$0")
|
||||
snippet prf
|
||||
print(string.format("${1:%s}"$0))
|
||||
snippet wr
|
||||
io.write($0)
|
||||
snippet wrs
|
||||
io.write("$0")
|
||||
snippet wrf
|
||||
io.write(string.format("${1:%s}"$0))
|
||||
snippet fwr
|
||||
io.${1:stderr}:write($0)
|
||||
snippet fwrs
|
||||
io.${1:stderr}:write("$0")
|
||||
snippet fwrf
|
||||
io.${1:stderr}:write(string.format("${2:%s}"$0))
|
||||
snippet im
|
||||
import "${1:import file}"
|
@ -1,50 +0,0 @@
|
||||
# base
|
||||
snippet base
|
||||
.PHONY: clean, mrproper
|
||||
CC = gcc
|
||||
CFLAGS = -g -Wall
|
||||
|
||||
all: $1
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
${1:out}: $1.o
|
||||
$(CC) $(CFLAGS) -o $@ $+
|
||||
|
||||
clean:
|
||||
rm -f *.o core.*
|
||||
|
||||
mrproper: clean
|
||||
rm -f $1
|
||||
# add
|
||||
snippet add
|
||||
${1:out}: $1.o
|
||||
$(CC) $(CFLAGS) -o $@ $+
|
||||
# print
|
||||
snippet print
|
||||
print-%: ; @echo $*=$($*)
|
||||
# ifeq
|
||||
snippet if
|
||||
ifeq (${1:cond0}, ${2:cond1})
|
||||
${0:${VISUAL}}
|
||||
endif
|
||||
# ifeq ... else ... endif
|
||||
snippet ife
|
||||
ifeq (${1:cond0}, ${2:cond1})
|
||||
${3:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
endif
|
||||
# else ...
|
||||
snippet el
|
||||
else
|
||||
${0:${VISUAL}}
|
||||
# .DEFAULT_GOAL := target
|
||||
snippet default
|
||||
.DEFAULT_GOAL := ${1}
|
||||
# help target for self-documented Makefile
|
||||
snippet help
|
||||
help: ## Prints help for targets with comments
|
||||
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}'
|
||||
${0}
|
@ -1,54 +0,0 @@
|
||||
snippet def
|
||||
<%def name="${1:name}">
|
||||
${0:}
|
||||
</%def>
|
||||
snippet call
|
||||
<%call expr="${1:name}">
|
||||
${0:}
|
||||
</%call>
|
||||
snippet doc
|
||||
<%doc>
|
||||
${0:}
|
||||
</%doc>
|
||||
snippet text
|
||||
<%text>
|
||||
${0:}
|
||||
</%text>
|
||||
snippet for
|
||||
% for ${1:i} in ${2:iter}:
|
||||
${0:}
|
||||
% endfor
|
||||
snippet if if
|
||||
% if $1:
|
||||
${0:}
|
||||
% endif
|
||||
snippet ife if/else
|
||||
% if $1:
|
||||
${2:}
|
||||
% else:
|
||||
${0:}
|
||||
% endif
|
||||
snippet try
|
||||
% try:
|
||||
${1:${VISUAL}}
|
||||
% except${2:}:
|
||||
${0:pass}
|
||||
% endtry
|
||||
snippet wh
|
||||
% while ${1:}:
|
||||
${0:}
|
||||
% endwhile
|
||||
snippet $
|
||||
${ ${0:} }
|
||||
snippet <%
|
||||
<% ${0:} %>
|
||||
snippet <!%
|
||||
<!% ${0:} %>
|
||||
snippet inherit
|
||||
<%inherit file="${0:filename}" />
|
||||
snippet include
|
||||
<%include file="${0:filename}" />
|
||||
snippet namespace
|
||||
<%namespace file="${0:name}" />
|
||||
snippet page
|
||||
<%page args="${0:}" />
|
@ -1,156 +0,0 @@
|
||||
# Markdown
|
||||
|
||||
# Includes octopress (http://octopress.org/) snippets
|
||||
|
||||
# The suffix `c` stands for "Clipboard".
|
||||
|
||||
snippet [
|
||||
[${1:text}](https://${2:address})
|
||||
snippet [*
|
||||
[${1:link}](${2:`@*`})
|
||||
snippet [c
|
||||
[${1:link}](${2:`@+`})
|
||||
snippet ["
|
||||
[${1:text}](https://${2:address} "${3:title}")
|
||||
snippet ["*
|
||||
[${1:link}](${2:`@*`} "${3:title}")
|
||||
snippet ["c
|
||||
[${1:link}](${2:`@+`} "${3:title}")
|
||||
snippet [:
|
||||
[${1:id}]: https://${2:url}
|
||||
|
||||
snippet [:*
|
||||
[${1:id}]: ${2:`@*`}
|
||||
|
||||
snippet [:c
|
||||
[${1:id}]: ${2:`@+`}
|
||||
|
||||
snippet [:"
|
||||
[${1:id}]: https://${2:url} "${3:title}"
|
||||
|
||||
snippet [:"*
|
||||
[${1:id}]: ${2:`@*`} "${3:title}"
|
||||
|
||||
snippet [:"c
|
||||
[${1:id}]: ${2:`@+`} "${3:title}"
|
||||
|
||||
snippet 
|
||||
snippet 
|
||||
snippet 
|
||||
snippet 
|
||||
snippet 
|
||||
snippet 
|
||||
snippet ![:
|
||||
![${1:id}]: ${2:url}
|
||||
|
||||
snippet ![:*
|
||||
![${1:id}]: ${2:`@*`}
|
||||
|
||||
snippet ![:"
|
||||
![${1:id}]: ${2:url} "${3:title}"
|
||||
|
||||
snippet ![:"*
|
||||
![${1:id}]: ${2:`@*`} "${3:title}"
|
||||
|
||||
snippet ![:"c
|
||||
![${1:id}]: ${2:`@+`} "${3:title}"
|
||||
|
||||
snippet <
|
||||
<http://${1:url}>
|
||||
snippet <*
|
||||
<`@*`>
|
||||
snippet <c
|
||||
<`@+`>
|
||||
snippet ** Bold
|
||||
**$0**
|
||||
snippet __ Bold
|
||||
__$0__
|
||||
snippet --- Front matter
|
||||
---
|
||||
$0
|
||||
---
|
||||
snippet ====
|
||||
`repeat('=', strlen(getline(line('.') - 3)))`
|
||||
|
||||
${0}
|
||||
snippet -
|
||||
- ${0}
|
||||
snippet ----
|
||||
`repeat('-', strlen(getline(line('.') - 3)))`
|
||||
|
||||
${0}
|
||||
snippet blockquote
|
||||
{% blockquote %}
|
||||
${0:quote}
|
||||
{% endblockquote %}
|
||||
|
||||
snippet blockquote-author
|
||||
{% blockquote ${1:author}, ${2:title} %}
|
||||
${0:quote}
|
||||
{% endblockquote %}
|
||||
|
||||
snippet blockquote-link
|
||||
{% blockquote ${1:author} ${2:URL} ${3:link_text} %}
|
||||
${0:quote}
|
||||
{% endblockquote %}
|
||||
|
||||
snippet ```
|
||||
\`\`\`${1}
|
||||
${0:${VISUAL}}
|
||||
\`\`\`
|
||||
|
||||
# Language.
|
||||
snippet ```l
|
||||
\`\`\`${1:language}
|
||||
${2:code}
|
||||
\`\`\`
|
||||
|
||||
snippet codeblock-short
|
||||
{% codeblock %}
|
||||
${0:code_snippet}
|
||||
{% endcodeblock %}
|
||||
|
||||
snippet codeblock-full
|
||||
{% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %}
|
||||
${0:code_snippet}
|
||||
{% endcodeblock %}
|
||||
|
||||
snippet gist-full
|
||||
{% gist ${1:gist_id} ${0:filename} %}
|
||||
|
||||
snippet gist-short
|
||||
{% gist ${0:gist_id} %}
|
||||
|
||||
snippet img
|
||||
{% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${0:alt_text} %}
|
||||
|
||||
snippet youtube
|
||||
{% youtube ${0:video_id} %}
|
||||
|
||||
snippet tb
|
||||
| ${0:factors} | ${1:a} | ${2:b} |
|
||||
| ------------- |------------- | ------- |
|
||||
| ${3:f1} | Y | N |
|
||||
| ${4:f2} | Y | N |
|
||||
|
||||
# The quote should appear only once in the text. It is inherently part of it.
|
||||
# See http://octopress.org/docs/plugins/pullquote/ for more info.
|
||||
|
||||
snippet pullquote
|
||||
{% pullquote %}
|
||||
${1:text} {" ${2:quote} "} ${0:text}
|
||||
{% endpullquote %}
|
||||
|
||||
# Definition lists
|
||||
snippet : Definition list
|
||||
$1
|
||||
: $0
|
||||
snippet :: Alternate definition list
|
||||
$1
|
||||
- $0
|
@ -1,64 +0,0 @@
|
||||
snippet if if
|
||||
if ${1}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet ife if ... else
|
||||
if ${1}
|
||||
${2}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet el else
|
||||
else
|
||||
${0}
|
||||
|
||||
snippet eif elsif
|
||||
elseif ${1}
|
||||
${0}
|
||||
|
||||
snippet wh while
|
||||
while ${1}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet for for
|
||||
for ${1:i} = ${2:1:n}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet parfor parfor
|
||||
parfor ${1:i} = ${2:1:n}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet fun function
|
||||
function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2})
|
||||
${0}
|
||||
|
||||
snippet try try ... catch
|
||||
try
|
||||
${1}
|
||||
catch ${2:err}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet switch switch
|
||||
switch ${1:n}
|
||||
case ${2:0}
|
||||
${0}
|
||||
end
|
||||
|
||||
snippet @ anonymous function
|
||||
@(${1:x}) ${0:x*x}
|
||||
|
||||
snippet cl class
|
||||
classdef ${1:`vim_snippets#Filename("$1", "class_name")`}
|
||||
properties
|
||||
${2}
|
||||
end
|
||||
methods
|
||||
${0}
|
||||
end
|
||||
end
|
@ -1,15 +0,0 @@
|
||||
snippet if # {{#value}} ... {{/value}}
|
||||
{{#${1:value}}}
|
||||
${0:${VISUAL}}
|
||||
{{/$1}}
|
||||
snippet ifn # {{^value}} ... {{/value}}
|
||||
{{^${1:value}}}
|
||||
${0:${VISUAL}}
|
||||
{{/$1}}
|
||||
snippet ife # {{#value}} ... {{/value}} {{^value}} ... {{/value}}
|
||||
{{#${1:value}}}
|
||||
${2:${VISUAL}}
|
||||
{{/$1}}
|
||||
{{^$1}}
|
||||
${3}
|
||||
{{/$1}}
|
@ -1,247 +0,0 @@
|
||||
# #import <...>
|
||||
snippet Imp
|
||||
#import <${1:Cocoa/Cocoa.h}>
|
||||
# #import "..."
|
||||
snippet imp
|
||||
#import "${1:`vim_snippets#Filename()`.h}"
|
||||
# @selector(...)
|
||||
snippet sel
|
||||
@selector(${1:method}:)
|
||||
# @"..." string
|
||||
snippet s
|
||||
@"${1}"
|
||||
# Object
|
||||
snippet o
|
||||
${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};
|
||||
# NSLog(...)
|
||||
snippet log
|
||||
NSLog(@"${1:%@}"${2});
|
||||
# Class
|
||||
snippet objc
|
||||
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation $1
|
||||
${0}
|
||||
@end
|
||||
# Class Interface
|
||||
snippet int
|
||||
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{${3}
|
||||
}
|
||||
${0}
|
||||
@end
|
||||
snippet @interface
|
||||
@interface ${1:`vim_snippets#Filename('', 'someClass')`} : ${2:NSObject}
|
||||
{${3}
|
||||
}
|
||||
${0}
|
||||
@end
|
||||
# Class Implementation
|
||||
snippet impl
|
||||
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
|
||||
${0}
|
||||
@end
|
||||
snippet @implementation
|
||||
@implementation ${1:`vim_snippets#Filename('', 'someClass')`}
|
||||
${0}
|
||||
@end
|
||||
# Protocol
|
||||
snippet pro
|
||||
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${0}
|
||||
@end
|
||||
snippet @protocol
|
||||
@protocol ${1:`vim_snippets#Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
|
||||
${0}
|
||||
@end
|
||||
# init Definition
|
||||
snippet init
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
${0}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
# dealloc Definition
|
||||
snippet dealloc
|
||||
- (void) dealloc
|
||||
{
|
||||
${0:deallocations}
|
||||
[super dealloc];
|
||||
}
|
||||
snippet su
|
||||
[super ${1:init}]
|
||||
snippet ibo
|
||||
IBOutlet ${1:NSSomeClass} *${2:$1};
|
||||
# Category
|
||||
snippet cat
|
||||
@interface ${1:NSObject} (${2:MyCategory})
|
||||
@end
|
||||
|
||||
@implementation $1 ($2)
|
||||
${0}
|
||||
@end
|
||||
# Category Interface
|
||||
snippet cath
|
||||
@interface ${1:`vim_snippets#Filename('$1', 'NSObject')`} (${2:MyCategory})
|
||||
${0}
|
||||
@end
|
||||
# Method
|
||||
snippet m
|
||||
- (${1:id})${2:method}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# Method declaration
|
||||
snippet md
|
||||
- (${1:id})${2:method};
|
||||
# IBAction declaration
|
||||
snippet ibad
|
||||
- (IBAction)${1:method}:(${2:id})sender;
|
||||
# IBAction method
|
||||
snippet iba
|
||||
- (IBAction)${1:method}:(${2:id})sender
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# awakeFromNib method
|
||||
snippet wake
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# Class Method
|
||||
snippet M
|
||||
+ (${1:id})${2:method}
|
||||
{
|
||||
${0:return nil;}
|
||||
}
|
||||
# Sub-method (Call super)
|
||||
snippet sm
|
||||
- (${1:id})${2:method}
|
||||
{
|
||||
[super $2];${0}
|
||||
return self;
|
||||
}
|
||||
# Accessor Methods For:
|
||||
# Object
|
||||
snippet objacc
|
||||
- (${1:id})${2:thing}
|
||||
{
|
||||
return $2;
|
||||
}
|
||||
|
||||
- (void)set$2:($1)${3:new$2}
|
||||
{
|
||||
[$3 retain];
|
||||
[$2 release];
|
||||
$2 = $3;
|
||||
}
|
||||
# for (object in array)
|
||||
snippet forin
|
||||
for (${1:Class} *${2:some$1} in ${3:array}) {
|
||||
${0}
|
||||
}
|
||||
snippet fore
|
||||
for (${1:object} in ${2:array}) {
|
||||
${0:statements}
|
||||
}
|
||||
snippet forarray
|
||||
unsigned int ${1:object}Count = [${2:array} count];
|
||||
|
||||
for (unsigned int index = 0; index < $1Count; index++) {
|
||||
${3:id} $1 = [$2 $1AtIndex:index];
|
||||
${0}
|
||||
}
|
||||
snippet fora
|
||||
unsigned int ${1:object}Count = [${2:array} count];
|
||||
|
||||
for (unsigned int index = 0; index < $1Count; index++) {
|
||||
${3:id} $1 = [$2 $1AtIndex:index];
|
||||
${0}
|
||||
}
|
||||
# Try / Catch Block
|
||||
snippet @try
|
||||
@try {
|
||||
${1:statements}
|
||||
}
|
||||
@catch (NSException * e) {
|
||||
${2:handler}
|
||||
}
|
||||
@finally {
|
||||
${0:statements}
|
||||
}
|
||||
snippet @catch
|
||||
@catch (${1:exception}) {
|
||||
${0:handler}
|
||||
}
|
||||
snippet @finally
|
||||
@finally {
|
||||
${0:statements}
|
||||
}
|
||||
# IBOutlet
|
||||
# @property (Objective-C 2.0)
|
||||
snippet prop
|
||||
@property (${1:retain}) ${2:NSSomeClass} ${3:*$2};
|
||||
# @synthesize (Objective-C 2.0)
|
||||
snippet syn
|
||||
@synthesize ${1:property};
|
||||
# [[ alloc] init]
|
||||
snippet alloc
|
||||
[[${1:foo} alloc] init${2}];
|
||||
snippet a
|
||||
[[${1:foo} alloc] init${2}];
|
||||
# retain
|
||||
snippet ret
|
||||
[${1:foo} retain];
|
||||
# release
|
||||
snippet rel
|
||||
[${0:foo} release];
|
||||
# autorelease
|
||||
snippet arel
|
||||
[${0:foo} autorelease];
|
||||
# autorelease pool
|
||||
snippet pool
|
||||
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
|
||||
${0}
|
||||
[$1 drain];
|
||||
# Throw an exception
|
||||
snippet except
|
||||
NSException *${1:badness};
|
||||
$1 = [NSException exceptionWithName:@"${2:$1Name}"
|
||||
reason:@"${0}"
|
||||
userInfo:nil];
|
||||
[$1 raise];
|
||||
snippet prag
|
||||
#pragma mark ${0:-}
|
||||
snippet cl
|
||||
@class ${1:Foo};
|
||||
snippet color
|
||||
[[NSColor ${0:blackColor}] set];
|
||||
# NSArray
|
||||
snippet array
|
||||
NSMutableArray *${1:array} = [NSMutable array];
|
||||
snippet nsa
|
||||
NSArray ${0}
|
||||
snippet nsma
|
||||
NSMutableArray ${0}
|
||||
snippet aa
|
||||
NSArray * array;
|
||||
snippet ma
|
||||
NSMutableArray * array;
|
||||
# NSDictionary
|
||||
snippet dict
|
||||
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];
|
||||
snippet nsd
|
||||
NSDictionary ${0}
|
||||
snippet nsmd
|
||||
NSMutableDictionary ${0}
|
||||
# NSString
|
||||
snippet nss
|
||||
NSString ${0}
|
||||
snippet nsms
|
||||
NSMutableString ${0}
|
@ -1,39 +0,0 @@
|
||||
snippet doc
|
||||
(** ${0} *)
|
||||
snippet comment
|
||||
(* ${0} *)
|
||||
snippet let
|
||||
let ${1} = ${2} in
|
||||
${0}
|
||||
snippet fn
|
||||
let ${1} =
|
||||
${0}
|
||||
snippet fun
|
||||
type ${1} = ${0}
|
||||
snippet mod
|
||||
module ${1} = struct
|
||||
${0}
|
||||
end
|
||||
snippet modty
|
||||
module type ${1} = sig
|
||||
${0}
|
||||
end
|
||||
snippet sw
|
||||
match ${1} with
|
||||
| ${2} -> ${0}
|
||||
snippet |
|
||||
| ${1} -> ${0}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2}
|
||||
else
|
||||
${0}
|
||||
snippet fnr
|
||||
let rec ${1} =
|
||||
${0}
|
||||
snippet try
|
||||
try
|
||||
${1}
|
||||
with ${0}
|
@ -1,2 +0,0 @@
|
||||
extends matlab
|
||||
|
@ -1,53 +0,0 @@
|
||||
# 0/*
|
||||
snippet fv
|
||||
type fixedValue;
|
||||
value uniform ${0};
|
||||
snippet zg
|
||||
type zeroGradient;
|
||||
snippet sym
|
||||
type symmetryPlane;
|
||||
# system/controlDict
|
||||
snippet forces
|
||||
forces
|
||||
{
|
||||
type forces;
|
||||
functionObjectLibs ("libforces.so");
|
||||
enabled true;
|
||||
outputControl ${1:timeStep};
|
||||
outputInterval ${2:1};
|
||||
patches (${3});
|
||||
log ${4:true};
|
||||
CofR (${0:0 0 0});
|
||||
}
|
||||
# system/fvSolution
|
||||
# solvers
|
||||
snippet gamg
|
||||
${1:p}
|
||||
{
|
||||
solver GAMG;
|
||||
tolerance 1e-${2:6};
|
||||
relTol ${0:0.0};
|
||||
smoother GaussSeidel;
|
||||
cacheAgglomeration true;
|
||||
nCellsInCoarsestLevel 10;
|
||||
agglomerator faceAreaPair;
|
||||
mergeLevels 1;
|
||||
}
|
||||
snippet pbicg
|
||||
${1:U}
|
||||
{
|
||||
solver PBiCG;
|
||||
preconditioner DILU;
|
||||
tolerance 1e-${2:6};
|
||||
relTol ${0:0.0};
|
||||
}
|
||||
# PIMPLE
|
||||
snippet pimple
|
||||
PIMPLE
|
||||
{
|
||||
nOuterCorrectors ${1:outer};
|
||||
nCorrectors ${2:inner};
|
||||
nNonOrthogonalCorrectors ${3:nonOrtho};
|
||||
pRefCell ${4:cell};
|
||||
pRefValue ${0:value for $4};
|
||||
}
|
@ -1 +0,0 @@
|
||||
extends markdown
|
@ -1,367 +0,0 @@
|
||||
# #!/usr/bin/perl
|
||||
snippet #!
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Hash Pointer
|
||||
snippet .
|
||||
=>
|
||||
# Function
|
||||
snippet sub
|
||||
sub ${1:function_name} {
|
||||
${0}
|
||||
}
|
||||
# Conditional
|
||||
snippet if
|
||||
if (${1}) {
|
||||
${0}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if (${1}) {
|
||||
${2}
|
||||
}
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
# Conditional if..elsif..else
|
||||
snippet ifee
|
||||
if (${1}) {
|
||||
${2}
|
||||
}
|
||||
elsif (${3}) {
|
||||
${4:# elsif...}
|
||||
}
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
snippet eif
|
||||
elsif (${1}) {
|
||||
${0}
|
||||
}
|
||||
# Conditional One-line
|
||||
snippet xif
|
||||
$1 if $0;
|
||||
# Unless conditional
|
||||
snippet unless
|
||||
unless (${1}) {
|
||||
${0}
|
||||
}
|
||||
# Unless conditional One-line
|
||||
snippet xunless
|
||||
$1 unless $0;
|
||||
# Try/Except
|
||||
snippet eval
|
||||
local $@;
|
||||
eval {
|
||||
${1:# do something risky...}
|
||||
};
|
||||
if (my $e = $@) {
|
||||
${0:# handle failure...}
|
||||
}
|
||||
# While Loop
|
||||
snippet wh
|
||||
while (${1}) {
|
||||
${0}
|
||||
}
|
||||
# While Loop One-line
|
||||
snippet xwh
|
||||
$1 while $0;
|
||||
# C-style For Loop
|
||||
snippet cfor
|
||||
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${0}
|
||||
}
|
||||
# For loop one-line
|
||||
snippet xfor
|
||||
$1 for @$0;
|
||||
# Foreach Loop
|
||||
snippet for
|
||||
foreach my $${1:x} (@${2:array}) {
|
||||
${0}
|
||||
}
|
||||
# Foreach Loop One-line
|
||||
snippet fore
|
||||
$1 foreach @$0;
|
||||
# Package
|
||||
snippet package
|
||||
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`};
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
${0}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
# Package syntax perl >= 5.14
|
||||
snippet packagev514
|
||||
package ${1:`expand('%:p:s?.*lib/??:r:gs?/?::?')`} ${2:0.99};
|
||||
use v5.14;
|
||||
use warnings;
|
||||
|
||||
${0}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
#moose
|
||||
snippet moose
|
||||
use Moose;
|
||||
use namespace::autoclean;
|
||||
${1:#}BEGIN {extends '${2:ParentClass}'};
|
||||
|
||||
${0}
|
||||
# parent
|
||||
snippet parent
|
||||
use parent qw(${0:Parent Class});
|
||||
# Read File
|
||||
snippet slurp
|
||||
my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> };
|
||||
${0}
|
||||
# strict warnings
|
||||
snippet strwar
|
||||
use strict;
|
||||
use warnings;
|
||||
# older versioning with perlcritic bypass
|
||||
snippet vers
|
||||
## no critic
|
||||
our $VERSION = '${0:version}';
|
||||
eval $VERSION;
|
||||
## use critic
|
||||
# new 'switch' like feature
|
||||
snippet switch
|
||||
use feature 'switch';
|
||||
|
||||
# Anonymous subroutine
|
||||
snippet asub
|
||||
sub {
|
||||
${0}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Begin block
|
||||
snippet begin
|
||||
BEGIN {
|
||||
${0}
|
||||
}
|
||||
|
||||
# call package function with some parameter
|
||||
snippet pkgmv
|
||||
__PACKAGE__->${1:package_method}(${0:var})
|
||||
|
||||
# call package function without a parameter
|
||||
snippet pkgm
|
||||
__PACKAGE__->${0:package_method}()
|
||||
|
||||
# call package "get_" function without a parameter
|
||||
snippet pkget
|
||||
__PACKAGE__->get_${0:package_method}()
|
||||
|
||||
# call package function with a parameter
|
||||
snippet pkgetv
|
||||
__PACKAGE__->get_${1:package_method}(${0:var})
|
||||
|
||||
# complex regex
|
||||
snippet qrx
|
||||
qr/
|
||||
${0:regex}
|
||||
/xms
|
||||
|
||||
#simpler regex
|
||||
snippet qr/
|
||||
qr/${0:regex}/x
|
||||
|
||||
#given
|
||||
snippet given
|
||||
given ($${1:var}) {
|
||||
${2:# cases}
|
||||
${0:# default}
|
||||
}
|
||||
|
||||
# switch-like case
|
||||
snippet when
|
||||
when (${1:case}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
# hash slice
|
||||
snippet hslice
|
||||
@{ ${1:hash} }{ ${0:array} }
|
||||
|
||||
|
||||
# map
|
||||
snippet map
|
||||
map { ${0: body } } ${1: @array } ;
|
||||
|
||||
|
||||
|
||||
# Pod stub
|
||||
snippet ppod
|
||||
=head1 NAME
|
||||
|
||||
${1:ClassName} - ${2:ShortDesc}
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use $1;
|
||||
|
||||
${3:# synopsis...}
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
${0:# longer description...}
|
||||
|
||||
|
||||
=head1 INTERFACE
|
||||
|
||||
|
||||
=head1 DEPENDENCIES
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
|
||||
# Heading for a subroutine stub
|
||||
snippet psub
|
||||
=head2 ${1:MethodName}
|
||||
|
||||
${0:Summary....}
|
||||
|
||||
# Heading for inline subroutine pod
|
||||
snippet psubi
|
||||
=head2 ${1:MethodName}
|
||||
|
||||
${0:Summary...}
|
||||
|
||||
|
||||
=cut
|
||||
# inline documented subroutine
|
||||
snippet subpod
|
||||
=head2 $1
|
||||
|
||||
Summary of $1
|
||||
|
||||
=cut
|
||||
|
||||
sub ${1:subroutine_name} {
|
||||
${0}
|
||||
}
|
||||
# Subroutine signature
|
||||
snippet parg
|
||||
=over 2
|
||||
|
||||
=item
|
||||
Arguments
|
||||
|
||||
|
||||
=over 3
|
||||
|
||||
=item
|
||||
C<${1:DataStructure}>
|
||||
|
||||
${2:Sample}
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=item
|
||||
Return
|
||||
|
||||
=over 3
|
||||
|
||||
|
||||
=item
|
||||
C<${0:...return data}>
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=back
|
||||
|
||||
|
||||
|
||||
# Moose has
|
||||
snippet has
|
||||
has ${1:attribute} => (
|
||||
is => '${2:ro|rw}',
|
||||
isa => '${3:Str|Int|HashRef|ArrayRef|etc}',
|
||||
default => sub {
|
||||
${4:defaultvalue}
|
||||
},
|
||||
${0:# other attributes}
|
||||
);
|
||||
|
||||
|
||||
# override
|
||||
snippet override
|
||||
override ${1:attribute} => sub {
|
||||
${2:# my $self = shift;};
|
||||
${0:# my ($self, $args) = @_;};
|
||||
};
|
||||
|
||||
|
||||
# use test classes
|
||||
snippet tuse
|
||||
use Test::More;
|
||||
use Test::Deep; # (); # uncomment to stop prototype errors
|
||||
use Test::Exception;
|
||||
|
||||
# local test lib
|
||||
snippet tlib
|
||||
use lib qw{ ./t/lib };
|
||||
|
||||
#test methods
|
||||
snippet tmeths
|
||||
$ENV{TEST_METHOD} = '${0:regex}';
|
||||
|
||||
# runtestclass
|
||||
snippet trunner
|
||||
use ${0:test_class};
|
||||
$1->runtests();
|
||||
|
||||
# Test::Class-style test
|
||||
snippet tsub
|
||||
sub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {
|
||||
my $self = shift;
|
||||
${0}
|
||||
|
||||
}
|
||||
|
||||
# Test::Routine-style test
|
||||
snippet trsub
|
||||
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
|
||||
my ($self) = @_;
|
||||
${0}
|
||||
};
|
||||
|
||||
#prep test method
|
||||
snippet tprep
|
||||
sub prep${1:number}_${2:test_case} :Test(startup) {
|
||||
my $self = shift;
|
||||
${0}
|
||||
}
|
||||
|
||||
# cause failures to print stack trace
|
||||
snippet debug_trace
|
||||
use Carp; # 'verbose';
|
||||
# cloak "die"
|
||||
# warn "warning"
|
||||
$SIG{'__DIE__'} = sub {
|
||||
require Carp; Carp::confess
|
||||
};
|
||||
|
||||
snippet dump
|
||||
use Data::Dump qw(dump);
|
||||
warn dump ${1:variable}
|
||||
|
||||
snippet ddp
|
||||
use DDP;
|
||||
p ${1:variable}
|
||||
|
||||
snippet subtest
|
||||
subtest '${1: test_name}' => sub {
|
||||
${2}
|
||||
};
|
@ -1,116 +0,0 @@
|
||||
# shebang
|
||||
snippet #!
|
||||
#!/usr/bin/env perl6
|
||||
|
||||
# Hash Pointer
|
||||
snippet .
|
||||
=>
|
||||
# Function
|
||||
snippet sub
|
||||
sub ${1:function_name}(${2:Str $var}) {
|
||||
${3}
|
||||
}
|
||||
snippet mul
|
||||
multi ${1:function_name}(${2:Str $var}) {
|
||||
${3}
|
||||
}
|
||||
# Conditional
|
||||
snippet if
|
||||
if ${1} {
|
||||
${2}
|
||||
}
|
||||
# Conditional if..else
|
||||
snippet ife
|
||||
if ${1} {
|
||||
${2}
|
||||
}
|
||||
else {
|
||||
${3}
|
||||
}
|
||||
snippet eif
|
||||
elsif ${1} {
|
||||
${2}
|
||||
}
|
||||
# Conditional One-line
|
||||
snippet xif
|
||||
${1} if $2;
|
||||
# Unless conditional
|
||||
snippet unless
|
||||
unless ${1} {
|
||||
${2}
|
||||
}
|
||||
# Unless conditional One-line
|
||||
snippet xunless
|
||||
${1} unless $2;
|
||||
# Ternary conditional
|
||||
snippet tc
|
||||
$1 ?? ${2:value-if-true} !! ${3:value-if-false};
|
||||
# given - when (perl6 switch)
|
||||
snippet switch
|
||||
given ${1:$var} {
|
||||
when $2 {
|
||||
${3:# code block ...}
|
||||
}
|
||||
${4}
|
||||
default {
|
||||
${5}
|
||||
}
|
||||
}
|
||||
# 'loop' - C's for.
|
||||
snippet loop
|
||||
loop (my ${1:$i} = 0; $$1 < ${2:count}; $$1++) {
|
||||
${3}
|
||||
}
|
||||
# for loop
|
||||
snippet for
|
||||
for ${1:@array} -> ${2:$variable} {
|
||||
${3}
|
||||
}
|
||||
# While Loop
|
||||
snippet wh
|
||||
while ${1} {
|
||||
${2}
|
||||
}
|
||||
# Repeat while and repean until
|
||||
snippet rp
|
||||
repeat {
|
||||
${1}
|
||||
} ${2:while|until} ${3};
|
||||
# classes ..
|
||||
snippet cl
|
||||
${1:my} class ${2:ClassName} ${3:is|does Parent|Role}{
|
||||
${4}
|
||||
}
|
||||
snippet has
|
||||
has ${1:Type} ${2:$!identifier};
|
||||
snippet mth
|
||||
method ${1:method_name}(${2:$attr}) {
|
||||
${3}
|
||||
}
|
||||
snippet pmth
|
||||
method ${1:!}${2:method_name}(${3:$attr}) {
|
||||
${4}
|
||||
}
|
||||
snippet smth
|
||||
submethod ${1:submethod_name}(${2:$attr}) {
|
||||
${3}
|
||||
}
|
||||
# Tests
|
||||
snippet test
|
||||
use v6;
|
||||
use Test;
|
||||
${1:use lib 'lib';}
|
||||
|
||||
plan ${2:$num-tests};
|
||||
|
||||
# IO
|
||||
snippet slurp
|
||||
my ${1:$var} = "${2:filename}".IO.slurp;
|
||||
snippet rfile
|
||||
for "${1:filename}".IO.lines -> $line {
|
||||
${2}
|
||||
}
|
||||
snippet open
|
||||
my $fh = open "${1:filename}", ${2::r|:w|:a};
|
||||
${3:# actions};
|
||||
$fh.close;
|
@ -1,16 +0,0 @@
|
||||
snippet cont
|
||||
defmodule ${1:AppName}Web.${2:ControllerName}Controller do
|
||||
use $1Web, :controller
|
||||
|
||||
${3}
|
||||
end
|
||||
|
||||
snippet view
|
||||
defmodule ${1:AppName}Web.${2:ViewName}View do
|
||||
use $1Web, :view
|
||||
end
|
||||
|
||||
snippet chan
|
||||
defmodule ${1:AppName}Web.${2:ChannelName}Channel do
|
||||
use $1Web, :channel
|
||||
end
|
@ -1,690 +0,0 @@
|
||||
snippet <?
|
||||
<?php
|
||||
|
||||
${0:${VISUAL}}
|
||||
snippet dst "declare(strict_types=1)"
|
||||
declare(strict_types=${1:1});
|
||||
snippet ec
|
||||
echo ${0};
|
||||
snippet <?e
|
||||
<?php echo ${0} ?>
|
||||
# this one is for php5.4
|
||||
snippet <?=
|
||||
<?=${0}?>
|
||||
snippet ?=
|
||||
<?= ${0} ?>
|
||||
snippet ?
|
||||
<?php ${0} ?>
|
||||
snippet ?f
|
||||
<?php foreach ($${1:vars} as $${2:$var}): ?>
|
||||
${0:${VISUAL}}
|
||||
<?php endforeach ?>
|
||||
snippet ?i
|
||||
<?php if ($${1:var}): ?>
|
||||
${0:${VISUAL}}
|
||||
<?php endif ?>
|
||||
snippet ns
|
||||
namespace ${1:Foo\Bar\Baz};
|
||||
|
||||
${0:${VISUAL}}
|
||||
snippet c
|
||||
class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet i
|
||||
interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet t.
|
||||
\$this->
|
||||
snippet f
|
||||
function ${1}(${3})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# method
|
||||
snippet m
|
||||
${1:protected} function ${2:foo}()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet sm "PHP Class Setter"
|
||||
/**
|
||||
* Sets the value of ${1:foo}
|
||||
*
|
||||
* @param ${2:string} $$1 ${3:description}
|
||||
*
|
||||
* @return ${4:`vim_snippets#Filename()`}
|
||||
*/
|
||||
${5:public} function set${6:$1}(${7:$2 }$$1)
|
||||
{
|
||||
$this->${8:$1} = $$1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
snippet gm "PHP Class Getter Setter"
|
||||
/**
|
||||
* Gets the value of ${1:foo}
|
||||
*
|
||||
* @return ${2:string}
|
||||
*/
|
||||
${3:public} function get${4:$1}()
|
||||
{
|
||||
return $this->${5:$1};
|
||||
}
|
||||
#setter
|
||||
snippet $s
|
||||
${1:$foo}->set${2:Bar}(${0});
|
||||
#getter
|
||||
snippet $g
|
||||
${1:$foo}->get${0:Bar}();
|
||||
# Tertiary conditional
|
||||
snippet =?:
|
||||
$${1:foo} = ${2:true} ? ${3:a} : ${0};
|
||||
snippet ?:
|
||||
${1:true} ? ${2:a} : ${0}
|
||||
snippet t "$retVal = (condition) ? a : b"
|
||||
$${1:retVal} = ($2) ? ${3:a} : ${4:b};
|
||||
# Predefined variables
|
||||
snippet C
|
||||
$_COOKIE['${1:variable}']
|
||||
snippet E
|
||||
$_ENV['${1:variable}']
|
||||
snippet F
|
||||
$_FILES['${1:variable}']
|
||||
snippet G "_GET array"
|
||||
$_GET['${1:variable}']
|
||||
snippet P "_POST array"
|
||||
$_POST['${1:variable}']
|
||||
snippet R
|
||||
$_REQUEST['${1:variable}']
|
||||
snippet S
|
||||
$_SERVER['${1:variable}']
|
||||
snippet SS
|
||||
$_SESSION['${1:variable}']
|
||||
snippet get "get"
|
||||
$_GET['${1}']
|
||||
snippet post "post"
|
||||
$_POST['${1}']
|
||||
snippet session "session"
|
||||
$_SESSION['${1}']
|
||||
# the following are old ones
|
||||
snippet inc
|
||||
include '${1:file}';
|
||||
snippet inc1
|
||||
include_once '${1:file}';
|
||||
snippet req
|
||||
require '${1:file}';
|
||||
snippet req1
|
||||
require_once '${1:file}';
|
||||
# Start Docblock
|
||||
snippet /*
|
||||
/**
|
||||
* ${0}
|
||||
*/
|
||||
# Class - post doc
|
||||
snippet doc_cp
|
||||
/**
|
||||
* ${1:undocumented class}
|
||||
*
|
||||
* @package ${2:default}
|
||||
* @subpackage ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
# Class Variable - post doc
|
||||
snippet doc_vp
|
||||
/**
|
||||
* ${1:undocumented class variable}
|
||||
*
|
||||
* @var ${2:string}
|
||||
*/
|
||||
# Class Variable
|
||||
snippet doc_v
|
||||
/**
|
||||
* ${3:undocumented class variable}
|
||||
*
|
||||
* @var ${4:string}
|
||||
*/
|
||||
${1:var} $${2};
|
||||
|
||||
# Class attribute with short comment
|
||||
snippet att
|
||||
/** @var ${3:string} */
|
||||
${1:public} $${2};
|
||||
|
||||
# Class
|
||||
snippet doc_c
|
||||
/**
|
||||
* ${3:undocumented class}
|
||||
*
|
||||
* @package ${4:default}
|
||||
* @subpackage ${5:default}
|
||||
* @author ${6:`g:snips_author`}
|
||||
*/
|
||||
${1:}class ${2:}
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
} // END $1class $2
|
||||
# Constant Definition - post doc
|
||||
snippet doc_dp
|
||||
/**
|
||||
* ${1:undocumented constant}
|
||||
*/
|
||||
# Constant Definition
|
||||
snippet doc_d
|
||||
/**
|
||||
* ${3:undocumented constant}
|
||||
*/
|
||||
define(${1}, ${2});
|
||||
# Function - post doc
|
||||
snippet doc_fp
|
||||
/**
|
||||
* ${1:undocumented function}
|
||||
*
|
||||
* @return ${2:void}
|
||||
* @author ${3:`g:snips_author`}
|
||||
*/
|
||||
# Function signature
|
||||
snippet doc_s
|
||||
/**
|
||||
* ${4:undocumented function}
|
||||
*
|
||||
* @return ${5:void}
|
||||
* @author ${6:`g:snips_author`}
|
||||
*/
|
||||
${1}function ${2}(${3});
|
||||
# Function
|
||||
snippet doc_f
|
||||
/**
|
||||
* ${4:undocumented function}
|
||||
*
|
||||
* @return ${5:void}
|
||||
* @author ${6:`g:snips_author`}
|
||||
*/
|
||||
${1}function ${2}(${3})
|
||||
{${0}
|
||||
}
|
||||
# Header
|
||||
snippet doc_h
|
||||
/**
|
||||
* ${1}
|
||||
*
|
||||
* @author ${2:`g:snips_author`}
|
||||
* @version ${3:$Id$}
|
||||
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
|
||||
* @package ${0:default}
|
||||
*/
|
||||
snippet doc_i "interface someClass {}"
|
||||
/**
|
||||
* $1
|
||||
* @package ${2:default}
|
||||
* @author ${3:`!v g:snips_author`}
|
||||
**/
|
||||
interface ${1:someClass}
|
||||
{${4}
|
||||
}
|
||||
snippet inheritdoc "@inheritdoc docblock"
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
# Interface
|
||||
snippet interface
|
||||
/**
|
||||
* ${2:undocumented class}
|
||||
*
|
||||
* @package ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Trait
|
||||
snippet trait
|
||||
/**
|
||||
* ${2:undocumented class}
|
||||
*
|
||||
* @package ${3:default}
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
trait ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# class ...
|
||||
snippet class
|
||||
/**
|
||||
* ${1}
|
||||
*/
|
||||
class ${2:`vim_snippets#Filename()`}
|
||||
{
|
||||
${3}
|
||||
/**
|
||||
* ${4}
|
||||
*/
|
||||
${5:public} function ${6:__construct}(${7:argument})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
}
|
||||
snippet nc
|
||||
namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`};
|
||||
|
||||
${2:abstract }class ${3:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# define(...)
|
||||
snippet def "define('VARIABLE_NAME', 'definition')"
|
||||
define('${1:VARIABLE_NAME}', ${2:'definition'});
|
||||
# defined(...)
|
||||
snippet def?
|
||||
${1}defined('${2}')
|
||||
snippet wh "while (condition) { ... }"
|
||||
while ($1) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet do "do { ... } while (condition)"
|
||||
do {
|
||||
${0:${VISUAL}}
|
||||
} while (${1});
|
||||
snippet if "if (condition) { ... }"
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ifn "if (!condition) { ... }"
|
||||
if (!${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ifil "<?php if (condition): ?> ... <?php endif; ?>"
|
||||
<?php if (${1}): ?>
|
||||
${0:${VISUAL}}
|
||||
<?php endif; ?>
|
||||
snippet ife "if (cond) { ... } else { ... }"
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
} else {
|
||||
${2}
|
||||
}
|
||||
snippet ifeil "<?php if (condition): ?> ... <?php else: ?> ... <?php endif; ?>"
|
||||
<?php if (${1}): ?>
|
||||
${0:${VISUAL}}
|
||||
<?php else: ?>
|
||||
${2}
|
||||
<?php endif; ?>
|
||||
snippet el "else { ... }"
|
||||
else {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet eif "elseif(condition) { ... }"
|
||||
elseif (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet switch "switch($var) { case 'xyz': ... default: .... }"
|
||||
switch ($${1:variable}) {
|
||||
case '${2:value}':
|
||||
${3}
|
||||
break;
|
||||
${0}
|
||||
default:
|
||||
${4}
|
||||
break;
|
||||
}
|
||||
snippet case "case 'value': ... break"
|
||||
case '${1:value}':
|
||||
${0:${VISUAL}}
|
||||
break;
|
||||
snippet for "for ($i = 0; $i < $count; $i++) { ... }"
|
||||
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet foreach "foreach ($var as $value) { .. }"
|
||||
foreach ($${1:variable} as $${2:value}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet foreachil "<?php foreach ($var as $value): ?> ... <?php endforeach; ?>"
|
||||
<?php foreach ($${1:variable} as $${2:value}): ?>
|
||||
${0:${VISUAL}}
|
||||
<?php endforeach; ?>
|
||||
snippet foreachk "foreach ($var as $key => $value) { .. }"
|
||||
foreach ($${1:variable} as $${2:key} => $${3:value}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet foreachkil "<?php foreach ($var as $key => $value): ?> ... <?php endforeach; ?>"
|
||||
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
|
||||
${0:<!-- html... -->}
|
||||
<?php endforeach; ?>
|
||||
snippet array "$... = ['' => ]"
|
||||
$${1:arrayName} = ['${2}' => ${3}];
|
||||
snippet try "try { ... } catch (Exception $e) { ... }"
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception} $e) {
|
||||
}
|
||||
# lambda with closure
|
||||
snippet lambda
|
||||
${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {
|
||||
${0}
|
||||
};
|
||||
# pre_dump();
|
||||
snippet pd
|
||||
echo '<pre>'; var_dump(${0}); echo '</pre>';
|
||||
# pre_dump(); die();
|
||||
snippet pdd
|
||||
echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${0:});
|
||||
snippet vd
|
||||
var_dump(${0});
|
||||
snippet vdd
|
||||
var_dump(${1}); die(${0:});
|
||||
snippet pr
|
||||
print_r(${0});
|
||||
snippet prs
|
||||
print_r(${0}, 1);
|
||||
snippet vdf
|
||||
error_log(print_r($${1:foo}, true), 3, '${2:/tmp/debug.log}');
|
||||
snippet http_redirect
|
||||
header ("HTTP/1.1 301 Moved Permanently");
|
||||
header ("Location: ".URL);
|
||||
exit();
|
||||
snippet log "error_log(var_export($var, true));"
|
||||
error_log(var_export(${1}, true));
|
||||
snippet var "var_export($var)"
|
||||
var_export(${1});
|
||||
snippet ve "Dumb debug helper in HTML"
|
||||
echo '<pre>' . var_export(${1}, 1) . '</pre>';
|
||||
snippet pc "Dumb debug helper in cli"
|
||||
var_export($1);$0
|
||||
# Getters & Setters
|
||||
snippet gs "PHP Class Getter Setter"
|
||||
/**
|
||||
* Gets the value of ${1:foo}
|
||||
*
|
||||
* @return ${2:string}
|
||||
*/
|
||||
public function get${3:$1}()
|
||||
{
|
||||
return $this->${4:$1};
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of $1
|
||||
*
|
||||
* @param $2 $$1 ${5:description}
|
||||
*
|
||||
* @return ${6:`vim_snippets#Filename()`}
|
||||
*/
|
||||
public function set$3(${7:$2 }$$1)
|
||||
{
|
||||
$this->$4 = $$1;
|
||||
return $this;
|
||||
}
|
||||
# anotation, get, and set, useful for doctrine
|
||||
snippet ags
|
||||
/**
|
||||
* ${1:description}
|
||||
*
|
||||
* @${0}
|
||||
*/
|
||||
${2:protected} $${3:foo};
|
||||
|
||||
public function get${4:$3}()
|
||||
{
|
||||
return $this->$3;
|
||||
}
|
||||
|
||||
public function set$4(${5:$4 }$${6:$3})
|
||||
{
|
||||
$this->$3 = $$6;
|
||||
return $this;
|
||||
}
|
||||
snippet rett
|
||||
return true;
|
||||
snippet retf
|
||||
return false;
|
||||
snippet am
|
||||
$${1:foo} = array_map(function($${2:v}) {
|
||||
${0}
|
||||
return $$2;
|
||||
}, $$1);
|
||||
snippet aw
|
||||
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
|
||||
$$2 = ${0};
|
||||
});
|
||||
# static var assign once
|
||||
snippet static_var
|
||||
static $${1} = null;
|
||||
if (is_null($$1)){
|
||||
$$1 = ${2};
|
||||
}
|
||||
snippet CSVWriter
|
||||
<?php
|
||||
|
||||
class CSVWriter {
|
||||
public function __construct($file_or_handle, $sep = "\t", $quot = '"'){
|
||||
$args = func_get_args();
|
||||
$mode = isset($opts['mode']) ? $opts['mode'] : 'w';
|
||||
|
||||
$this->f =
|
||||
is_string($file_or_handle)
|
||||
? fopen($file_or_handle, $mode)
|
||||
: $file_or_handle;
|
||||
|
||||
$this->fputcsv_args = [$this->f, null, $sep, $quot];
|
||||
|
||||
if (!$this->f) throw new Exception('bad file descriptor');
|
||||
}
|
||||
|
||||
public function write($row){
|
||||
$this->fputcsv_args[1] =& $row;
|
||||
call_user_func_array('fputcsv', $this->fputcsv_args);
|
||||
}
|
||||
|
||||
public function close(){
|
||||
if (!is_null($this->f))
|
||||
fclose($this->f);
|
||||
$this->f = null;
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
$this->close();
|
||||
}
|
||||
|
||||
}
|
||||
snippet CSVIterator
|
||||
|
||||
// http://snipplr.com/view.php?codeview&id=1986 // modified
|
||||
class CSVIterator implements Iterator
|
||||
{
|
||||
private $f;
|
||||
private $curr;
|
||||
private $rowCounter;
|
||||
|
||||
/* opts keys:
|
||||
* row_size
|
||||
* escape
|
||||
* enclosure
|
||||
* delimiter
|
||||
*/
|
||||
public function __construct( $file_or_handle, $opts = [4096, ','] )
|
||||
{
|
||||
$d = function($n) use(&$opts){ return isset($opts[$n]) ? $opts[$n] : false; };
|
||||
|
||||
$this->combine = $d('combine');
|
||||
$this->headers = $d('headers');
|
||||
$this->headerCheckFunction = $d('header_check_function');
|
||||
|
||||
$this->f =
|
||||
is_string($file_or_handle)
|
||||
? fopen( $file_or_handle, 'r' )
|
||||
: $file_or_handle;
|
||||
if (!$this->f) throw new Exception('bad file descriptor');
|
||||
$this->fgetcsv_args = [
|
||||
$this->f,
|
||||
isset($opts['row_size']) ? $opts['row_size'] : 4096,
|
||||
isset($opts['delimiter']) ? $opts['delimiter'] : ',',
|
||||
isset($opts['enclosure']) ? $opts['enclosure'] : '"',
|
||||
isset($opts['escape']) ? $opts['escape'] : '\\',
|
||||
];
|
||||
$this->start();
|
||||
}
|
||||
|
||||
protected function readRow(){
|
||||
$this->curr = call_user_func_array('fgetcsv', $this->fgetcsv_args );
|
||||
$this->rowCounter++;
|
||||
if ($this->rowCounter == 1){
|
||||
$this->processHeader();
|
||||
} elseif ($this->curr) {
|
||||
$this->processRow();
|
||||
}
|
||||
}
|
||||
|
||||
public function processHeader(){
|
||||
if ($this->headers || $this->combine){
|
||||
$this->header = $this->curr;
|
||||
if ($this->headerCheckFunction){
|
||||
$f = $this->headerCheckFunction;
|
||||
$f($this->header);
|
||||
}
|
||||
$this->readRow();
|
||||
}
|
||||
}
|
||||
|
||||
public function processRow(){
|
||||
if ($this->combine)
|
||||
$this->curr = array_combine($this->header, $this->curr);
|
||||
}
|
||||
|
||||
public function start(){
|
||||
$this->rowCounter = 0;
|
||||
rewind( $this->f );
|
||||
$this->readRow();
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
$this->start();
|
||||
}
|
||||
|
||||
public function current()
|
||||
{
|
||||
$curr = $this->curr;
|
||||
$this->readRow();
|
||||
return $curr;
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return $this->rowCounter;
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
return $this->curr;
|
||||
}
|
||||
|
||||
public function valid(){
|
||||
if( !$this->next() )
|
||||
{
|
||||
fclose( $this->f );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
} // end class
|
||||
# phpunit
|
||||
snippet ase "$this->assertEquals($a, $b)"
|
||||
$this->assertEquals(${1:$expected}, ${2:$actual});
|
||||
snippet asne "$this->assertNotEquals($a, $b)"
|
||||
$this->assertNotEquals(${1:$expected}, ${2:$actual});
|
||||
snippet asf "$this->assertFalse($a)"
|
||||
$this->assertFalse(${1});
|
||||
snippet ast "$this->assertTrue($a)"
|
||||
$this->assertTrue(${1});
|
||||
snippet asfex "$this->assertFileExists('path/to/file')"
|
||||
$this->assertFileExists(${1:'path/to/file'});
|
||||
snippet asfnex "$this->assertFileNotExists('path/to/file')"
|
||||
$this->assertFileNotExists(${1:'path/to/file'});
|
||||
snippet ascon "$this->assertContains($needle, $haystack)"
|
||||
$this->assertContains(${1:$needle}, ${2:$haystack});
|
||||
snippet asncon "$this->assertNotContains($needle, $haystack)"
|
||||
$this->assertNotContains(${1:$needle}, ${2:$haystack});
|
||||
snippet ascono "$this->assertContainsOnly($needle, $haystack)"
|
||||
$this->assertContainsOnly(${1:$needle}, ${2:$haystack});
|
||||
snippet asconoi "$this->assertContainsOnlyInstancesOf(Example::class, $haystack)"
|
||||
$this->assertContainsOnlyInstancesOf(${1:Example}::class, ${2:$haystack});
|
||||
snippet ashk "$this->assertArrayHasKey($key, $array)"
|
||||
$this->assertArrayHasKey(${1:$key}, ${2:$array});
|
||||
snippet asnhk "$this->assertArrayNotHasKey($key, $array)"
|
||||
this->assertArrayNotHasKey(${1:$key}, ${2:$array});
|
||||
snippet ascha "$this->assertClassHasAttribute($name, Example::class)"
|
||||
$this->assertClassHasAttribute(${1:$attributeName}, ${2:Example}::class);
|
||||
snippet asi "$this->assertInstanceOf(Example::class, $actual)"
|
||||
$this->assertInstanceOf(${1:Example}::class, ${2:$actual});
|
||||
snippet asit "$this->assertInternalType('string', $actual)"
|
||||
$this->assertInternalType(${1:'string'}, ${2:actual});
|
||||
snippet asco "$this->assertCount($count, $haystack)"
|
||||
$this->assertCount(${1:$expectedCount}, ${2:$haystack});
|
||||
snippet asnco "$this->assertNotCount($count, $haystack)"
|
||||
$this->assertNotCount(${1:$count}, ${2:$haystack});
|
||||
snippet assub "$this->assertArraySubset($subset, $array)"
|
||||
$this->assertArraySubset(${1:$subset}, ${2:$array});
|
||||
snippet asnu "$this->assertNull($a)"
|
||||
$this->assertNull(${1});
|
||||
snippet asnnu "$this->assertNotNull($a)"
|
||||
$this->assertNotNull(${1});
|
||||
snippet test "public function testXYZ() { ... }"
|
||||
public function test${1}()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet setup "protected function setUp() { ... }"
|
||||
protected function setUp()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet teardown "protected function tearDown() { ... }"
|
||||
protected function tearDown()
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet proph "$observer = $this->prophesize(SomeClass::class);"
|
||||
$${1:observer} = $this->prophesize(${2:SomeClass}::class);
|
||||
snippet mock "$mock = $this->createMock(SomeClass::class);"
|
||||
$${1:mock} = $this->createMock(${2:SomeClass}::class);
|
||||
snippet exp "phpunit expects"
|
||||
expects($this->${1:once}())
|
||||
->method('${2}')
|
||||
->with(${3})
|
||||
->willReturn(${4});
|
||||
snippet testcmt "phpunit comment with group"
|
||||
/**
|
||||
* @group ${1}
|
||||
*/
|
||||
snippet fail "$this->fail()"
|
||||
$this->fail(${1});
|
||||
snippet marki "$this->markTestIncomplete()"
|
||||
$this->markTestIncomplete(${1});
|
||||
snippet marks "$this->markTestSkipped()"
|
||||
$this->markTestSkipped(${1});
|
||||
# end of phpunit snippets
|
||||
snippet te "throw new Exception()"
|
||||
throw new ${1:Exception}("${2:Error Processing Request}");
|
||||
snippet fpc "file_put_contents" b
|
||||
file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0
|
||||
snippet sr "str_replace"
|
||||
str_replace(${1:search}, ${2:replace}, ${3:subject})$0
|
||||
snippet ia "in_array"
|
||||
in_array(${1:needle}, ${2:haystack})$0
|
||||
snippet is "isset"
|
||||
isset(${1:var})$0
|
||||
snippet isa "isset array"
|
||||
isset($${1:array}[${2:key}])$0
|
||||
snippet in "is_null"
|
||||
is_null($${1:var})$0
|
||||
snippet fe "file_exists"
|
||||
file_exists(${1:file})$0
|
||||
snippet id "is_dir"
|
||||
is_dir(${1:path})$0
|
@ -1,109 +0,0 @@
|
||||
# create package spec
|
||||
snippet ps
|
||||
create or replace package ${1:name}
|
||||
as
|
||||
${0:-- spec}
|
||||
end; -- end of package spec $1
|
||||
# create package body
|
||||
snippet pb
|
||||
create or replace package body ${1:name}
|
||||
as
|
||||
$0
|
||||
end; -- end of package body $1;
|
||||
# package procedure spec
|
||||
snippet pps
|
||||
procedure ${1:name}(${0:args});
|
||||
# package procedure body
|
||||
snippet ppb
|
||||
procedure ${1:name}(${2:args})
|
||||
as
|
||||
begin
|
||||
$0
|
||||
end $2;
|
||||
# package function spec
|
||||
snippet pfs
|
||||
function ${1:name}(${2:args})
|
||||
return ${0:type};
|
||||
# package function body
|
||||
snippet pfb
|
||||
function ${1:name}(${2:args})
|
||||
return ${3:type}
|
||||
as
|
||||
l_res $3;
|
||||
begin
|
||||
$0;
|
||||
return l_res;
|
||||
end $1;
|
||||
# snow errors
|
||||
snippet err
|
||||
show errors;
|
||||
# proc/func in parameter
|
||||
snippet p
|
||||
${1:name} ${2:in} ${3:type} ${0: := null}
|
||||
# package type: record
|
||||
snippet tr
|
||||
type tr_${1:name} is record (${0:/* columns */});
|
||||
# package type: nested table
|
||||
snippet tt
|
||||
type tt_${1:name} is table of tr_${0:name};
|
||||
# package type: indexed table
|
||||
snippet tti
|
||||
type tt_${1:name} is table of tr_${0:name} index by binary_integer;
|
||||
# proc/func comment
|
||||
snippet doc
|
||||
/*
|
||||
* ${0: comment ...}
|
||||
*/
|
||||
# plsql block
|
||||
snippet beg
|
||||
begin
|
||||
${0}
|
||||
end;
|
||||
# plsql block with declare part
|
||||
snippet dec
|
||||
declare
|
||||
${1}
|
||||
begin
|
||||
${0}
|
||||
end;
|
||||
# return pipe row
|
||||
snippet rpipe
|
||||
for ${1:i} in 1 .. ${0:l_res}.count loop
|
||||
pipe row( $2($1) );
|
||||
end loop;
|
||||
return;
|
||||
# bulk collect
|
||||
snippet bc
|
||||
bulk collect into ${0}
|
||||
# local variable
|
||||
snippet l
|
||||
l_${1} ${0:number};
|
||||
# output
|
||||
snippet log
|
||||
dbms_output.put_line('${0}');
|
||||
# for loop
|
||||
snippet for
|
||||
for ${1:i} in ${2:1}..${3:42} loop
|
||||
${0}
|
||||
end loop;
|
||||
# for loop with select
|
||||
snippet fors
|
||||
for ${1:rec} in (${2: select}) loop
|
||||
${0}
|
||||
end loop;
|
||||
# for loop with collection
|
||||
snippet forc
|
||||
for ${1:i} in ${2:l_var}.first .. $2.last loop
|
||||
${0: -- dbms_output.put_line($2($1)); }
|
||||
end loop;
|
||||
# if
|
||||
snippet if
|
||||
if ${1} then
|
||||
${0}
|
||||
end if;
|
||||
snippet ife
|
||||
if ${1} then
|
||||
${2}
|
||||
else
|
||||
${0}
|
||||
end if;
|
@ -1,5 +0,0 @@
|
||||
snippet msg
|
||||
msgid "${1}"
|
||||
msgstr "${2}"
|
||||
|
||||
${0}
|
@ -1,705 +0,0 @@
|
||||
#BASICS
|
||||
# doc
|
||||
snippet doc
|
||||
/**
|
||||
* ${1:Description}
|
||||
*
|
||||
* @author ${2:name}
|
||||
* @since ${3:`strftime("%d/%m/%y %H:%M:%S")`}
|
||||
*/
|
||||
${0}
|
||||
# doc comment
|
||||
snippet docc
|
||||
/**
|
||||
* ${1:@private}$0
|
||||
*/
|
||||
${0}
|
||||
# class
|
||||
snippet class
|
||||
${1:public }class ${2:`fnamemodify(bufname("%"),":t:r")`} ${3:extends}
|
||||
{
|
||||
|
||||
//--------------------------------------
|
||||
// CONSTRUCTOR
|
||||
//--------------------------------------
|
||||
|
||||
public $2 (${4:arguments}) {
|
||||
${0:// expression}
|
||||
}
|
||||
}
|
||||
# package
|
||||
snippet package
|
||||
/**
|
||||
* ${1:Description}
|
||||
*
|
||||
* @author ${2:$TM_FULLNAME}
|
||||
* @since ${3:`strftime("%d/%m/%y %H:%M:%S")`}
|
||||
*/
|
||||
|
||||
package ${0:package};
|
||||
# function
|
||||
snippet fun
|
||||
${1:void/private/protected/public}${2: static} ${3:name}(${4}) {
|
||||
${5://if not void return null;}
|
||||
}
|
||||
${0}
|
||||
snippet fn
|
||||
${1:void }${2:name}(${3}) {
|
||||
${4://if not void return null;}
|
||||
}
|
||||
${0}
|
||||
# constant
|
||||
snippet const
|
||||
static final ${1:Object} ${2:VAR_NAM} = ${0};
|
||||
# var
|
||||
snippet var
|
||||
${1:private/public }${2:static }${3:String} ${4:str}${5: =}${0:value};
|
||||
# var objects
|
||||
snippet obj
|
||||
${1:private/public }${2:Object} ${3:o}${4: = new }$2(${0});
|
||||
#loop for
|
||||
snippet for
|
||||
for (int ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) {
|
||||
${0:$1[$2]}
|
||||
};
|
||||
#loop while
|
||||
snippet wh
|
||||
while ($1) {
|
||||
${0}
|
||||
}
|
||||
#break
|
||||
snippet break
|
||||
break ${1:label};
|
||||
#case
|
||||
snippet case
|
||||
case ${1:expression} :
|
||||
${0}
|
||||
break;
|
||||
#default
|
||||
snippet default
|
||||
default :
|
||||
${1}
|
||||
break;
|
||||
#switch
|
||||
snippet switch
|
||||
switch(${1:expression}) {
|
||||
case '${3:case}':
|
||||
${4}
|
||||
break;
|
||||
${0}
|
||||
default:
|
||||
${2}
|
||||
}
|
||||
#try
|
||||
snippet try
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
}
|
||||
#try catch finally
|
||||
snippet tryf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
} finally {
|
||||
}
|
||||
#throw
|
||||
snippet throw
|
||||
throw new ("${1:Exception()}");
|
||||
#ternary
|
||||
snippet ?
|
||||
? ${1:trueExpression} : ${2:falseExpression}
|
||||
${0}
|
||||
snippet if
|
||||
if (${1:true}) {${0}}
|
||||
# if ... else
|
||||
snippet ife
|
||||
if (${1:true}) {${2}}
|
||||
else{${0}}
|
||||
#get
|
||||
snippet get
|
||||
public ${1:String} get${2}() {
|
||||
return ${0:fieldName};
|
||||
}
|
||||
#set
|
||||
snippet set
|
||||
public void set${1}(${0:String} new${1}) {
|
||||
${1:fieldName} = new${1};
|
||||
}
|
||||
#printIn
|
||||
snippet println
|
||||
println("${1:`fnamemodify(bufname("%"),":t:r")`}::${2:method}() "${3: +} ${0});
|
||||
#println string
|
||||
snippet pr
|
||||
println("${0}");
|
||||
#setup draw
|
||||
snippet setup
|
||||
void setup(){
|
||||
${1}
|
||||
}
|
||||
|
||||
void draw(){
|
||||
${0}
|
||||
}
|
||||
#setup OPENGL
|
||||
snippet opengl
|
||||
import processing.opengl.*;
|
||||
import javax.media.opengl.*;
|
||||
|
||||
PGraphicsOpenGL pgl;
|
||||
GL gl;
|
||||
|
||||
void setup(){
|
||||
size( ${1:300}, ${2:300}, OPENGL );
|
||||
colorMode( RGB, 1.0 );
|
||||
hint( ENABLE_OPENGL_4X_SMOOTH );
|
||||
pgl = (PGraphicsOpenGL) g;
|
||||
gl = pgl.gl;
|
||||
gl.setSwapInterval(1);
|
||||
initGL();
|
||||
${3}
|
||||
}
|
||||
|
||||
void draw(){
|
||||
pgl.beginGL();
|
||||
${4}
|
||||
pgl.endGL();
|
||||
getOpenGLErrors();
|
||||
}
|
||||
|
||||
void initGL(){
|
||||
${0}
|
||||
}
|
||||
|
||||
void getOpenGLErrors(){
|
||||
int error = gl.glGetError();
|
||||
switch (error){
|
||||
case 1280 :
|
||||
println("GL_INVALID_ENUM - An invalid enumerant was passed to an OpenGL command.");
|
||||
break;
|
||||
case 1282 :
|
||||
println("GL_INVALID_OPERATION - An OpenGL command was issued that was invalid or inappropriate for the current state.");
|
||||
break;
|
||||
case 1281 :
|
||||
println("GL_INVALID_VALUE - A value was passed to OpenGL that was outside the allowed range.");
|
||||
break;
|
||||
case 1285 :
|
||||
println("GL_OUT_OF_MEMORY - OpenGL was unable to allocate enough memory to process a command.");
|
||||
break;
|
||||
case 1283 :
|
||||
println("GL_STACK_OVERFLOW - A command caused an OpenGL stack to overflow.");
|
||||
break;
|
||||
case 1284 :
|
||||
println("GL_STACK_UNDERFLOW - A command caused an OpenGL stack to underflow.");
|
||||
break;
|
||||
case 32817 :
|
||||
println("GL_TABLE_TOO_LARGE");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#GL Functions
|
||||
snippet gl begin gl
|
||||
pgl.beginGL();
|
||||
${0}
|
||||
pgl.endGL();
|
||||
snippet gl gl swap interval
|
||||
// specify the minimum swap interval for buffer swaps.
|
||||
gl.setSwapInterval(${0:interval});
|
||||
snippet gl gl call list
|
||||
// execute a display list
|
||||
gl.glCallList(${0:list});
|
||||
snippet gl gl gen buffers
|
||||
// import java.nio.IntBuffer;
|
||||
// import java.nio.FloatBuffer;
|
||||
// import com.sun.opengl.util.BufferUtil;
|
||||
|
||||
// You might need to create four buffers to store vertext data, normal data, texture coordinate data, and indices in vertex arrays
|
||||
IntBuffer bufferObjects = IntBuffer.allocate(${1:4});
|
||||
gl.glGenBuffers($1, bufferObjects);
|
||||
|
||||
int vertexCount = ${2:3};
|
||||
int numCoordinates = ${0:3};
|
||||
// vertexCount * numCoordinates
|
||||
FloatBuffer vertices = BufferUtil.newFloatBuffer(vertexCount * numCoordinates);
|
||||
float[] v = {0.0f, 0.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
0.0f, 1.0f, 1.0f};
|
||||
vertices.put(v);
|
||||
|
||||
// Bind the first buffer object ID for use with vertext array data
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferObjects.get(0));
|
||||
gl.glBufferData(GL.GL_ARRAY_BUFFER, vertexCount * numCoordinates * BufferUtil.SIZEOF_FLOAT, vertices, GL.GL_STATIC_DRAW);
|
||||
snippet gl gl bind buffer
|
||||
${0:// A buffer ID of zero unbinds a buffer object}
|
||||
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, ${1:0});
|
||||
snippet gl gl delete buffers
|
||||
${0:// Parameters are the same for glGenBuffers}
|
||||
gl.glDeleteBuffers(${1:4}, ${2:bufferObjects});
|
||||
snippet gl gl depth mask
|
||||
// enable or disable writing into the depth buffer
|
||||
gl.glDepthMask(${0:flag});
|
||||
snippet gl gl load identity
|
||||
// replaces the top of the active matrix stack with the identity matrix
|
||||
gl.glLoadIdentity();
|
||||
snippet gl gl tex coord 2f
|
||||
// set the current texture coordinates - 2 floats
|
||||
gl.glTexCoord2f(${1:0.0f}, ${0:0.0f});
|
||||
snippet gl gl vertex 2f
|
||||
gl.glVertex2f(${1:0.0f}, ${0:0.0f});
|
||||
snippet gl gl vertex 3f
|
||||
gl.glVertex3f(${1:0.0f}, ${2:0.0f}, ${0:0.0f});
|
||||
snippet gl gl translate f
|
||||
// multiply the current matrix by a translation matrix
|
||||
gl.glTranslatef(${1:x}, ${2:y}, ${0:z});
|
||||
snippet gl gl rotate f
|
||||
// rotate, x-axis, y-axis, z-axiz
|
||||
gl.glRotatef(${1:angle}, ${2:x}, ${3:y}, ${0:z});
|
||||
snippet gl gl scale f
|
||||
// multiply the current matrix by a general scaling matrix
|
||||
gl.glScalef(${1:x}, ${2:y}, ${0:z});
|
||||
snippet gl gl color 4f
|
||||
gl.glColor4f(${1:red}, ${2:green}, ${3:blue}, ${0:alpha});
|
||||
snippet gl gl clear color
|
||||
gl.glClearColor(${1:red}, ${2:green}, ${3:blue}, ${0:alpha});
|
||||
snippet gl gl color 3f
|
||||
gl.glColor3f(${1:red}, ${2:green}, ${0:blue});
|
||||
snippet gl gl push matrix
|
||||
// spush and pop the current matrix stack
|
||||
gl.glPushMatrix();
|
||||
${0}
|
||||
gl.glPopMatrix();
|
||||
snippet gl gl gen lists
|
||||
gl.glGenLists(${0:1})
|
||||
snippet gl gl flush
|
||||
// Empties buffers. Call this when all previous issues commands completed
|
||||
gl.glFlush();
|
||||
${0}
|
||||
snippet gl gl get error
|
||||
println(gl.glGetError());
|
||||
snippet gl gl clear
|
||||
gl.glClear(${1:GL.GL_COLOR_BUFFER_BIT}${2: | }${0:GL.GL_DEPTH_BUFFER_BIT});
|
||||
|
||||
#frame operations
|
||||
snippet frameRate
|
||||
frameRate(${1:30});
|
||||
${0}
|
||||
snippet saveFrame
|
||||
saveFrame("${1:filename-####}${0:.ext}");
|
||||
|
||||
#size
|
||||
snippet size normal
|
||||
size(${1:200}, ${2:200}${0:, P3D});
|
||||
snippet size opengl
|
||||
size(${1:200}, ${2:200}${0:, OPENGL});
|
||||
|
||||
#PRIMITIVES
|
||||
#color
|
||||
snippet color
|
||||
color ${1:c}${2: = color(}${3:value1, }${4:value2, }${0:value3)};
|
||||
#char
|
||||
snippet char
|
||||
char ${1:m}${2: = "}${0:char"};
|
||||
#float
|
||||
snippet float
|
||||
float ${1:f}${2: = }${0:0.0f};
|
||||
#int
|
||||
snippet int
|
||||
int ${1:f}${2: = }${0:0};
|
||||
#boolean
|
||||
snippet boolean
|
||||
boolean ${1:b}${2: = }${0:true};
|
||||
#byte
|
||||
snippet byte
|
||||
byte ${1:b}${2: = }${0:127};
|
||||
#string
|
||||
snippet string
|
||||
String ${1:str}${2: = "}${0:CCCP"};
|
||||
#array
|
||||
snippet array
|
||||
${1:int}[] ${2:numbers}${3: = new $1}[${0:length}];
|
||||
#object
|
||||
snippet object
|
||||
${1:Object} ${2:o}${3: = new $1}(${0});
|
||||
|
||||
#curve
|
||||
snippet curve
|
||||
curve(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3}, ${7:x4}, ${0:y4});
|
||||
snippet curve 3D
|
||||
curve(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${6:z2}, ${7:x3}, ${8:y3}, ${9:z3}, ${10:x4}, ${11:y4}, ${0:z4});
|
||||
snippet curveDetail
|
||||
curveDetail(${0:detail});
|
||||
snippet curvePoint
|
||||
curvePoint(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${0:t});
|
||||
snippet curveTightness
|
||||
curveTightness(${0:squishy});
|
||||
|
||||
#bezier
|
||||
snippet bezier
|
||||
bezier(${1:x1}, ${2:y1}, ${3:cx1}, ${4:cy1}, ${5:cx2}, ${6:cy2}, ${7:x2}, ${0:y2});
|
||||
snippet bezier 3D
|
||||
bezier(${1:x1}, ${2:y1}, ${3:z1}, ${4:cx1}, ${5:cy1}, ${6:cz1}, ${7:cx2}, ${8:cy2}, ${9:cz2}, ${10:x2}, ${11:y2}, ${0:z2});
|
||||
snippet bezierDetail
|
||||
bezierDetail(${0:detail});
|
||||
snippet bezierTangent
|
||||
bezierTangent(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${0:t});
|
||||
snippet bezierPoint
|
||||
bezierPoint(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${0:t});
|
||||
|
||||
#vertex
|
||||
snippet vertex
|
||||
vertex(${1:x}, ${2:y}${3:, }${4:u}${5:, }${0:v});
|
||||
snippet vertex 3D
|
||||
vertex(${1:x}, ${2:y}, ${3:z}${4:, }${5:u}${6:, }${0:v});
|
||||
snippet bezierVertex
|
||||
bezierVertex(${1:cx1}, ${2:cy1}, ${3:cx2}, ${4:cy2}, ${5:x}, ${0:y});
|
||||
snippet bezierVertex 3D
|
||||
bezierVertex(${1:cx1}, ${2:cy1}, ${3:cz1}, ${4:cx2}, ${5:cy2}, ${6:cz2}, ${7:x}, ${8:y}, ${0:z});
|
||||
snippet curveVertex
|
||||
curveVertex(${1:x}, ${0:y});
|
||||
snippet curveVertex 3D
|
||||
curveVertex(${1:x}, ${2:y}, ${0:z});
|
||||
|
||||
#stroke
|
||||
snippet stroke
|
||||
stroke(${1:value1}, ${2:value2}, ${3:value3}${4:, }${0:alpha});
|
||||
snippet strokeWeight
|
||||
strokeWeight(${0:1});
|
||||
|
||||
#mouse
|
||||
snippet mouseDragged
|
||||
void mouseDragged(){
|
||||
${0}
|
||||
}
|
||||
snippet mouseMoved
|
||||
void mouseMoved(){
|
||||
${0}
|
||||
}
|
||||
snippet mouseReleased
|
||||
void mouseReleased(){
|
||||
${0}
|
||||
}
|
||||
snippet mousePressed
|
||||
void mousePressed(){
|
||||
${0}
|
||||
}
|
||||
|
||||
#key
|
||||
snippet keyReleased
|
||||
void keyReleased(){
|
||||
${0}
|
||||
}
|
||||
snippet keyTyped
|
||||
void keyTyped(){
|
||||
${0}
|
||||
}
|
||||
snippet keyPressed
|
||||
void keyPressed(){
|
||||
${0}
|
||||
}
|
||||
|
||||
#file
|
||||
snippet loadStrings
|
||||
loadStrings("${0:filename}");
|
||||
snippet saveStrings
|
||||
saveStrings(${1:filename}, ${0:strings});
|
||||
snippet loadBytes
|
||||
loadBytes("${0:filename}");
|
||||
snippet beginRecord
|
||||
beginRecord(${1:renderer}, ${0:filename});
|
||||
snippet saveBytes
|
||||
saveBytes(${1:filename}, ${0:bytes});
|
||||
snippet createWriter
|
||||
createWriter(${0:filename});
|
||||
snippet createReader
|
||||
createReader(${0:filename});
|
||||
|
||||
#matrix
|
||||
snippet pushMatrix
|
||||
pushMatrix();
|
||||
${0:};
|
||||
popMatrix();
|
||||
|
||||
|
||||
#text
|
||||
snippet text data
|
||||
text(${1:data}, ${2:x}, ${3:y}${4:, }${0:z});
|
||||
snippet text stringdata
|
||||
text(${1:stringdata}, ${2:x}, ${3:y}, ${4:width}, ${5:height}${6:, }${0:z});
|
||||
snippet textSize
|
||||
textSize(${0:size});
|
||||
snippet textLeading
|
||||
textLeading(${0:size});
|
||||
snippet textWidth
|
||||
textWidth(${0:data});
|
||||
snippet font
|
||||
PFont ${1:font};
|
||||
$1 = loadFont("${0:FFScala-32.vlw}");
|
||||
#load font
|
||||
snippet loadFont
|
||||
${1:font} = loadFont("${0:FFScala-32.vlw}");
|
||||
snippet textFont
|
||||
textFont(${1:font}${2:, }${0:size});
|
||||
|
||||
#math
|
||||
snippet tan
|
||||
tan(${0:rad});
|
||||
snippet atan
|
||||
atan(${0:rad});
|
||||
snippet atan2
|
||||
atan2(${0:rad});
|
||||
snippet sin
|
||||
sin(${0:rad});
|
||||
snippet asin
|
||||
asin(${0:rad});
|
||||
snippet cos
|
||||
cos(${0:rad});
|
||||
snippet acos
|
||||
acos(${0:rad});
|
||||
snippet degrees
|
||||
degrees(${0:rad});
|
||||
snippet radians
|
||||
radians(${0:deg});
|
||||
snippet randomSseed
|
||||
randomSeed(${0:value});
|
||||
snippet random
|
||||
random(${1:value1}${2:, }${0:value2});
|
||||
snippet pow
|
||||
pow(${1:num}, ${0:exponent});
|
||||
snippet floor
|
||||
floor(${0:value});
|
||||
snippet sqrt
|
||||
sqrt(${0:value});
|
||||
snippet abs
|
||||
abs(${0:value});
|
||||
snippet sq
|
||||
sq(${0:value});
|
||||
snippet ceil
|
||||
ceil(${0:value});
|
||||
snippet exp
|
||||
exp(${0:value});
|
||||
snippet round
|
||||
round(${0:value}};
|
||||
snippet min
|
||||
min(${1:value1}, ${2:value2}${3:, }${0:value3});
|
||||
snippet max
|
||||
max(${1:value1}, ${2:value2}${3:, }${0:value3});
|
||||
snippet max array
|
||||
max(${0:array});
|
||||
snippet min array
|
||||
min(${0:array});
|
||||
snippet log
|
||||
log(${0:value});
|
||||
snippet map
|
||||
map(${1:value}, ${2:low1}, ${4:high1}, ${5:low2}, ${0:high2});
|
||||
snippet norm
|
||||
norm(${1:value}, ${2:low}, ${0:high});
|
||||
snippet constrain
|
||||
constrain(${1:value}, ${2:min}, ${0:max});
|
||||
snippet mag
|
||||
mag(${1:a}, ${2:b}${3:, }${0:c});
|
||||
snippet dist
|
||||
dist(${1:x1}, ${2:y1}, ${4:x2}, ${0:y2});
|
||||
snippet dist 3D
|
||||
dist(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${0:z2});
|
||||
|
||||
#noise math
|
||||
snippet noise
|
||||
noise(${1:x}${2:, }${3:y}${4:, }${0:z});
|
||||
snippet noiseDetail
|
||||
noiseDetail(${1:octaves}${2:, }${0:falloff});
|
||||
snippet noiseSeed
|
||||
noiseSeed(${0:x});
|
||||
|
||||
#material
|
||||
snippet shininess
|
||||
shininess(${0:shine});
|
||||
snippet specular
|
||||
specular(${1:value1}, ${2:value2}, ${3:value3}${4:, }${0:alpha});
|
||||
snippet ambient
|
||||
ambient(${1:value1}, ${2:value2}, ${0:value3});
|
||||
snippet emissive
|
||||
emissive(${1:value1}, ${2:value2}, ${0:value3});
|
||||
|
||||
#light
|
||||
snippet diretionalLight
|
||||
directionalLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:nx}, ${5:ny}, ${0:nz});
|
||||
snippet pointLight
|
||||
pointLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:nx}, ${5:ny}, ${0:nz});
|
||||
snippet lightFalloff
|
||||
lightFalloff(${1:constant}, ${2:linear}, ${0:quadratic});
|
||||
snippet normal
|
||||
normal(${1:nx}, ${2:ny}, ${0:nz});
|
||||
snippet lightSpecular
|
||||
lightSpecular(${1:v1}, ${2:v2}, ${0:v3});
|
||||
snippet ambientLight
|
||||
ambientLight(${1:v1}, ${2:v2}, ${3:v3}${7:, ${4:x}, ${5:y}, ${0:z}});
|
||||
snippet spotLight
|
||||
spotLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:x}, ${5:y}, ${6:z}, ${7:nx}, ${8:ny}, ${9:nz}, ${10:angle}, ${0:concentration});
|
||||
|
||||
#camera
|
||||
snippet camera
|
||||
camera(${1:eyeX}, ${2:eyeY}, ${3:eyeZ}, ${4:centerX}, ${5:centerY}, ${6:centerZ}, ${7:upX}, ${8:upY}, ${0:upZ});
|
||||
snippet ortho
|
||||
ortho(${1:left}, ${2:right}, ${3:bottom}, ${4:top}, ${5:near}, ${0:far});
|
||||
snippet perspective
|
||||
perspective(${1:fov}, ${2:aspect}, ${3:zNear}, ${0:zFar});
|
||||
snippet frustrum
|
||||
frustrum(${1:left}, ${2:right}, ${3:bottom}, ${4:top}, ${5:near}, ${0:far});
|
||||
|
||||
#transformations
|
||||
snippet rotate
|
||||
rotate${1:X}(${0:angle});
|
||||
snippet translate
|
||||
translate(${1:x}, ${2:y}${3:, }${0:z});
|
||||
snippet scale size
|
||||
scale(${0:size});
|
||||
snippet scale
|
||||
scale(${1:x}, ${2:y}${3:, }${0:z});
|
||||
|
||||
#coordinates
|
||||
snippet coord
|
||||
${1:model/screen}${2:X}(${3:x}, ${4:y}, ${0:z});
|
||||
|
||||
#effects
|
||||
snippet brightness
|
||||
brightness(${0:color});
|
||||
snippet lerpColor
|
||||
lerpColor(${1:c1}, ${2:c2}, ${0:amt});
|
||||
snippet saturation
|
||||
saturation(${0:color});
|
||||
snippet hue
|
||||
hue(${0:color});
|
||||
snippet alpha
|
||||
alpha(${0:color});
|
||||
snippet tint
|
||||
tint(${1:value1}, ${2:value2}, ${3:value3}${4:, }${0:alpha});
|
||||
|
||||
#pixel
|
||||
snippet set pixel
|
||||
set(${1:x}, ${2:y}, ${0:color/image});
|
||||
snippet pixels
|
||||
pixels[${0:index}]
|
||||
snippet get pixel
|
||||
get(${1:x}, ${2:y}${3:, }${4:width}${5:, }${0:height});
|
||||
|
||||
#geometric figures
|
||||
snippet triangle
|
||||
triangle(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${0:y3});
|
||||
snippet line
|
||||
line(${1:x1}, ${2:y1}, ${3:x2}, ${0:y2});
|
||||
snippet line 3D
|
||||
line(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${0:z2});
|
||||
snippet arc
|
||||
arc(${1:x}, ${2:y}, ${3:width}, ${4:height}, ${5:start}, ${0:stop});
|
||||
snippet point
|
||||
point(${1:x}, ${2:y}${3:, }${0:z});
|
||||
snippet quad
|
||||
quad(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3}, ${7:x4}, ${0:y4});
|
||||
snippet ellipse
|
||||
ellipse(${1:x}, ${2:y}, ${3:width}, ${0:height});
|
||||
snippet rect
|
||||
rect(${1:x}, ${2:y}, ${3:width}, ${0:height});
|
||||
snippet box
|
||||
box(${1:width}, ${2:height}, ${0:depth});
|
||||
snippet sphere
|
||||
sphere(${0:radius});
|
||||
snippet sphereDetails
|
||||
sphereDetail(${0:n});
|
||||
|
||||
#array operations
|
||||
snippet split
|
||||
split("${1:str}"${2: , }${0:delimiter});
|
||||
snippet splitTokens
|
||||
splitTokens(${1:str}${2:, }${0:tokens});
|
||||
snippet join
|
||||
join(${1:strgArray}${2: , }${0:seperator});
|
||||
snippet shorten
|
||||
shorten(${0:array});
|
||||
snippet concat
|
||||
concat(${1:array1}, ${0:array2});
|
||||
snippet subset
|
||||
subset(${1:array}, ${0:offset});
|
||||
snippet append
|
||||
append(${1:array}, ${0:element});
|
||||
snippet reverse
|
||||
reverse(${0:array});
|
||||
snippet splice
|
||||
splice(${1:array}, ${2:value/array2}, ${0:index});
|
||||
snippet sort
|
||||
sort(${1:dataArray}${2:, }${0:count});
|
||||
snippet expand
|
||||
expand(${1:array}${2:, }${0:newSize});
|
||||
snippet arrayCopy
|
||||
arrayCopy(${1:src}, ${2:dest}, ${3:, }${0:length});
|
||||
|
||||
#string operations
|
||||
snippet str
|
||||
str("${0:str}");
|
||||
snippet match
|
||||
match(${1:str}, ${0:regexp});
|
||||
snippet trim
|
||||
trim(${0:str});
|
||||
snippet nf
|
||||
nf(${2:value}, ${3:left}${4:, }${0:right});
|
||||
snippet nfs
|
||||
nfs(${2:value}, ${3:left}${4:, }${0:right});
|
||||
snippet nfp
|
||||
nfp(${2:value}, ${3:left}${4:, }${0:right});
|
||||
snippet nfc
|
||||
nfc(${1:value}${2:, }${0:right});
|
||||
|
||||
#convert
|
||||
snippet unbinary
|
||||
unbinary("${0:str}"});
|
||||
snippet hexadecimal
|
||||
hex(${0:c});
|
||||
snippet unhex
|
||||
unhex(${0:c});
|
||||
snippet binary
|
||||
binary(${1:value}${2:, }${0:digits});
|
||||
|
||||
#image operations
|
||||
snippet loadImage
|
||||
loadImage(${0:filename});
|
||||
snippet image
|
||||
image(${1:img}, ${2:x}, ${3:y}${4:, }${5:width}${6:, }${0:height});
|
||||
snippet copy
|
||||
copy(${1:srcImg}${2:, }${3:x}, ${4:y}, ${5:width}, ${6:height}, ${7:dx}, ${8:dy}, ${9:dwidth}, ${0:dheight});
|
||||
|
||||
|
||||
|
||||
#containers
|
||||
snippet bg
|
||||
background(${1:value1}, ${2:value2}, ${3:value3}${4:, }${0:alpha});
|
||||
snippet pg
|
||||
PGraphics pg;
|
||||
pg = createGraphics(${1:width}, ${2:height}${3:, }${0:applet});
|
||||
snippet pimage
|
||||
PImage(${1:width}, ${0:height});
|
||||
|
||||
#UTILS
|
||||
#fill
|
||||
snippet fill
|
||||
fill(${1:value1}, ${2:value2}, ${3:value3}${4:, }${0:alpha});
|
||||
#red
|
||||
snippet red
|
||||
red(${0:color});
|
||||
#green
|
||||
snippet green
|
||||
green(${0:color});
|
||||
#blue
|
||||
snippet blue
|
||||
blue(${0:color});
|
||||
#status
|
||||
snippet status
|
||||
status(${0:text});
|
||||
#param
|
||||
snippet param
|
||||
param(${0:s});
|
||||
#link
|
||||
snippet link
|
||||
link(${1:url}${2:, }${0:target});
|
||||
#@param
|
||||
snippet @
|
||||
@${1:param/return/private/public} ${1:parameter} ${0:description}
|
@ -1,58 +0,0 @@
|
||||
# Progress/OpenEdge ABL snippets
|
||||
# define
|
||||
snippet defbuf
|
||||
DEFINE BUFFER b_${1:TableName} FOR $1 ${0}.
|
||||
snippet defvar
|
||||
DEFINE VARIABLE ${1:VariableName} AS ${0}.
|
||||
snippet nl
|
||||
NO-LOCK
|
||||
snippet ne
|
||||
NO-ERROR
|
||||
snippet nle
|
||||
NO-LOCK NO-ERROR
|
||||
snippet ini
|
||||
INITIAL ${0:?}
|
||||
snippet nu
|
||||
NO-UNDO
|
||||
snippet err
|
||||
ERROR
|
||||
snippet ff
|
||||
FIND FIRST ${1:BufferName}
|
||||
${2:WHERE $1.${3}} ${0}
|
||||
snippet input
|
||||
DEFINE INPUT PARAMETER ${1:ParamName} AS ${0}.
|
||||
snippet output
|
||||
DEFINE OUTPUT PARAMETER ${1:ParamName} AS ${0:ParamType}.
|
||||
snippet proc
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
PROCEDURE ${1:ProcName}:
|
||||
|
||||
${0}
|
||||
|
||||
END PROCEDURE. /* $1 */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
snippet alert
|
||||
MESSAGE "${1:MessageContent}" ${2:Data} VIEW-AS ALERT-BOX.
|
||||
snippet if
|
||||
IF ${1:Condition}
|
||||
THEN ${2:Action}
|
||||
${3:ELSE ${4:OtherWise}}
|
||||
snippet do
|
||||
DO${1: Clauses}:
|
||||
${0}
|
||||
END.
|
||||
# datatypes
|
||||
snippet int
|
||||
INTEGER
|
||||
snippet char
|
||||
CHARACTER
|
||||
snippet log
|
||||
LOGICAL
|
||||
snippet dec
|
||||
DECIMAL
|
||||
snippet sep
|
||||
/* ------------------------------------------------------------------------- */
|
@ -1,101 +0,0 @@
|
||||
# Snippets for
|
||||
# Authored by Trevor Sullivan <trevor@trevorsullivan.net>
|
||||
|
||||
# PowerShell Class
|
||||
snippet class
|
||||
class {
|
||||
[string] ${1:FirstName}
|
||||
}
|
||||
|
||||
# PowerShell Advanced Function
|
||||
snippet function
|
||||
function ${1:name} {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] ${2:Param}
|
||||
)
|
||||
|
||||
begin {
|
||||
}
|
||||
|
||||
process {
|
||||
}
|
||||
|
||||
end {
|
||||
}
|
||||
}
|
||||
|
||||
# PowerShell Splatting
|
||||
snippet splatting
|
||||
$Params = @{
|
||||
${1:Param1} = '${2:Value1}'
|
||||
${3:Param2} = '${4:Value2}'
|
||||
}
|
||||
${5:CommandName} @Params
|
||||
|
||||
# PowerShell Enumeration
|
||||
snippet enum
|
||||
enum ${1:name} {
|
||||
${2:item1}
|
||||
${3:item2}
|
||||
}
|
||||
|
||||
# PowerShell if..then
|
||||
snippet if
|
||||
if ($1) {
|
||||
$0
|
||||
}
|
||||
|
||||
# PowerShell if..else
|
||||
snippet ife
|
||||
if ( $1 ) {
|
||||
${2}
|
||||
}
|
||||
else {
|
||||
${3}
|
||||
}
|
||||
|
||||
# PowerShell While Loop
|
||||
snippet while
|
||||
while ($1) {
|
||||
$0
|
||||
}
|
||||
|
||||
# PowerShell Filter..Sort
|
||||
snippet filtersort
|
||||
${1:command} | Where-Object -FilterScript { $PSItem.${2:property} -${3:operator} '${4:expression}' } | Sort-Object -Property ${5:sortproperty}
|
||||
|
||||
# PowerShell foreach
|
||||
snippet foreach
|
||||
foreach ( $${1:iterator} in $${2:collection} ) {
|
||||
$0
|
||||
}
|
||||
|
||||
# PowerShell export-csv
|
||||
snippet epcsv
|
||||
Export-CSV -NoTypeInformation -Path ${1:path}
|
||||
|
||||
# Powershell Comment Based Help
|
||||
snippet help
|
||||
<#
|
||||
.SYNOPSIS
|
||||
${1:Short Description}
|
||||
.DESCRIPTION
|
||||
${2:Full Description}
|
||||
.PARAMETER ${3:Param1}
|
||||
${4: $3 usage}
|
||||
.EXAMPLE
|
||||
${5:Example}
|
||||
.NOTES
|
||||
${6:notes}
|
||||
.LINK
|
||||
${7:online help}
|
||||
#>
|
||||
|
||||
# Powershell switch statement
|
||||
snippet switch
|
||||
switch ( ${1:test} ){
|
||||
${2:condition1} { ${3:action} }
|
||||
${4:condition2} { ${5:action} }
|
||||
default { ${6:action} }
|
@ -1,245 +0,0 @@
|
||||
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
|
||||
#
|
||||
# Please contact Jorge Vidal <im@jor.ge> for additions and feedback,
|
||||
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
|
||||
# Many thanks to the original author R.I.Pienaar <rip@devco.net>
|
||||
|
||||
# Header using Puppet Strings (YARD tags) https://puppet.com/docs/puppet/latest/modules_documentation.html
|
||||
# More info: https://github.com/puppetlabs/puppet-strings
|
||||
snippet classheader
|
||||
# ${1:`vim_snippets#Filename(substitute(expand('%:p:s?\v.{-}/(\w+)/manifests/(.+)\.pp?\1/\2?'), '/', '::', 'g'), 'class-name')`}
|
||||
# ${2:A description of what this class does}
|
||||
#
|
||||
# @summary ${3:A short summary of the purpose of this class}
|
||||
#
|
||||
# @param ${4:parameter1}
|
||||
# ${6:Explanation of what this parameter affects.}
|
||||
#
|
||||
# @example Simple use
|
||||
# include $1
|
||||
#
|
||||
# @example Use with params
|
||||
# class { '$1':
|
||||
# $$4 => '${7:undef}',
|
||||
# }
|
||||
#
|
||||
# @author ${8:`g:snips_author`} <${9:`g:snips_email`}>
|
||||
#
|
||||
# @note Copyright `strftime("%Y")` $8
|
||||
#
|
||||
class $1(
|
||||
${5:String} $$4 = undef,
|
||||
) {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet defheader
|
||||
# ${1:`vim_snippets#Filename(expand('%:p:s?.*modules/??:h:h'), 'define-name')`}
|
||||
# ${2:A description of what this define does}
|
||||
#
|
||||
# @summary ${3:A short summary of the purpose of this define}
|
||||
#
|
||||
# @param ${4:parameter1} [${5:String}]
|
||||
# ${6:Explanation of what this parameter affects.}
|
||||
#
|
||||
# @example Simple use
|
||||
# $1 { 'namevar':
|
||||
# $$4 => '${7:undef}',
|
||||
# }
|
||||
#
|
||||
# @author ${8:`g:snips_author`} <${9:`g:snips_email`}>
|
||||
#
|
||||
# @note Copyright `strftime("%Y")` $8
|
||||
#
|
||||
define $1(
|
||||
$$4 = undef,
|
||||
) {
|
||||
${0}
|
||||
}
|
||||
|
||||
# Language Constructs
|
||||
snippet class
|
||||
class ${1:`vim_snippets#Filename('', 'name')`} {
|
||||
${0}
|
||||
}
|
||||
snippet node
|
||||
node "${1:`vim_snippets#Filename('', 'fqdn')`}" {
|
||||
${0}
|
||||
}
|
||||
snippet case
|
||||
case $${1:variable} {
|
||||
default: { ${0} }
|
||||
}
|
||||
snippet ife
|
||||
if $${1:variable} {
|
||||
${2}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
snippet if
|
||||
if $${1:variable} {
|
||||
${0}
|
||||
}
|
||||
snippet ifd
|
||||
if defined(${1:Resource}["${2:name}"]) {
|
||||
${0}
|
||||
}
|
||||
snippet ifnd
|
||||
if !defined(${1:Resource}["${2:name}"]) {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
snippet ?
|
||||
? {
|
||||
"${1}" => ${0}
|
||||
}
|
||||
#
|
||||
# blocks etc and general syntax sugar
|
||||
snippet [
|
||||
[ ${1} ]
|
||||
snippet >
|
||||
${1} => ${0}
|
||||
snippet p:
|
||||
"puppet://puppet/${1:module name}/${0:file name}"
|
||||
#
|
||||
# Functions
|
||||
snippet alert
|
||||
alert("${1:message}")
|
||||
snippet crit
|
||||
crit("${1:message}")
|
||||
snippet debug
|
||||
debug("${1:message}")
|
||||
snippet defined
|
||||
defined(${1:Resource}["${2:name}"])
|
||||
snippet emerg
|
||||
emerg("${1:message}")
|
||||
snippet extlookup Simple extlookup
|
||||
extlookup("${1:variable}")
|
||||
snippet extlookup Extlookup with defaults
|
||||
extlookup("${1:variable}", "${2:default}")
|
||||
snippet extlookup Extlookup with defaults and custom data file
|
||||
extlookup("${1:variable}", "${2:default}", "${3:data source}")
|
||||
snippet fail
|
||||
fail("${1:message}")
|
||||
snippet info
|
||||
info("${1:message}")
|
||||
snippet inline_template
|
||||
inline_template("<%= ${1} %>")
|
||||
snippet notice
|
||||
notice("${1:message}")
|
||||
snippet realize
|
||||
realize(${1:Resource}[${2:name}])
|
||||
snippet regsubst
|
||||
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")
|
||||
snippet inc
|
||||
include ${1:classname}
|
||||
snippet split
|
||||
split(${1:hay stack}, "${2:patten}")
|
||||
snippet versioncmp
|
||||
versioncmp("${1:version}", "${2:version}")
|
||||
snippet warning
|
||||
warning("${1:message}")
|
||||
#
|
||||
# Types
|
||||
snippet cron
|
||||
cron { "${1:name}":
|
||||
command => "${2}",
|
||||
user => "${3:root}",
|
||||
${4} => ${0},
|
||||
}
|
||||
|
||||
snippet exec
|
||||
exec { "${1:name}":
|
||||
command => "${2:$1}",
|
||||
user => "${3:root}",
|
||||
${4} => ${0},
|
||||
}
|
||||
|
||||
snippet user
|
||||
user { "${1:user}":
|
||||
ensure => present,
|
||||
comment => "${2:$1}",
|
||||
managehome => true,
|
||||
home => "${0:/home/$1}",
|
||||
}
|
||||
|
||||
snippet group
|
||||
group { "${1:group}":
|
||||
ensure => ${0:present},
|
||||
}
|
||||
|
||||
snippet host
|
||||
host { "${1:hostname}":
|
||||
ip => ${0:127.0.0.1},
|
||||
}
|
||||
|
||||
snippet mailalias
|
||||
mailalias { "${1:localpart}":
|
||||
recipient => "${0:recipient}",
|
||||
}
|
||||
|
||||
snippet mount
|
||||
mount { "${1:destination path}":
|
||||
ensure => ${2:mounted},
|
||||
device => "${0:device name or path}",
|
||||
}
|
||||
|
||||
snippet notify
|
||||
notify { "${1:message}": }
|
||||
|
||||
snippet package
|
||||
package { "${1:package name}":
|
||||
ensure => ${0:present},
|
||||
}
|
||||
|
||||
snippet yumrepo
|
||||
yumrepo { "${1:repo name}":
|
||||
descr => "${2:$1}",
|
||||
enabled => ${0:1},
|
||||
}
|
||||
|
||||
snippet define
|
||||
define ${1} (${2}) {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet service
|
||||
service { "${1:service}":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => [ Package["${2:package}"], File["${3:file}"], ],
|
||||
subscribe => [ File["${4:configfile1}"], File["${5:configfile2}"], Package["${6:package}"], ],
|
||||
}
|
||||
|
||||
snippet file
|
||||
file { "${1:filename}":
|
||||
ensure => ${2:present},
|
||||
owner => "${3:root}",
|
||||
group => "${4:root}",
|
||||
mode => "${5:0644}",
|
||||
source => "puppet:///modules/${6:module}/${7:source}",
|
||||
content => template("${8:module}/${9:template}"),
|
||||
alias => "${10:alias}",
|
||||
require => [ Package["${11:package}"], File["${12:file}"], ],
|
||||
}
|
||||
|
||||
snippet archive
|
||||
archive { "${1:filename}":
|
||||
ensure => ${2:present},
|
||||
url => "http://${3:url}",
|
||||
extension => "${4:tgz}",
|
||||
target => "${5:target}",
|
||||
checksum => ${6:false},
|
||||
src_target => "${7:/tmp}",
|
||||
}
|
||||
|
||||
snippet firewall
|
||||
firewall { "${1:comment}":
|
||||
proto => ${2:tcp},
|
||||
action => ${3:accept},
|
||||
port => ${4},
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')`
|
||||
(
|
||||
) where
|
||||
|
||||
import Prelude
|
||||
|
||||
${0}
|
||||
snippet imp
|
||||
import ${0:Data.List}
|
||||
snippet impq
|
||||
import ${1:Data.List} as ${0:List}
|
||||
snippet fn0
|
||||
${1:name} :: ${2:a}
|
||||
$1 = ${0:undefined}
|
||||
snippet fn
|
||||
${1:fn} :: ${2:a} -> ${3:a}
|
||||
$1 ${4}= ${0}
|
||||
snippet fn1
|
||||
${1:fn} :: ${2:a} -> ${3:a}
|
||||
$1 ${4}= ${0}
|
||||
snippet fn2
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5}= ${0}
|
||||
snippet fn3
|
||||
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6}= ${0}
|
||||
snippet case
|
||||
case ${1} of
|
||||
${2} -> ${0}
|
||||
snippet let
|
||||
let
|
||||
${1} = ${2}
|
||||
in
|
||||
${3}
|
||||
snippet where
|
||||
where
|
||||
${1} = ${0}
|
||||
snippet testunit
|
||||
module Test.Main where
|
||||
|
||||
import Prelude
|
||||
import Test.Unit (suite, test)
|
||||
import Test.Unit.Main (runTest)
|
||||
import Test.Unit.Assert as Assert
|
||||
|
||||
main = runTest do
|
||||
suite "${1}" do
|
||||
test "${2:the tests run}" do
|
||||
Assert.equal
|
||||
"Hello, world!"
|
||||
"Hello, sailor!"
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet ty
|
||||
type ${1:Type} =
|
||||
${0}
|
||||
snippet da
|
||||
data ${1:Type} =
|
||||
${0:$1}
|
||||
snippet nty
|
||||
newtype ${1:Type} =
|
||||
${2:$1} ${0:Int}
|
||||
snippet fi
|
||||
foreign import ${1} :: ${2}
|
@ -1,523 +0,0 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env python3
|
||||
snippet #!2
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet #!3
|
||||
#!/usr/bin/env python3
|
||||
snippet imp
|
||||
import ${0:module}
|
||||
snippet uni
|
||||
def __unicode__(self):
|
||||
${0:representation}
|
||||
snippet from
|
||||
from ${1:package} import ${0:module}
|
||||
|
||||
# Module Docstring
|
||||
snippet docs
|
||||
"""
|
||||
File: ${1:`vim_snippets#Filename('$1.py', 'foo.py')`}
|
||||
Author: `g:snips_author`
|
||||
Email: `g:snips_email`
|
||||
Github: `g:snips_github`
|
||||
Description: ${0}
|
||||
"""
|
||||
|
||||
# Unittest skip
|
||||
snippet sk "skip unittests" b
|
||||
@unittest.skip(${1:skip_reason})
|
||||
|
||||
snippet wh
|
||||
while $1:
|
||||
${0:${VISUAL}}
|
||||
|
||||
# dowh - does the same as do...while in other languages
|
||||
snippet dowh
|
||||
while True:
|
||||
${1}
|
||||
if $0:
|
||||
break
|
||||
|
||||
snippet with
|
||||
with ${1:expr} as ${2:var}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
snippet awith
|
||||
async with ${1:expr} as ${2:var}:
|
||||
${0:${VISUAL}}
|
||||
|
||||
# New Class
|
||||
snippet cl
|
||||
class ${1:ClassName}(${2:object}):
|
||||
"""${3:docstring for $1}"""
|
||||
def __init__(self, ${4:arg}):
|
||||
${5:super($1, self).__init__()}
|
||||
self.$4 = $4
|
||||
${0}
|
||||
snippet cla
|
||||
class ${1:class_name}:
|
||||
"""${0:description}"""
|
||||
|
||||
snippet clai
|
||||
class ${1:class_name}:
|
||||
"""${2:description}"""
|
||||
def __init__(self, ${3:args}):
|
||||
${0}
|
||||
|
||||
# Data class
|
||||
snippet dcl dataclass
|
||||
@dataclass
|
||||
class ${1:ClassName}:
|
||||
"""${2:description}"""
|
||||
${3:var_1}: ${4:int}
|
||||
${5:var_2}: ${6:float} = ${7:0}
|
||||
|
||||
def ${8:total}(self): -> $6:
|
||||
return ${0:self.$3 * self.$5}
|
||||
|
||||
# New Function
|
||||
snippet def
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
"""${3:docstring for $1}"""
|
||||
${0}
|
||||
snippet deff
|
||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0}
|
||||
snippet adef
|
||||
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
"""${3:docstring for $1}"""
|
||||
${0}
|
||||
snippet adeff
|
||||
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0}
|
||||
|
||||
# New Method
|
||||
snippet defi
|
||||
def __init__(self, ${1:args}):
|
||||
${0}
|
||||
snippet defm
|
||||
def ${1:mname}(self, ${2:arg}):
|
||||
${0}
|
||||
snippet adefm
|
||||
async def ${1:mname}(self, ${2:arg}):
|
||||
${0}
|
||||
|
||||
# New Property
|
||||
snippet property
|
||||
@property
|
||||
def ${1:foo}(self) -> ${2:type}:
|
||||
"""${3:doc}"""
|
||||
return self._$1
|
||||
|
||||
@$1.setter
|
||||
def $1(self, value: $2):
|
||||
self._$1 = value
|
||||
|
||||
# Ifs
|
||||
snippet if
|
||||
if $1:
|
||||
${0:${VISUAL}}
|
||||
snippet el
|
||||
else:
|
||||
${0:${VISUAL}}
|
||||
snippet ei
|
||||
elif $1:
|
||||
${0:${VISUAL}}
|
||||
|
||||
# Match
|
||||
snippet match Structural pattern matching
|
||||
match ${1:expression}:
|
||||
case ${2:pattern_1}:
|
||||
${3:pass}
|
||||
case ${4:pattern_2}:
|
||||
${5:pass}
|
||||
|
||||
# Match with wildcard
|
||||
snippet matchw Pattern matching with wildcard
|
||||
match ${1:expression}:
|
||||
case ${2:pattern_1}:
|
||||
${3:pass}
|
||||
case _:
|
||||
${0:pass}
|
||||
|
||||
# For
|
||||
snippet for
|
||||
for ${1:item} in ${2:items}:
|
||||
${0}
|
||||
|
||||
# Encodes
|
||||
snippet cutf8
|
||||
# -*- coding: utf-8 -*-
|
||||
snippet clatin1
|
||||
# -*- coding: latin-1 -*-
|
||||
snippet cascii
|
||||
# -*- coding: ascii -*-
|
||||
|
||||
# Lambda
|
||||
snippet ld
|
||||
${1:var} = lambda ${2:vars} : ${0:action}
|
||||
|
||||
snippet ret
|
||||
return ${0}
|
||||
snippet .
|
||||
self.
|
||||
snippet sa self.attribute = attribute
|
||||
self.${1:attribute} = $1
|
||||
|
||||
snippet try Try/Except
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${0:raise $3}
|
||||
snippet trye Try/Except/Else
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${0}
|
||||
snippet tryf Try/Except/Finally
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
finally:
|
||||
${0}
|
||||
snippet tryef Try/Except/Else/Finally
|
||||
try:
|
||||
${1:${VISUAL}}
|
||||
except ${2:Exception} as ${3:e}:
|
||||
${4:raise $3}
|
||||
else:
|
||||
${5}
|
||||
finally:
|
||||
${0}
|
||||
|
||||
# if __name__ == '__main__':
|
||||
snippet ifmain
|
||||
if __name__ == '__main__':
|
||||
${0:main()}
|
||||
# __magic__
|
||||
snippet _
|
||||
__${1:init}__
|
||||
|
||||
# debugger breakpoint
|
||||
snippet br
|
||||
breakpoint()
|
||||
# python debugger (pdb)
|
||||
snippet pdb
|
||||
__import__('pdb').set_trace()
|
||||
# bpython debugger (bpdb)
|
||||
snippet bpdb
|
||||
__import__('bpdb').set_trace()
|
||||
# ipython debugger (ipdb)
|
||||
snippet ipdb
|
||||
__import__('ipdb').set_trace()
|
||||
# embed ipython itself
|
||||
snippet iem
|
||||
__import__('IPython').embed()
|
||||
# remote python debugger (rpdb)
|
||||
snippet rpdb
|
||||
__import__('rpdb').set_trace()
|
||||
# web python debugger (wdb)
|
||||
snippet wdb
|
||||
__import__('wdb').set_trace()
|
||||
# ptpython
|
||||
snippet ptpython
|
||||
__import__('ptpython.repl', fromlist=('repl')).embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
|
||||
# python console debugger (pudb)
|
||||
snippet pudb
|
||||
__import__('pudb').set_trace()
|
||||
# python console debugger remote (pudb)
|
||||
snippet pudbr
|
||||
from pudb.remote import set_trace
|
||||
set_trace()
|
||||
# pdb in nosetests
|
||||
snippet nosetrace
|
||||
__import__('nose').tools.set_trace()
|
||||
snippet pprint
|
||||
__import__('pprint').pprint(${1})
|
||||
|
||||
snippet "
|
||||
"""${0:doc}
|
||||
"""
|
||||
|
||||
# assertions
|
||||
snippet a=
|
||||
self.assertEqual(${0}, ${1})
|
||||
# test function/method
|
||||
snippet test
|
||||
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0}
|
||||
# test case
|
||||
snippet testcase
|
||||
class ${1:ExampleCase}(unittest.TestCase):
|
||||
|
||||
def test_${2:description}(self):
|
||||
${0}
|
||||
# test given when then
|
||||
snippet tgwt
|
||||
# given: ${1}
|
||||
# when: ${2}
|
||||
# then: ${3}
|
||||
snippet fut
|
||||
from __future__ import ${0}
|
||||
|
||||
#getopt
|
||||
snippet getopt
|
||||
try:
|
||||
# Short option syntax: "hv:"
|
||||
# Long option syntax: "help" or "verbose="
|
||||
opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}])
|
||||
|
||||
except getopt.GetoptError, err:
|
||||
# Print debug info
|
||||
print str(err)
|
||||
${3:error_action}
|
||||
|
||||
for option, argument in opts:
|
||||
if option in ("-h", "--help"):
|
||||
${0}
|
||||
elif option in ("-v", "--verbose"):
|
||||
verbose = argument
|
||||
|
||||
# argparse
|
||||
snippet addp
|
||||
parser = ${VISUAL:argparse.}ArgumentParser()
|
||||
snippet addsp
|
||||
${0:sub_parser} = parser.add_subparsers().add_parser("${1:name}")
|
||||
snippet addarg
|
||||
parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}")
|
||||
snippet addnarg
|
||||
parser.add_argument("${0:arg}", nargs="${1:*}", default=${2:None}, help="${3:Help text}")
|
||||
snippet addaarg
|
||||
parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}")
|
||||
snippet pargs
|
||||
"${VISUAL:return }"parser.parse_args()
|
||||
|
||||
# logging
|
||||
# glog = get log
|
||||
snippet glog
|
||||
import logging
|
||||
LOGGER = logging.getLogger(${0:__name__})
|
||||
snippet le
|
||||
LOGGER.error(${0:msg})
|
||||
# conflict with lambda=ld, therefor we change into Logger.debuG
|
||||
snippet lg
|
||||
LOGGER.debug(${0:msg})
|
||||
snippet lw
|
||||
LOGGER.warning(${0:msg})
|
||||
snippet lc
|
||||
LOGGER.critical(${0:msg})
|
||||
snippet li
|
||||
LOGGER.info(${0:msg})
|
||||
snippet epydoc
|
||||
"""${1:Description}
|
||||
|
||||
@param ${2:param}: ${3: Description}
|
||||
@type $2: ${4: Type}
|
||||
|
||||
@return: ${5: Description}
|
||||
@rtype : ${6: Type}
|
||||
|
||||
@raise e: ${0: Description}
|
||||
"""
|
||||
snippet dol
|
||||
def ${1:__init__}(self, *args, **kwargs):
|
||||
super(${0:ClassName}, self).$1(*args, **kwargs)
|
||||
snippet kwg
|
||||
self.${1:var_name} = kwargs.get('$1', ${2:None})
|
||||
snippet lkwg
|
||||
${1:var_name} = kwargs.get('$1', ${2:None})
|
||||
snippet args
|
||||
*args${1:,}${0}
|
||||
snippet kwargs
|
||||
**kwargs${1:,}${0}
|
||||
snippet akw
|
||||
*args, **kwargs${1:,}${0}
|
||||
|
||||
# comprehensions
|
||||
snippet lcp list comprehension
|
||||
[${1} for ${2} in ${3:${VISUAL}}]${0}
|
||||
|
||||
snippet dcp dict comprehension
|
||||
{${1}: ${2} for ${3} in ${4:${VISUAL}}}${0}
|
||||
|
||||
snippet scp set comprehension
|
||||
{${1} for ${2} in ${3:${VISUAL}}}${0}
|
||||
|
||||
snippet contain "methods for emulating a container type" b
|
||||
def __len__(self):
|
||||
${1:pass}
|
||||
|
||||
def __getitem__(self, key):
|
||||
${2:pass}
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
${3:pass}
|
||||
|
||||
def __delitem__(self, key):
|
||||
${4:pass}
|
||||
|
||||
def __iter__(self):
|
||||
${5:pass}
|
||||
|
||||
def __reversed__(self):
|
||||
${6:pass}
|
||||
|
||||
def __contains__(self, item):
|
||||
${7:pass}
|
||||
|
||||
snippet context "context manager methods" b
|
||||
def __enter__(self):
|
||||
${1:pass}
|
||||
|
||||
def __exit__(self, exc_type, exc_value, traceback):
|
||||
${2:pass}
|
||||
|
||||
snippet attr "methods for customizing attribute access" b
|
||||
def __getattr__(self, name):
|
||||
${1:pass}
|
||||
|
||||
def __setattr__(self, name, value):
|
||||
${2:pass}
|
||||
|
||||
def __delattr__(self, name):
|
||||
${3:pass}
|
||||
|
||||
snippet desc "methods implementing descriptors" b
|
||||
def __get__(self, instance, owner):
|
||||
${1:pass}
|
||||
|
||||
def __set__(self, instance, value):
|
||||
${2:pass}
|
||||
|
||||
def __delete__(self, instance):
|
||||
${3:pass}
|
||||
|
||||
snippet cmp "methods implementing rich comparison"
|
||||
def __eq__(self, other):
|
||||
${1:pass}
|
||||
|
||||
def __ne__(self, other):
|
||||
${2:pass}
|
||||
|
||||
def __lt__(self, other):
|
||||
${3:pass}
|
||||
|
||||
def __le__(self, other):
|
||||
${4:pass}
|
||||
|
||||
def __gt__(self, other):
|
||||
${5:pass}
|
||||
|
||||
def __ge__(self, other):
|
||||
${6:pass}
|
||||
|
||||
def __cmp__(self, other):
|
||||
${7:pass}
|
||||
|
||||
snippet repr "methods implementing string representation"
|
||||
def __repr__(self):
|
||||
${1:pass}
|
||||
|
||||
def __str__(self):
|
||||
${2:pass}
|
||||
|
||||
def __unicode__(self):
|
||||
${3:pass}
|
||||
|
||||
# note: reflected operands and augmented arithmeitc assignements have been
|
||||
# intentionally ommited to reduce verbosity.
|
||||
snippet numeric "methods for emulating a numeric type" b
|
||||
def __add__(self, other):
|
||||
${1:pass}
|
||||
|
||||
def __sub__(self, other):
|
||||
${2:pass}
|
||||
|
||||
def __mul__(self, other):
|
||||
${3:pass}
|
||||
|
||||
def __div__(self, other):
|
||||
${4:pass}
|
||||
|
||||
def __truediv__(self, other):
|
||||
${5:pass}
|
||||
|
||||
def __floordiv__(self, other):
|
||||
${6:pass}
|
||||
|
||||
def __mod__(self, other):
|
||||
${7:pass}
|
||||
|
||||
def __divmod__(self, other):
|
||||
${8:pass}
|
||||
|
||||
def __pow__(self, other):
|
||||
${9:pass}
|
||||
|
||||
def __lshift__(self, other):
|
||||
${10:pass}
|
||||
|
||||
def __rshift__(self, other):
|
||||
${11:pass}
|
||||
|
||||
def __and__(self, other):
|
||||
${12:pass}
|
||||
|
||||
def __xor__(self, other):
|
||||
${13:pass}
|
||||
|
||||
def __or__(self, other):
|
||||
${14:pass}
|
||||
|
||||
def __neg__(self):
|
||||
${15:pass}
|
||||
|
||||
def __pos__(self):
|
||||
${16:pass}
|
||||
|
||||
def __abs__(self):
|
||||
${17:pass}
|
||||
|
||||
def __invert__(self):
|
||||
${18:pass}
|
||||
|
||||
def __complex__(self):
|
||||
${19:pass}
|
||||
|
||||
def __int__(self):
|
||||
${20:pass}
|
||||
|
||||
def __long__(self):
|
||||
${21:pass}
|
||||
|
||||
def __float__(self):
|
||||
${22:pass}
|
||||
|
||||
def __oct__(self):
|
||||
${22:pass}
|
||||
|
||||
def __hex__(self):
|
||||
${23:pass}
|
||||
|
||||
def __index__(self):
|
||||
${24:pass}
|
||||
|
||||
def __coerce__(self, other):
|
||||
${25:pass}
|
||||
|
||||
# Printing
|
||||
snippet pr
|
||||
print($0)
|
||||
snippet prs
|
||||
print("$0")
|
||||
snippet prf
|
||||
print(f"$0")
|
||||
snippet fpr
|
||||
print($0, file=${1:sys.stderr})
|
||||
snippet fprs
|
||||
print("$0", file=${1:sys.stderr})
|
||||
snippet fprf
|
||||
print(f"$0", file=${1:sys.stderr})
|
@ -1,139 +0,0 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env Rscript
|
||||
|
||||
# includes
|
||||
snippet lib
|
||||
library(${0:package})
|
||||
snippet req
|
||||
require(${0:package})
|
||||
snippet source
|
||||
source('${0:file}')
|
||||
|
||||
# conditionals
|
||||
snippet if
|
||||
if ($1) {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
snippet ei
|
||||
else if ($1) {
|
||||
${0}
|
||||
}
|
||||
|
||||
# loops
|
||||
snippet wh
|
||||
while(${1:true}) {
|
||||
${0}
|
||||
}
|
||||
snippet wht
|
||||
while(true) {
|
||||
${0}
|
||||
}
|
||||
snippet for
|
||||
for (${1:item} in ${2:list}) {
|
||||
${3}
|
||||
}
|
||||
snippet foreach
|
||||
foreach (${1:item} = ${2:list}) {
|
||||
${3}
|
||||
}
|
||||
|
||||
# functions
|
||||
snippet fun
|
||||
${1:name} <- function (${2:variables}) {
|
||||
${0}
|
||||
}
|
||||
snippet ret
|
||||
return(${0})
|
||||
|
||||
# dataframes, lists, etc
|
||||
snippet df
|
||||
${1:name}[${2:rows}, ${0:cols}]
|
||||
snippet c
|
||||
c(${0:items})
|
||||
snippet li
|
||||
list(${0:items})
|
||||
snippet mat
|
||||
matrix(${1:data}, nrow = ${2:rows}, ncol = ${0:cols})
|
||||
|
||||
# apply functions
|
||||
snippet apply
|
||||
apply(${1:array}, ${2:margin}, ${0:function})
|
||||
snippet lapply
|
||||
lapply(${1:list}, ${0:function})
|
||||
snippet sapply
|
||||
lapply(${1:list}, ${0:function})
|
||||
snippet vapply
|
||||
vapply(${1:list}, ${2:function}, ${0:type})
|
||||
snippet mapply
|
||||
mapply(${1:function}, ${0:...})
|
||||
snippet tapply
|
||||
tapply(${1:vector}, ${2:index}, ${0:function})
|
||||
snippet rapply
|
||||
rapply(${1:list}, ${0:function})
|
||||
|
||||
# plyr functions
|
||||
snippet dd
|
||||
ddply(${1:frame}, ${2:variables}, ${0:function})
|
||||
snippet dl
|
||||
dlply(${1:frame}, ${2:variables}, ${0:function})
|
||||
snippet da
|
||||
daply(${1:frame}, ${2:variables}, ${0:function})
|
||||
snippet d_
|
||||
d_ply(${1:frame}, ${2:variables}, ${0:function})
|
||||
|
||||
snippet ad
|
||||
adply(${1:array}, ${2:margin}, ${0:function})
|
||||
snippet al
|
||||
alply(${1:array}, ${2:margin}, ${0:function})
|
||||
snippet aa
|
||||
aaply(${1:array}, ${2:margin}, ${0:function})
|
||||
snippet a_
|
||||
a_ply(${1:array}, ${2:margin}, ${0:function})
|
||||
|
||||
snippet ld
|
||||
ldply(${1:list}, ${0:function})
|
||||
snippet ll
|
||||
llply(${1:list}, ${0:function})
|
||||
snippet la
|
||||
laply(${1:list}, ${0:function})
|
||||
snippet l_
|
||||
l_ply(${1:list}, ${0:function})
|
||||
|
||||
snippet md
|
||||
mdply(${1:matrix}, ${0:function})
|
||||
snippet ml
|
||||
mlply(${1:matrix}, ${0:function})
|
||||
snippet ma
|
||||
maply(${1:matrix}, ${0:function})
|
||||
snippet m_
|
||||
m_ply(${1:matrix}, ${0:function})
|
||||
|
||||
# plot functions
|
||||
snippet pl
|
||||
plot(${1:x}, ${0:y})
|
||||
snippet ggp
|
||||
ggplot(${1:data}, aes(${0:aesthetics}))
|
||||
snippet img
|
||||
${1:(jpeg,bmp,png,tiff)}(filename = '${2:filename}', width = ${3}, height = ${4}, unit = '${5}')
|
||||
${0:plot}
|
||||
dev.off()
|
||||
|
||||
# statistical test functions
|
||||
snippet fis
|
||||
fisher.test(${1:x}, ${0:y})
|
||||
snippet chi
|
||||
chisq.test(${1:x}, ${0:y})
|
||||
snippet tt
|
||||
t.test(${1:x}, ${0:y})
|
||||
snippet wil
|
||||
wilcox.test(${1:x}, ${0:y})
|
||||
snippet cor
|
||||
cor.test(${1:x}, ${0:y})
|
||||
snippet fte
|
||||
var.test(${1:x}, ${0:y})
|
||||
snippet kvt
|
||||
kv.test(${1:x}, ${0:y})
|
@ -1,131 +0,0 @@
|
||||
# Languages
|
||||
snippet #r
|
||||
#lang racket
|
||||
snippet #tr
|
||||
#lang typed/racket
|
||||
snippet #rg
|
||||
#lang racket/gui
|
||||
snippet #sb
|
||||
#lang scribble/base
|
||||
snippet #d
|
||||
#lang datalog
|
||||
snippet #wi
|
||||
#lang web-server/insta
|
||||
|
||||
# Defines
|
||||
snippet def
|
||||
(define ${1} ${0})
|
||||
snippet defun
|
||||
(define (${1})
|
||||
${0})
|
||||
snippet defv "define-values"
|
||||
(define-values (${1}) (${0}))
|
||||
snippet defm "define/match"
|
||||
(define/match (${1})
|
||||
[(${2}) ${3}]
|
||||
${0})
|
||||
snippet defs "define-syntax"
|
||||
(define-syntax (${1})
|
||||
${0})
|
||||
|
||||
# Conditionals
|
||||
snippet if
|
||||
(if ${1} ${2} ${0})
|
||||
snippet ifn
|
||||
(if (not ${1}) ${2} ${0})
|
||||
snippet ifl
|
||||
(if ${1}
|
||||
(let (${2})
|
||||
${3})
|
||||
${0})
|
||||
snippet ifnl
|
||||
(if (not ${1})
|
||||
(let (${2})
|
||||
${3})
|
||||
${0})
|
||||
snippet ifb
|
||||
(if ${1}
|
||||
(begin
|
||||
${2})
|
||||
${0})
|
||||
snippet ifnb
|
||||
(if (not ${1})
|
||||
(begin
|
||||
${2})
|
||||
${0})
|
||||
snippet when
|
||||
(when ${1}
|
||||
${0})
|
||||
snippet unless
|
||||
(unless ${1} ${2} ${0})
|
||||
snippet cond
|
||||
(cond
|
||||
[(${1}) ${0}])
|
||||
snippet conde
|
||||
(cond
|
||||
[(${1}) ${2}]
|
||||
[else ${0}])
|
||||
snippet case
|
||||
(case ${1}
|
||||
[(${2}) ${0}])
|
||||
snippet match
|
||||
(match ${1}
|
||||
[(${2}) ${0}])
|
||||
|
||||
# For iterations
|
||||
snippet for
|
||||
(for ([${1}])
|
||||
${0})
|
||||
snippet forl "for/list"
|
||||
(for/list ([${1}])
|
||||
${0})
|
||||
snippet forf "for/fold"
|
||||
(for/fold
|
||||
([${1}])
|
||||
([${2}])
|
||||
${0})
|
||||
snippet forfr "for/foldr"
|
||||
(for/foldr
|
||||
([${1}])
|
||||
([${2}])
|
||||
${0})
|
||||
snippet fora "for/and"
|
||||
(for/and ([${1}])
|
||||
${0})
|
||||
snippet foro "for/or"
|
||||
(for/or ([${1}])
|
||||
${0})
|
||||
snippet fors "for/sum"
|
||||
(for/sum ([${1}])
|
||||
${0})
|
||||
snippet forp "for/product"
|
||||
(for/product ([${1}])
|
||||
${0})
|
||||
snippet forfi "for/first"
|
||||
(for/first ([${1}])
|
||||
${0})
|
||||
snippet forla "for/last"
|
||||
(for/last ([${1}])
|
||||
${0})
|
||||
|
||||
snippet lambda
|
||||
(lambda (${1}) ${0})
|
||||
snippet apply
|
||||
(apply ${1} ${0})
|
||||
snippet map
|
||||
(map ${1} ${0})
|
||||
snippet filter
|
||||
(filter ${1} ${0})
|
||||
|
||||
snippet req
|
||||
(require ${0})
|
||||
snippet prov
|
||||
(provide ${0})
|
||||
|
||||
snippet let
|
||||
(let ([${1}]) ${0})
|
||||
snippet letcc
|
||||
(let/cc here (set! ${1} here) ${0})
|
||||
snippet begin
|
||||
(begin
|
||||
${0})
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user