1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated all plugins that are non-forked. Added some new plugins.

Added update_plugins.py which can fetch new plugins from GitHub.

New plugins added: zencoding, vim-indent-object, taglist, nginx.vim
This commit is contained in:
amix
2013-04-13 14:45:21 -03:00
parent 5731b3a420
commit 3f1cdba799
1057 changed files with 33631 additions and 10806 deletions

View File

@ -0,0 +1,43 @@
Aaron Broder
Adam Folmert
Alberto Pose
Angel Alonso
Ben Orenstein
Bill Casarin
Christopher Joslyn
Daniel Hahler
Elliot Murphy
Eustaquio Rangel
Henrik Nyh
Honza Pokorny
Jakub Nawalaniec
James F. Herdman
Jon Bernard
Kozo NISHIDA
Leandro Pincini
Marc Weber
Marcin Kulik
Marjan.Hratson
Micah Elliott
Michael Sanders
Naveed Massjouni
Rob Hudson
Rok Garbas
Sebastian Schulze
Srushti Ambekallu
Stephen Tudor
Steven Oliver
Stuart Colville
Tom Adams
Zied ABID
fo60213
marutanm
msanders
Povilas Balzaravičius Pawka
Dmitry Dementev
Travis Holton
Chrisyue
Erik Westrup
TODO: add contributors from github.com/SirVer/Ultisnip having contributed to
github.com/SirVer/Ultisnip/UltiSnips/* files

View File

@ -0,0 +1,20 @@
Copyright (c) 2011 see AUTHORS
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.

View File

@ -0,0 +1,118 @@
IMPORTANT: comment on: [What about merging whith Ultisnip using its engine](https://github.com/garbas/vim-snipmate/issues/114)
Snipmate & UltiSnip Snippets
============================
This repository contains snippets files for various programming languages.
It is community-maintained and many people have contributed snippet files and other
improvements already.
Contents
========
snippets/*: snippets using snipmate format
UltiSnips/*: snippets using UltiSnips format
Snippet engines
===============
There are different forks of snippet engines which allow the user to insert
sippets by typing the name of a snippet hitting the expansion mapping.
garbas/vim-snipmate [4]:
VimL, snipmate-snippets, engine sometimes behaves strange, supports
rewriting snippets on the fly (eg adding a second version with folding
markers)
MarcWeber/UltiSnips [6]:
python, snipmate-snippets and UltiSnips-snippets
SirVer/ultisnips [7]:
python, UltiSnips-snippets
github.com/Shougo/neosnippet [5]:
viml, has a compatible mode allowing to reuse most snipmate snippets ?
XPTemplate:
totally different syntax, does not read snippets contained in this file,
but it is also very powerful
... there are some more, but they have less features which is why I don't
mention them here
UltiSnips engine has additional features such as "nested snippets".
Which one to use? If you have python give MarcWeber/UltiSnips a try because its
fast and supports all important features. You can prefer the UltiSnip versions
of the snippets by setting the "always_use_first_snippet" option to 1.
If you have VimL only (vim without python support) your best option is using
garbas/vim-snipmate and cope with the minor bugs found in the engine.
Related repositories
====================
We also encourage people to maintain sets of snippets for particular use cases
so that all users can benefit from them. People can list their snippet repositories here:
* https://github.com/rbonvall/snipmate-snippets-bib (snippets for BibTeX files)
* https://github.com/sudar/vim-arduino-snippets (snippets for Arduino files)
* https://github.com/zedr/zope-snipmate-bundle.git (snippets for Python, TAL and ZCML)
* https://github.com/bonsaiben/bootstrap-snippets (snippets for Twitter Bootstrap markup, in HTML and Haml)
Installation using VAM: "github:rbonvall/snipmate-snippets-bib"
Historical notes
================
[vim-snipmate][1] was originally started by [Michael Sanders][2] who has now
unfortunately abandoned the project. [Rok Garbas][3] is now maintaining a
[fork][4] of the project in hopes of improving the existing code base.
Language maintainers
--------------------
No one can really be proficient in all programming languages. If you would like
to maintain snippets for a language, please get in touch.
* Python - [honza](http://github.com/honza)
* Javascript - [honza](http://github.com/honza)
* HTML Django - [honza](http://github.com/honza)
* Markdown - [honza](http://github.com/honza)
* Ruby - [taq](http://github.com/taq)
* PHP - [chrisyue](http://github.com/chrisyue)
Contributing notes
------------------
Until further work is done on `vim-snipmate`, please don't add folding markers
into snippets. `vim-snipmate` has some comments about how to patch all snippets
on the fly adding those.
Because MarcWeber/UltiSnips [6] supports also snipmate-snippets there is no
need to duplicate all snippets - only those snippets who use advanced UltiSnips
features should be duplicated in UltiSnips (?)
Currently all snippets from UltiSnips have been put into UltiSnips - some work
on merging should be done (dropping duplicates etc)
Authors
-------
For a list of authors, please see the `AUTHORS` files.
License
-------
Just as the original snipMate plugin, all the snippets are licensed under the
terms of the MIT license.
[1]: http://github.com/garbas/vim-snipmate
[2]: http://github.com/msanders
[3]: http://github.com/garbas
[4]: http://github.com/garbas/vim-snipmate
[5]: http://github.com/Shougo/neosnippet
[6]: http://github.com/MarcWeber/UltiSnips
[7]: http://github.com/SirVer/ultisnips

View File

@ -0,0 +1,21 @@
This directory contains the main scripts that come bundled with UltiSnips.
Standing On The Shoulders of Giants
===================================
The snippets have been collected from various other project which I want to
express my gratitude for. My main source for inspiration where the following
two projects:
TextMate: http://svn.textmate.org/trunk/Bundles/
SnipMate: http://code.google.com/p/snipmate/
All snippets from those sources were copied and cleaned up, so that they are
- not using shell script, only python (so they are cross platform compatible)
- not using any feature that UltiSnips doesn't offer
UltiSnips has seen contributions by various individuals. Those contributions
have been merged into this collection seamlessly and without further comments.
-- vim:ft=rst:nospell:

View File

@ -1,8 +1,12 @@
###########################################################################
# TextMate Snippets #
###########################################################################
snippet def "#ifndef ... #define ... #endif"
snippet def "#define ..."
#define ${1}
endsnippet
snippet ifndef "#ifndef ... #define ... #endif"
#ifndef ${1/([A-Za-z0-9_]+).*/$1/}
#define ${1:SYMBOL} ${2:value}
#endif
@ -88,6 +92,17 @@ if (${1:/* condition */})
}
endsnippet
snippet ife "if .. else (ife)"
if (${1:/* condition */})
{
${2:/* code */}
}
else
{
${3:/* else */}
}
endsnippet
snippet printf "printf .. (printf)"
printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
endsnippet

View File

@ -1,5 +1,3 @@
extends c
###########################################################################
# TextMate Snippets #
###########################################################################

View File

@ -0,0 +1,583 @@
# Simple shortcuts
snippet imp "import (imp)" b
import ${1:std.stdio};
endsnippet
snippet pimp "public import (pimp)" b
public import ${1:/*module*/};
endsnippet
snippet over "override (over)" b
override ${1:/*function*/}
endsnippet
snippet al "alias (al)"
alias ${1:/*orig*/} ${2:/*alias*/};
endsnippet
snippet mixin "mixin (mixin)" b
mixin ${1:/*mixed_in*/} ${2:/*name*/};
endsnippet
snippet new "new (new)"
new ${1}(${2});
endsnippet
snippet scpn "@safe const pure nothrow (scpn)"
@safe const pure nothrow
endsnippet
snippet spn "@safe pure nothrow (spn)"
@safe pure nothrow
endsnippet
snippet cont "continue (cont)"
continue;
endsnippet
snippet dis "@disable (dis)" b
@disable ${1:/*method*/};
endsnippet
snippet pub "public (pub)" b
public:
${1:/*members*/}
endsnippet
snippet priv "private (priv)" b
private:
${1:/*members*/}
endsnippet
snippet prot "protected (prot)" b
protected:
${1:/*members*/}
endsnippet
snippet pack "package (pack)" b
package:
${1:/*members*/}
endsnippet
snippet ret "return (ret)"
return ${1:/*value to return*/};
endsnippet
snippet auto "auto (auto)" b
auto ${1:/*variable*/} = ${2:/*value*/};
endsnippet
snippet con "const (con)" b
const ${1:/*variable*/} = ${2:/*value*/};
endsnippet
snippet siz "size_t (siz)" b
size_t ${1:/*variable*/} = ${2:/*value*/};
endsnippet
snippet sup "super (sup)" b
super(${1:/*args*/});
endsnippet
# Phobos
snippet tup "tuple (tup)"
tuple(${1:/*args*/})
endsnippet
snippet wr "writeln (wr)"
writeln(${1:/*args*/});
endsnippet
snippet to "to (to)"
to!(${1:/*type*/})(${2:/*arg*/})
endsnippet
snippet enf "enforce (enf)" b
enforce(${1:/*condition*/},
new ${2}Exception(${3:/*args*/}));
endsnippet
# Branches
snippet if "if .. (if)"
if(${1:/*condition*/})
{
${VISUAL}${0:/*code*/}
}
endsnippet
snippet ife "if .. else (ife)" b
if(${1:/*condition*/})
{
${2:/*code*/}
}
else
{
${3:/*else*/}
}
endsnippet
snippet el "else (el)" b
else
{
${VISUAL}${1:/*code*/}
}
endsnippet
snippet elif "else if (elif)" b
else if(${1:/*condition*/})
{
${VISUAL}${0:/*code*/}
}
endsnippet
snippet sw "switch (sw)"
switch(${1:/*var*/})
{
case ${2:/*value*/}:
${3:/*code*/}
break;
case ${4:/*value*/}:
${5:/*code*/}
break;
${7:/*more cases*/}
default:
${6:assert(false);}
}
endsnippet
snippet fsw "final switch (fsw)"
switch(${1:/*var*/})
{
case ${2:/*value*/}:
${3:/*code*/}
break;
case ${4:/*value*/}:
${5:/*code*/}
break;
${7:/*more cases*/}
}
endsnippet
snippet case "case (case)" b
case ${1:/*value*/}:
${2:/*code*/}
break;
endsnippet
snippet ?: "ternary operator (?:)"
${1:/*condition*/} ? ${2:/*then*/} : ${3:/*else*/}$4
endsnippet
# Loops
snippet do "do while (do)" b
do
{
${VISUAL}${2:/*code*/}
} while(${1:/*condition*/});
endsnippet
snippet wh "while (wh)" b
while(${1:/*condition*/})
{
${VISUAL}${2:/*code*/}
}
endsnippet
snippet for "for (for)" b
for (${4:size_t} ${2:i} = 0; $2 < ${1:count}; ${3:++$2})
{
${VISUAL}${0:/*code*/}
}
endsnippet
snippet forever "forever (forever)" b
for(;;)
{
${VISUAL}${0:/*code*/}
}
endsnippet
snippet fore "foreach (fore)"
foreach(${1:/*elem*/}; ${2:/*range*/})
{
${VISUAL}${3:/*code*/}
}
endsnippet
snippet forif "foreach if (forif)" b
foreach(${1:/*elem*/}; ${2:/*range*/}) if(${3:/*condition*/})
{
${VISUAL}${4:/*code*/}
}
endsnippet
# Contracts
snippet in "in contract (in)" b
in
{
assert(${1:/*condition*/}, "${2:error message}");
${3}
}
body
endsnippet
snippet out "out contract (out)" b
out${1:(result)}
{
assert(${2:/*condition*/}, "${3:error message}");
${4}
}
body
endsnippet
snippet inv "invariant (inv)" b
invariant()
{
assert(${1:/*condition*/}, "${2:error message}");
${3}
}
endsnippet
# Functions (generic)
snippet fun "function definition (fun)"
${1:void} ${2:/*function name*/}(${3:/*args*/}) ${4:@safe pure nothrow}
{
${VISUAL}${5:/*code*/}
}
endsnippet
snippet void "void function definition (void)"
void ${1:/*function name*/}(${2:/*args*/}) ${3:@safe pure nothrow}
{
${VISUAL}${4:/*code*/}
}
endsnippet
snippet this "ctor (this)" w
this(${1:/*args*/})
{
${VISUAL}${2:/*code*/}
}
endsnippet
snippet get "getter property (get)" !
@property ${1:/*type*/} ${2:/*member_name*/}() const pure nothrow {return ${3:$2_};}
endsnippet
snippet set "setter property (set)" !
@property void ${1:/*member_name*/}(${2:/*type*/} rhs) pure nothrow {${3:$1_} = rhs;}
endsnippet
# Functions (concrete)
snippet main "Main" b
void main(string[] args)
{
${VISUAL}${0: /*code*/}
}
endsnippet
# Mixins
snippet signal "signal (signal)" b
mixin Signal!(${1:/*args*/}) ${2:/*name*/};
endsnippet
# Scope
snippet scope "scope (scope)" b
scope(${1:exit})
{
${VISUAL}${2:/*code*/}
}
endsnippet
# With
snippet with "with (with)"
with(${1})
{
${VISUAL}${2:/*code*/}
}
endsnippet
# Exception handling
snippet try "try/catch (try)" b
try
{
${VISUAL}${1:/*code to try*/}
}
catch(${2}Exception e)
{
${3:/*handle exception*/}
}
endsnippet
snippet tryf "try/catch/finally (tryf)" b
try
{
${VISUAL}${1:/*code to try*/}
}
catch(${2}Exception e)
{
${3:/*handle exception*/}
}
finally
{
${4:/*cleanup*/}
}
endsnippet
snippet catch "catch (catch)" b
catch(${1}Exception e)
{
${2:/*handle exception*/}
}
endsnippet
snippet thr "throw (thr)"
throw new ${1}Exception("${2}");
endsnippet
# Type declarations
snippet struct "struct (struct)"
struct ${1:`!p snip.rv = (snip.basename or "name")`}
{
${2}
}
endsnippet
snippet union "union (union)"
union ${1:`!p snip.rv = (snip.basename or "name")`}
{
${2}
}
endsnippet
snippet class "class (class)"
class ${1:`!p snip.rv = (snip.basename or "name")`}
{
${2}
}
endsnippet
snippet inter "interface (inter)"
interface ${1:`!p snip.rv = (snip.basename or "name")`}
{
${2}
}
endsnippet
snippet enum "enum (enum)"
enum ${1:`!p snip.rv = (snip.basename or "name")`}
{
${2}
}
endsnippet
# Exception declarations
snippet exc "exception declaration (exc)" b
/// ${3:/*documentation*/}
class ${1}Exception : ${2}Exception
{
public this(string msg, string file = __FILE__, int line = __LINE__)
{
super(msg, file, line);
}
}
endsnippet
# Conditional compilation
snippet version "version (version)" b
version(${1:/*version name*/})
{
${VISUAL}${2:/*code*/}
}
endsnippet
snippet debug "debug" b
debug
{
${VISUAL}${1:/*code*/}
}
endsnippet
# Templates
snippet temp "template (temp)" b
template ${2:/*name*/}(${1:/*args*/})
{
${3:/*code*/}
}
endsnippet
# Asserts
snippet ass "assert (ass)" b
assert(${1:false}, "${2:TODO}");
endsnippet
# Unittests
snippet unittest "unittest (unittest)" b
unittest
{
${1:/*code*/}
}
endsnippet
# Common member functions
snippet opDis "opDispatch (opDis)" b
${1:/*return type*/} opDispatch(string s)()
{
${2:/*code*/};
}
endsnippet
snippet op= "opAssign (op=)" b
void opAssign(${1} rhs) ${2:@safe pure nothrow}
{
${2:/*code*/}
}
endsnippet
snippet opCmp "opCmp (opCmp)" b
int opCmp(${1} rhs) @safe const pure nothrow
{
${2:/*code*/}
}
endsnippet
snippet opApply "opApply (opApply)" b
int opApply(int delegate(ref ${1:/*iterated type/s*/}) dg)
{
int result = 0;
${2:/*loop*/}
{
result = dg(${3:/*arg/s*/});
if(result){break;}
}
return result;
}
endsnippet
snippet toString "toString (toString)" b
string toString() @safe const pure nothrow
{
${1:/*code*/}
}
endsnippet
# Comments
snippet todo "TODO (todo)" !
// TODO: ${1}
endsnippet
# DDoc
snippet doc "generic ddoc block (doc)" b
/// ${1:description}
///
/// ${2:details}
endsnippet
snippet fdoc "function ddoc block (fdoc)" b
/// ${1:description}
///
/// ${2:Params: ${3:param} = ${4:param description}
/// ${5}}
///
/// ${6:Returns: ${7:return value}}
///
/// ${8:Throws: ${9}Exception ${10}}
endsnippet
snippet Par "Params (Par)"
Params: ${1:param} = ${2:param description}
/// ${3}
endsnippet
snippet Ret "Returns (Ret)"
Returns: ${1:return value/s}
endsnippet
snippet Thr "Throws (Thr)"
Throws: ${1}Exception ${2}
endsnippet
snippet Example "Examples (Example)"
Examples:
/// --------------------
/// ${1:example code}
/// --------------------
endsnippet
# License blocks
snippet gpl "GPL (gpl)" b
// 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, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Copyright (C) ${1:Author}, `!v strftime("%Y")`
${2}
endsnippet
snippet boost "Boost (boost)" b
// Copyright ${1:Author} `!v strftime("%Y")`.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
${2}
endsnippet
# New module
snippet module "New module (module)" b
// Copyright ${1:Author} `!v strftime("%Y")`.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
module ${2}.`!v Filename('$1', 'name')`;
${3}
endsnippet

View File

@ -4,11 +4,11 @@ global !p
def sec_title(snip, t):
file_start = snip.fn.split('.')[0]
sec_name = t[1].strip("1234567890. ").lower().replace(' ', '-')
return ("*%s-%s*" % (file_start, sec_name)).rjust(77-len(t[1]))
return ("*%s-%s*" % (file_start, sec_name)).rjust(78-len(t[1]))
endglobal
snippet sec "Section marker" b
=============================================================================
==============================================================================
${1:SECTION}`!p snip.rv = sec_title(snip, t)`
$0

View File

@ -120,17 +120,9 @@ snippet ! "IE Conditional Comment: NOT Internet Explorer"
<!--[if !IE]><!-->${1: IE Conditional Comment: NOT Internet Explorer }<!-- <![endif]-->$0
endsnippet
###########
# Forms #
###########
snippet form "XHTML <form>"
<form action="${1}" method="${2:get}" accept-charset="utf-8">
$0
<p><input type="submit" value="Continue →"`!p x(snip)`></p>
</form>
endsnippet
#############
# HTML TAGS #
#############
snippet input "Input with Label"
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
@ -140,8 +132,9 @@ snippet input "XHTML <input>"
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
endsnippet
snippet textarea "XHTML <textarea>"
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
snippet opt "Option"
<option${1: value="${2:option}"}>${3:$2}</option>
endsnippet
snippet select "Select Box"
@ -152,8 +145,9 @@ snippet select "Select Box"
</select>
endsnippet
snippet opt "Option"
<option${1: value="${2:option}"}>${3:$2}</option>
snippet textarea "XHTML <textarea>"
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
endsnippet
snippet mailto "XHTML <a mailto: >"
@ -165,25 +159,31 @@ snippet base "XHTML <base>"
endsnippet
snippet body "XHTML <body>"
<body id="${1:`!p snip.rv = snip.fn and 'Hallo' or 'Nothin' `}"${2: onload="$3"}>
<body id="${1:`!p
snip.rv = snip.fn and 'Hallo' or 'Nothin'
`}"${2: onload="$3"}>
$0
</body>
endsnippet
snippet div "XHTML <div>"
<div${1: id="${2:name}"}>${3}</div>${4}
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
$0
</div>
endsnippet
snippet form "XHTML <form>"
<form action="${1:`!p
snip.rv = (snip.basename or 'unnamed') + '_submit'
`}" method="${2:get}" accept-charset="utf-8">
$0
<p><input type="submit" value="Continue →"`!p x(snip)`></p>
</form>
endsnippet
snippet h1 "XHTML <h1>"
<h1>${1}</h1>${2}
endsnippet
snippet h2 "XHTML <h2>"
<h2>${1}</h2>${2}
endsnippet
snippet h3 "XHTML <h3>"
<h3>${1}</h3>${2}
<h1 id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}">${1}</h1>
endsnippet
snippet head "XHTML <head>"
@ -208,8 +208,8 @@ endsnippet
snippet script "XHTML <script>"
<script type="text/javascript" charset="utf-8">
${1}
</script>${2}
$0
</script>
endsnippet
snippet style "XHTML <style>"
@ -218,88 +218,37 @@ snippet style "XHTML <style>"
</style>
endsnippet
snippet a "Link" w
<a href="${1:http://www.${2:example.com}}">${4:Anchor Text}</a>
snippet table "XHTML <table>"
<table border="${1:0}"${2: cellspacing="${3:5}" cellpadding="${4:5}"}>
<tr><th>${5:Header}</th></tr>
<tr><td>${0:Data}</td></tr>
</table>
endsnippet
snippet a "Link"
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
endsnippet
snippet p "paragraph"
<p>${1}</p>${2}
endsnippet
##########
# List #
##########
snippet ul "unordered list"
<ul${1}>
${2}
</ul>${3}
endsnippet
snippet ol "unordered list"
<ol${1}>
${2}
</ol>$0
<p>$0</p>
endsnippet
snippet li "list item"
<li>${1}</li>
li${2}
<li></li>
endsnippet
snippet dl "dl" !b
<dl>${1}</dl>
dl${2}
endsnippet
snippet . "class"
class="${1}"${2}
endsnippet
snippet # "id"
id="${1}"${2}
endsnippet
###########
# Table #
###########
snippet table "XHTML <table>"
<table${1}>
${2}
</table>${3}
endsnippet
snippet thead "XHTML <thead>"
<thead>
${1}
</thead>${2}
endsnippet
snippet tbody "XHTML <tbody>"
<tbody>
${1}
</tbody>${2}
endsnippet
snippet tfoot "XHTML <tfoote>"
<tfoot>
${1}
</tfoot>${2}
endsnippet
snippet tr "table row"
<tr>${1}</tr>
tr${2}
snippet ul "unordered list"
<ul>
$0
</ul>
endsnippet
snippet td "table cell"
<td>${1}</td>
td${2}
<td>$0</td>
endsnippet
snippet th "table cell"
<th>${1}</th>
th${2}
snippet tr "table row"
<tr>$0</tr>
endsnippet
snippet title "XHTML <title>"
@ -314,10 +263,6 @@ snippet fieldset "Fieldset"
</fieldset>
endsnippet
snippet pre "XHTML pre" !b
<pre>${1}</pre>${2}
endsnippet
snippet movie "Embed QT movie (movie)" b
<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"`!p x(snip)`>
@ -332,4 +277,21 @@ snippet movie "Embed QT movie (movie)" b
</object>
endsnippet
snippet html5 "HTML5 Template"
<!DOCTYPE html>
<html>
<head>
<title>${1}</title>
<meta charset="utf-8" />
</head>
<body>
<header>
${2}
</header>
<footer>
${4}
</footer>
</body>
</html>
endsnippet
# vim:ft=snippets:

View File

@ -33,11 +33,11 @@ endsnippet
################
# Common stuff #
################
snippet link "Link to something"
snippet link "Link to something"
[${1:${VISUAL:Text}}](${3:http://${2:www.url.com}})$0
endsnippet
snippet img "Link to something"
snippet img "Image"
![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0
endsnippet

View File

@ -0,0 +1,172 @@
snippet rs "raise" b
raise (${1:Not_found})
endsnippet
snippet open "open"
let open ${1:module} in
${2:e}
endsnippet
snippet try "try"
try ${1:e}
with ${2:Not_found} -> ${3:()}
endsnippet
snippet ref "ref"
let ${1:name} = ref ${2:val} in
${3:e}
endsnippet
snippet matchl "pattern match on a list"
match ${1:list} with
| [] -> ${2:()}
| x::xs -> ${3:()}
endsnippet
snippet matcho "pattern match on an option type"
match ${1:x} with
| Some(${2:y}) -> ${3:()}
| None -> ${4:()}
endsnippet
snippet fun "anonymous function"
(fun ${1:x} -> ${2:x})
endsnippet
snippet cc "commment"
(* ${1:comment} *)
endsnippet
snippet let "let .. in binding"
let ${1:x} = ${2:v} in
${3:e}
endsnippet
snippet lr "let rec"
let rec ${1:f} =
${2:expr}
endsnippet
snippet if "if"
if ${1:(* condition *)} then
${2:(* A *)}
else
${3:(* B *)}
endsnippet
snippet If "If"
if ${1:(* condition *)} then
${2:(* A *)}
endsnippet
snippet while "while"
while ${1:(* condition *)} do
${2:(* A *)}
done
endsnippet
snippet for "for"
for ${1:i} = ${2:1} to ${3:10} do
${4:(* BODY *)}
done
endsnippet
snippet match "match"
match ${1:(* e1 *)} with
| ${2:p} -> ${3:e2}
endsnippet
snippet Match "match"
match ${1:(* e1 *)} with
| ${2:p} -> ${3:e2}
endsnippet
snippet class "class"
class ${1:name} = object
${2:methods}
end
endsnippet
snippet obj "obj"
object
${2:methods}
end
endsnippet
snippet Obj "object"
object (self)
${2:methods}
end
endsnippet
snippet {{ "object functional update"
{< ${1:x} = ${2:y} >}
endsnippet
snippet beg "beg"
begin
${1:block}
end
endsnippet
snippet ml "module instantiantion with functor"
module ${1:Mod} = ${2:Functor}(${3:Arg})
endsnippet
snippet mod "module - no signature"
module ${1:(* Name *)} = struct
${2:(* BODY *)}
end
endsnippet
snippet Mod "module with signature"
module ${1:(* Name *)} : ${2:(* SIG *)} = struct
${3:(* BODY *)}
end
endsnippet
snippet sig "anonymous signature"
sig
${2:(* BODY *)}
end
endsnippet
snippet sigf "functor signature or anonymous functor"
functor (${1:Arg} : ${2:ARG}) -> ${3:(* BODY *)}
endsnippet
snippet func "define functor - no signature"
module ${1:M} (${2:Arg} : ${3:ARG}) = struct
${4:(* BODY *)}
end
endsnippet
snippet Func "define functor - with signature"
module ${1:M} (${2:Arg} : ${3:ARG}) : ${4:SIG} = struct
${5:(* BODY *)}
end
endsnippet
snippet mot "Declare module signature"
module type ${1:(* Name *)} = sig
${2:(* BODY *)}
end
endsnippet
snippet module "Module with anonymous signature"
module ${1:(* Name *)} : sig
${2:(* SIGNATURE *)}
end = struct
${3:(* BODY *)}
end
endsnippet
snippet oo "odoc"
(** ${1:odoc} *)
endsnippet
snippet qt "inline qtest"
(*$T ${1:name}
${2:test}
*)
endsnippet

View File

@ -0,0 +1,258 @@
## Snippets from SnipMate, taken from
## https://github.com/scrooloose/snipmate-snippets.git
snippet array "array"
$${1:arrayName} = array('${2}' => ${3});${4}
endsnippet
snippet def "def"
define('${1}'${2});${3}
endsnippet
snippet do "do"
do {
${2:// code... }
} while (${1:/* condition */});"
endsnippet
snippet doc_f "doc_f"
/**
* $2
* @return ${4:void}
* @author ${5:`!v g:snips_author`}
**/
${1:public }function ${2:someFunc}(${3})
{${6}
}
endsnippet
snippet doc_i "doc_i"
/**
* $1
* @package ${2:default}
* @author ${3:`!v g:snips_author`}
**/
interface ${1:someClass}
{${4}
} // END interface $1"
endsnippet
snippet else "else"
else {
${1:// code...}
}
endsnippet
snippet for "for"
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:// code...}
}
endsnippet
snippet foreachk "foreachk"
foreach ($${1:variable} as $${2:key} => $${3:value}){
${4:// code...}
}
endsnippet
snippet get "get"
$_GET['${1}']${2}
endsnippet
snippet if "if"
if (${1:/* condition */}) {
${2:// code...}
}
endsnippet
snippet inc "inc"
include '${1:file}';${2}
endsnippet
snippet log "log"
error_log(var_export(${1}, true));${2}
endsnippet
snippet post "post"
$_POST['${1}']${2}
endsnippet
snippet req1 "req1"
require_once '${1:file}';${2}
endsnippet
snippet session "session"
$_SESSION['${1}']${2}
endsnippet
snippet t "t"
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
endsnippet
snippet var "var"
var_export(${1});${2}
endsnippet
snippet getter "PHP Class Getter" !b
/*
* Getter for $1
*/
public function get${1/\w+\s*/\u$0/}()
{
return $this->$1;$2
}
$4
endsnippet
snippet setter "PHP Class Setter" !b
/*
* Setter for $1
*/
public function set${1/\w+\s*/\u$0/}($$1)
{
$this->$1 = $$1;$3
${4:return $this;}
}
$0
endsnippet
snippet gs "PHP Class Getter Setter" !b
protected $$1
/*
* Getter for $1
*/
public function get${1/\w+\s*/\u$0/}()
{
return $this->$1;$2
}
/*
* Setter for $1
*/
public function set${1/\w+\s*/\u$0/}($$1)
{
$this->$1 = $$1;$3
${4:return $this;}
}
$0
endsnippet
snippet pub "Public function" !b
public function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pro "Protected function" !b
protected function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pri "Private function" !b
private function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pubs "Public static function" !b
public static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pros "Protected static function" !b
protected static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet pris "Private static function" !b
private static function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
snippet fu "Function snip" !b
function ${1:name}(${2:$param})
{
${VISUAL}${3:return null;}
}
$0
endsnippet
# :vim:ft=snippets
snippet fore "Foreach loop"
foreach ($${1:variable} as $${3:value}){
${VISUAL}${4}
}
$0
endsnippet
snippet new "New class instance" !b
$$1 = new $1($2);
$0
endsnippet
snippet ife "if else"
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
$0
endsnippet
snippet class "Class declaration template" !b
/**
* Class ${1:`!p snip.rv=snip.fn.capitalize().split('.')[0]`}
* @author $2
*/
class $1
{
public function ${3:__construct}(${4:$options})
{
${4:// code}
}
}
$0
endsnippet
snippet pr "Dumb debug helper in HTML"
echo '<pre>' . var_export($1, 1) . '</pre>';$0
endsnippet
snippet pc "Dumb debug helper in cli"
var_export($1);$0
endsnippet
# Symfony 2 based snippets
snippet sfa "Symfony 2 Controller action"
/**
* @Route("/${1:route_name}", name="$1")
* @Template()
*/
public function $1Action($2)
{
$3
return ${4:array();}$0
}
endsnippet
# :vim:ft=snippets:

View File

@ -368,7 +368,12 @@ endsnippet
snippet rwprop "Read write property" b
def ${1:property}():
${2/.+/(?0:""")/}${2:The RW property $1}${2/.+/(?0:"""\n )/}def fget(self):
${2/.+/(?0:""")/}${2:The RW property $1}`!p if t[2]:
snip.rv += '"""'
snip >> 1
snip += ""
else:
snip.rv = ""`def fget(self):
return self._$1$0
def fset(self, value):
self._$1 = value

View File

@ -1,15 +1,32 @@
global !p
import vim
# Tests for the existence of a variable declared by Vim's filetype detection
# suggesting the type of shell script of the current file
def testShell(scope, shell):
return vim.eval("exists('" + scope + ":is_" + shell + "')")
# Loops over the possible variables, checking for global variables
# first since they indicate an override by the user.
def getShell():
for scope in ["g", "b"]:
for shell in ["bash", "sh", "kornshell"]:
if testShell(scope, shell) == "1":
if shell == "kornshell":
return "ksh"
return shell
return "sh"
endglobal
###########################################################################
# TextMate Snippets #
###########################################################################
snippet #!
#!/bin/sh
`!p snip.rv = '#!/bin/' + getShell() + "\n\n" `
endsnippet
snippet !env "#!/usr/bin/env (!env)"
#!/usr/bin/env bash
`!p snip.rv = '#!/usr/bin/env ' + getShell() + "\n\n" `
endsnippet
snippet temp "Tempfile"

View File

@ -1,4 +1,3 @@
extends texmath
###########################################################################
# LATEX SNIPPETS #

View File

@ -0,0 +1,9 @@
snippet t "Simple tag" b
<${1:tag}>
${2:content}
</${1/([\w:._-]+).*/$1/}>
endsnippet
snippet ti "Inline tag" b
<${1:tag}>${2:content}</${1/([\w:._-]+).*/$1/}>
endsnippet

View File

@ -0,0 +1,11 @@
snippet #! "shebang" !
#!/bin/zsh
endsnippet
snippet !env "#!/usr/bin/env (!env)" !
#!/usr/bin/env zsh
endsnippet
# vim:ft=snippets:

View File

@ -0,0 +1,9 @@
{
"name" : "snipmate-snippets",
"author" : "community",
"maintainer" : "honza @ github & others",
"repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"},
"dependencies" : {
},
"description" : "community driven set of snippets for snipmate"
}

View File

@ -1,122 +0,0 @@
snippet cls
clrscr;${1}
endsnippet
snippet tbg
textbackground(${1});${2}
endsnippet
snippet tc
textcolor(${1});${2}
endsnippet
snippet var
${1:varName} := ${2:value};
endsnippet
snippet program
program ${1:`!p snip.rv = snip.basename or "ProgramName"`};
uses crt;
var
${2}
begin
${3}
end.
endsnippet
snippet bg
begin
${1}
end${2}
endsnippet
snippet bg;
begin
${1}
end;${2}
endsnippet
snippet rec
type ${1} = record
${2}
end;${3}
endsnippet
snippet if
if ${1} then
${2}
endsnippet
snippet ife
if ${1} then
${2}
else
${3};
endsnippet
snippet wrl
writeln(${1});${2}
endsnippet
snippet wr
write(${1});${2}
endsnippet
snippet rd
read(${1});${2}
endsnippet
snippet rdl
readln(${1});${2}
endsnippet
snippet rdk
readkey;${1}
endsnippet
snippet gt
gotoxy(${1:0}, ${2:0});${3}
endsnippet
snippet case
case ${1} of
${2}
end;${3}
endsnippet
snippet for
for ${1:i} := ${2:0} to ${3:10} do
${4}
endsnippet
snippet wh
while ${1} do
${2}
endsnippet
snippet rep
repeat
${2}
until ${1};
endsnippet
snippet fun
function ${1:name} : ${2};
var
${3}
begin
${4}
end;
endsnippet
snippet pro
procedure ${1:name};
var
${2}
begin
${3}
end;
endsnippet

View File

@ -1,236 +0,0 @@
## Snippets from SnipMate, taken from
## https://github.com/scrooloose/snipmate-snippets.git
##############
# Comments #
##############
snippet /* "docblock"
/**
* ${1}
*/
${2}
endsnippet
snippet doc_f "doc_f"
/**
* $2
* @return ${4:void}
* @author ${5:`!v g:snips_author`}
**/
${1:public }function ${2:someFunc}(${3})
{
${6}
}$0
endsnippet
snippet doc_i "doc_i"
/**
* $1
* @package ${2:default}
* @author ${3:`!v g:snips_author`}
**/
interface ${1:someClass}
{
${4}
} // END interface $1"
endsnippet
###########
# Array #
###########
snippet array "PHP array"
$${1:var} = array(${2});${3}
endsnippet
snippet key "PHP array key"
'${1}' => ${2}
endsnippet
############
# CLasss #
############
snippet class "PHP class"
/**
* ${1}
*/
class ${2:ClassName}
{
${3}
function ${4:__construct}(${5:argument})
{
${6:// code...}
}
}
endsnippet
snippet . "PHP $this->" w
$this->${1:name}
endsnippet
##############################
# constant #
##############################
snippet def "PHP define"
define('${1}', ${2});${3}
endsnippet
snippet def? "PHP definied" w
defined('${1}')${2}
endsnippet
##############################
# ties #
##############################
snippet wh
while (${1:/* condition */}) {
${2:// code...}
}
endsnippet
snippet do "PHP do"
do {
${2:// code... }
} while (${1:/* condition */});"
endsnippet
snippet foreach "PHP foreach"
foreach ($${1:variable} as $${2:value}){
${3:// code...}
}
endsnippet
snippet foreachk "PHP foreachk"
foreach ($${1:variable} as $${2:key} => $${3:value}){
${4:// code...}
}
endsnippet
snippet for "PHP for"
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:// code...}
}
endsnippet
##############################
# condition #
##############################
snippet ife "PHP if else"
if (${1:/* condition */}) {
${2:// code...}
}
else {
${3:// code...}
}
${4}
endsnippet
snippet if "PHP if"
if (${1:/* condition */}) {
${2:// code...}
}
endsnippet
snippet el "PHP else"
else {
${1:// code...}
}${2}
endsnippet
snippet elf "PHP elseif"
elseif (${1:/* condition */}) {
${2:// code...}
}${3}
endsnippet
snippet t "PHP t"
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
endsnippet
snippet inc "PHP include"
include '${1:file}';${2}
endsnippet
snippet inc1 "PHP include_once"
include_once '${1:file}';${2}
endsnippet
snippet req "PHP require"
require_once '${1:file}';${2}
endsnippet
snippet req1 "PHP require_once"
require_once '${1:file}';${2}
endsnippet
snippet log "PHP error_log"
error_log(var_export(${1}, true));${2}
endsnippet
snippet G "PHP GLOBALS"
$GLOBALS['${1:variable}']${2}
endsnippet
snippet $_ "PHP COOKIE['...']"
$_COOKIE['${1:variable}']${2}
endsnippet
snippet $_ "PHP ENV['...']"
$_ENV['${1:variable}']${2}
endsnippet
snippet $_ "PHP FILES['...']"
$_FILES['${1:variable}']${2}
endsnippet
snippet $_ "PHP GET['...']"
$_GET['${1:variable}']${2}
endsnippet
snippet $_ "PHP POST['...']"
$_POST['${1:variable}']${2}
endsnippet
snippet $_ "PHP REQUEST['...']"
$_REQUEST['${1:variable}']${2}
endsnippet
snippet $_ "PHP SERVER['...']"
$_SERVER['${1:variable}']${2}
endsnippet
snippet $_ "PHP SESSION['...']"
$_SESSION['${1:variable}']${2}
endsnippet
snippet try "PHP try catch"
try {
${2}
} catch (${1:Exception} $e) {
}
endsnippet
snippet vare "PHP var_export"
var_export(${1});${2}
endsnippet
##############################
# write #
##############################
snippet ec "PHP echo"
echo ${1}
endsnippet
snippet pr "PHP print"
print ${1:$var};
endsnippet
snippet prf "PHP printf"
printf('${1:%s}', ${2});${3}
endsnippet
snippet sprf "PHP sprintf"
sprintf('${1:%s}', ${2});${3}
endsnippet
# :vim:ft=snippets:

View File

@ -1,74 +0,0 @@
snippet ec "PHTML echo"
<?php echo ${1:$var} ?>${2}
endsnippet
snippet inc "PHTML include"
<?php include '${1:file}' ?>${2}
endsnippet
snippet inc1 "PHTML include_once"
<?php include_once '${1:file}' ?>${2}
endsnippet
snippet req "PHTML require"
<?php require '${1:file}' ?>${2}
endsnippet
snippet req1 "PHTML require_once"
<?php require_once '${1:file}' ?>${2}
endsnippet
snippet if "PHTML if"
<?php if (${1:/* condition */}): ?>
${2:// code...}
<?php endif ?>
endsnippet
snippet ife "PHTML if else"
<?php if (${1:/* condition */}): ?>
${2:// code...}
<?php else: ?>
${3:// code...}
<?php endif ?>
${4}
endsnippet
snippet el "PHTML else"
<?php else: ?>
endsnippet
snippet elf "PHTML elseif"
<?php elseif (${1:/* condition */}): ?>
${2:// code...}
endsnippet
snippet wh "PHTML while"
<?php while (${1:/* condition */}): ?>
${2:// code...}
<?php endwhile ?>
endsnippet
snippet do "PHTML do"
<?php do: ?>
${2:// code... }
<?php while (${1:/* condition */}) ?>
endsnippet
snippet for "PHTML for"
<?php for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}): ?>
${4: // code...}
<?php endfor ?>
endsnippet
snippet foreach "PHTML foreach"
<?php foreach ($${1:variable} as $${2:value}): ?>
${3:// code...}
<?php endforeach ?>
endsnippet
snippet foreachk "PHTML foreach $key => $value"
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
${4:// code...}
<?php endforeach ?>
endsnippet

View File

@ -0,0 +1,239 @@
# Global snippets
# (c) holds no legal value ;)
snippet c)
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.${2}
snippet date
`strftime("%Y-%m-%d")`
snippet ddate
`strftime("%B %d, %Y")`
snippet time
`strftime("%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 (C) `strftime("%Y")` ${2:copyright holder}
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/>.
${3}
snippet LGPL2
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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/>.
${3}
snippet GPL3
${1:one line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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/>.
${3}
snippet LGPL3
${1:One line to give the program's name and a brief description.}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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/>.
${3}
snippet BSD2
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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 expressedor implied, of $2.
${4}
snippet BSD3
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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.
${4}
snippet BSD4
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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.
${4}
snippet MIT
${1:one line to give the program's name and a brief description}
Copyright (C) `strftime("%Y")` ${2:copyright holder}
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.
${3}
snippet APACHE
${1:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${2:copyright holder}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
${3}
snippet BEERWARE
${2:one line to give the program's name and a brief description}
Copyright `strftime("%Y")` ${3:copyright holder}
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
${1:`g:snips_author`} 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
${4}
snippet WTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright `strftime("%Y")` ${1:copyright holder}
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.

View File

@ -0,0 +1,157 @@
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} ${3:extends } {
public function $2 ( ) {
("start");
}
}
snippet all
package name {
${1:public|internal|final} class ${2:name} ${3: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}:
${3}
break;
default:
}
snippet case
case ${1}:
${2}
break;
snippet package
package ${1:package}{
${2}
}
snippet wh
while ${1:cond}{
${2}
}
snippet do
do {
${2}
} while (${1:cond})
snippet while
while ${1:cond}{
${2}
}
snippet for enumerate names
for (${1:var} in ${2:object}){
${3}
}
snippet for enumerate values
for each (${1:var} in ${2:object}){
${3}
}
snippet get_set
function get ${1:name} {
return ${2}
}
function set $1 (newValue) {
${3}
}
snippet interface
interface name {
function method(${1}):${2:returntype};
}
snippet try
try {
${1}
} catch (error:ErrorType) {
${2}
} finally {
${3}
}
# For Loop (same as c.snippet)
snippet for for (..) {..}
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4:/* code */}
}
# Custom For Loop
snippet forr
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
${5:/* code */}
}
# If Condition
snippet if
if (${1:/* condition */}) {
${2:/* code */}
}
snippet el
else {
${1}
}
# Ternary conditional
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
snippet fun
function ${1:function_name}(${2})${3}
{
${4:/* code */}
}
# 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: //code...}
}
override public function update():void
{
super.update();
${5: //code...}
}
}
}

View File

@ -0,0 +1,35 @@
# Snippets for code blocks used oftenly in Apache files.
# <Directory>
snippet dir
<Directory ${1:/}>
DirectoryIndex ${2:index.html}
Order Deny,Allow
Deny from All
</Directory>
# <FilesMatch>
snippet filesmatch
<FilesMatch "${1:regex}">
${2}
</FilesMatch>
# <IfModule>
snippet ifmodule
<IfModule ${1:mod_example.c}>
${2}
</IfModule>
# <LimitExcept>
snippet limitexcept
<LimitExcept ${1:POST GET}>
${2}
</LimitExcept>
# <Proxy>
snippet proxy
<Proxy ${1:*}>
${2}
</Proxy>
# <VirtualHost>
snippet virtualhost
<VirtualHost ${1:*}:${2:80}>
ServerAdmin ${3:webmaster@example.com}
DocumentRoot ${4:/www/example.com}
ServerName ${5:www.example.com}
</VirtualHost>

View File

@ -0,0 +1,66 @@
snippet if
If ${1:condition} Then
${2:; True code}
EndIf
snippet el
Else
${1}
snippet elif
ElseIf ${1:condition} Then
${2:; True code}
# If/Else block
snippet ifel
If ${1:condition} Then
${2:; True code}
Else
${3:; Else code}
EndIf
# If/ElseIf/Else block
snippet ifelif
If ${1:condition 1} Then
${2:; True code}
ElseIf ${3:condition 2} Then
${4:; True code}
Else
${5:; Else code}
EndIf
# Switch block
snippet switch
Switch (${1:condition})
Case {$2:case1}:
{$3:; Case 1 code}
Case Else:
{$4:; Else code}
EndSwitch
# Select block
snippet select
Select (${1:condition})
Case {$2:case1}:
{$3:; Case 1 code}
Case Else:
{$4:; Else code}
EndSelect
# While loop
snippet while
While (${1:condition})
${2:; code...}
WEnd
# For loop
snippet for
For ${1:n} = ${3:1} to ${2:count}
${4:; code...}
Next
# New Function
snippet func
Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${4:Return}
EndFunc
# Message box
snippet msg
MsgBox(${3:MsgType}, ${1:"Title"}, ${2:"Message Text"})
# Debug Message
snippet debug
MsgBox(0, "Debug", ${1:"Debug Message"})
# Show Variable Debug Message
snippet showvar
MsgBox(0, "${1:VarName}", $1)

View File

@ -0,0 +1,234 @@
## Main
# main
snippet main
int main(int argc, const char *argv[])
{
${1}
return 0;
}
# main(void)
snippet mainn
int main(void)
{
${1}
return 0;
}
##
## Preprocessor
# #include <...>
snippet inc
#include <${1:stdio}.h>${2}
# #include "..."
snippet Inc
#include "${1:`Filename("$1.h")`}"${2}
# ifndef...define...endif
snippet ndef
#ifndef $1
#define ${1:SYMBOL} ${2:value}
#endif${3}
# define
snippet def
#define
# ifdef...endif
snippet ifdef
#ifdef ${1:FOO}
${2:#define }
#endif${3}
# if
snippet #if
#if ${1:FOO}
${2}
#endif
# header include guard
snippet once
#ifndef ${1:`toupper(Filename('$1_H', 'UNTITLED_H'))`}
#define $1
${2}
#endif /* end of include guard: $1 */
##
## Control Statements
# if
snippet if
if (${1:/* condition */}) {
${2:/* code */}
}${3}
# else
snippet el
else {
${1}
}${2}
# else if
snippet elif
else if (${1:/* condition */}) {
${2:/* code */}
}${3}
# ternary
snippet t
${1:/* condition */} ? ${2:a} : ${3:b}
# switch
snippet switch
switch (${1:/* variable */}) {
case ${2:/* variable case */}:
${3}
${4:break;}${5}
default:
${6}
}${7}
# switch without default
snippet switchndef
switch (${1:/* variable */}) {
case ${2:/* variable case */}:
${3}
${4:break;}${5}
}${6}
# case
snippet case
case ${1:/* variable case */}:
${2}
${3:break;}${4}
##
## Loops
# for
snippet for
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4:/* code */}
}${5}
# for (custom)
snippet forr
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
${5:/* code */}
}${6}
# while
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}${3}
# do... while
snippet do
do {
${2:/* code */}
} while (${1:/* condition */});${3}
##
## Functions
# function definition
snippet fun
${1:void} ${2:function_name}(${3})
{
${4:/* code */}
}${5}
# function declaration
snippet fund
${1:void} ${2:function_name}(${3});${4}
##
## Types
# typedef
snippet td
typedef ${1:int} ${2:MyCustomType};${3}
# struct
snippet st
struct ${1:`Filename('$1_t', 'name')`} {
${2:/* data */}
}${3: /* optional variable list */};${4}
# typedef struct
snippet tds
typedef struct ${2:_$1 }{
${3:/* data */}
} ${1:`Filename('$1_t', 'name')`};${4}
# typedef enum
snippet tde
typedef enum {
${1:/* data */}
} ${2:foo};${3}
##
## Input/Output
# printf
snippet pr
printf("${1:%s}\n"${2});${3}
# fprintf (again, this isn't as nice as TextMate's version, but it works)
snippet fpr
fprintf(${1:stderr}, "${2:%s}\n"${3});${4}
# 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 )
{
${4}
}
}
##
## Miscellaneous
# This is kind of convenient
snippet .
[${1}]${2}
# GPL
snippet gpl
/*
* 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/>.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${2}

View File

@ -0,0 +1,204 @@
# 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:#}${19: 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:#}${23: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:#}${13: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:#}${19: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:#}${33: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:#}${17: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:#}${15: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:#}${25: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:#}${23: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:#}${25: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:#}${65::rollback} # Rollback the application to the previous release
end

View File

@ -0,0 +1,90 @@
snippet comm
(comment
${1}
)
snippet condp
(condp ${1:pred} ${2:expr}
${3})
snippet def
(def ${1})
snippet defm
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
${5})
snippet defmm
(defmulti ${1:name} "${2:doc-string}" ${3:dispatch-fn})
snippet defma
(defmacro ${1:name} "${2:doc-string}" ${3:dispatch-fn})
snippet defn
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
${4})
snippet defp
(defprotocol ${1:name}
${2})
snippet defr
(defrecord ${1:name} [${2:fields}]
${3:protocol}
${4})
snippet deft
(deftest ${1:name}
(is (= ${2:assertion})))
${3})
snippet is
(is (= ${1} ${2}))
snippet defty
(deftype ${1:Name} [${2:fields}]
${3:Protocol}
${4})
snippet doseq
(doseq [${1:elem} ${2:coll}]
${3})
snippet fn
(fn [${1:arg-list}] ${2})
snippet if
(if ${1:test-expr}
${2:then-expr}
${3:else-expr})
snippet if-let
(if-let [${1:result} ${2:test-expr}]
(${3:then-expr} $1)
(${4:else-expr}))
snippet imp
(:import [${1:package}])
& {:keys [${1:keys}] :or {${2:defaults}}}
snippet let
(let [${1:name} ${2:expr}]
${3})
snippet letfn
(letfn [(${1:name) [${2:args}]
${3})])
snippet map
(map ${1:func} ${2:coll})
snippet mapl
(map #(${1:lambda}) ${2:coll})
snippet met
(${1:name} [${2:this} ${3:args}]
${4})
snippet ns
(ns ${1:name}
${2})
snippet dotimes
(dotimes [_ 10]
(time
(dotimes [_ ${1:times}]
${2})))
snippet pmethod
(${1:name} [${2:this} ${3:args}])
snippet refer
(:refer-clojure :exclude [${1}])
snippet require
(:require [${1:namespace} :as [${2}]])
snippet use
(:use [${1:namespace} :only [${2}]])
snippet print
(println ${1})
snippet reduce
(reduce ${1:(fn [p n] ${3})} ${2})
snippet when
(when ${1:test} ${2:body})
snippet when-let
(when-let [${1:result} ${2:test}]
${3:body})

View File

@ -0,0 +1,58 @@
snippet cmake
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(${1:ProjectName})
FIND_PACKAGE(${2:LIBRARY})
INCLUDE_DIRECTORIES(
${$2_INCLUDE_DIR}
)
ADD_SUBDIRECTORY(${3:src})
ADD_EXECUTABLE($1)
TARGET_LINK_LIBRARIES($1
${$2_LIBRARIES}
)
snippet include
INCLUDE_DIRECTORIES(
${${1:INCLUDE_DIR}}
)
snippet find
FIND_PACKAGE(${1:LIBRARY})
snippet glob
FILE(GLOB ${1:SRCS} *.${2:cpp})
snippet subdir
ADD_SUBDIRECTORY(${1:src})
snippet lib
ADD_LIBRARY(${1:lib} ${2:STATIC}
${${3:SRCS}}
)
snippet link
TARGET_LINK_LIBRARIES(${1:bin}
${2:somelib}
)
snippet bin
ADD_EXECUTABLE(${1:bin})
snippet set
SET(${1:var} ${2:val})
snippet dep
ADD_DEPENDENCIES(${1:target}
${2:dep}
)
snippet props
SET_TARGET_PROPERTIES(${1:target}
${2:PROPERTIES} ${3:COMPILE_FLAGS}
${4:"-O3 -Wall -pedantic"}
)

View File

@ -0,0 +1,95 @@
# Closure loop
snippet forindo
for ${1:name} in ${2:array}
do ($1) ->
${3:// body}
# Array comprehension
snippet fora
for ${1:name} in ${2:array}
${3:// body...}
# Object comprehension
snippet foro
for ${1:key}, ${2:value} of ${3:object}
${4:// body...}
# Range comprehension (inclusive)
snippet forr
for ${1:name} in [${2:start}..${3:finish}]
${4:// body...}
snippet forrb
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
${5:// body...}
# Range comprehension (exclusive)
snippet forrex
for ${1:name} in [${2:start}...${3:finish}]
${4:// body...}
snippet forrexb
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
${5:// body...}
# Function
snippet fun
(${1:args}) ->
${2:// body...}
# Function (bound)
snippet bfun
(${1:args}) =>
${2:// body...}
# Class
snippet cla class ..
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
snippet cla class .. constructor: ..
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
constructor: (${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}
constructor: (${3:args}) ->
${4}
${5}
# If
snippet if
if ${1:condition}
${2:// body...}
# If __ Else
snippet ife
if ${1:condition}
${2:// body...}
else
${3:// body...}
# Else if
snippet elif
else if ${1:condition}
${2:// body...}
# Ternary If
snippet ifte
if ${1:condition} then ${2:value} else ${3:other}
# Unless
snippet unl
${1:action} unless ${2:condition}
# Switch
snippet swi
switch ${1:object}
when ${2:value}
${3:// body...}
# Log
snippet log
console.log ${1}
# Try __ Catch
snippet try
try
${1}
catch ${2:error}
${3}
# Require
snippet req
${2:$1} = require '${1:sys}'${3}
# Export
snippet exp
${1:root} = exports ? this

View File

@ -0,0 +1,131 @@
## STL Collections
# std::array
snippet array
std::array<${1:T}, ${2:N}> ${3};${4}
# std::vector
snippet vector
std::vector<${1:T}> ${2};${3}
# std::deque
snippet deque
std::deque<${1:T}> ${2};${3}
# std::forward_list
snippet flist
std::forward_list<${1:T}> ${2};${3}
# std::list
snippet list
std::list<${1:T}> ${2};${3}
# std::set
snippet set
std::set<${1:T}> ${2};${3}
# std::map
snippet map
std::map<${1:Key}, ${2:T}> ${3};${4}
# std::multiset
snippet mset
std::multiset<${1:T}> ${2};${3}
# std::multimap
snippet mmap
std::multimap<${1:Key}, ${2:T}> ${3};${4}
# std::unordered_set
snippet uset
std::unordered_set<${1:T}> ${2};${3}
# std::unordered_map
snippet umap
std::unordered_map<${1:Key}, ${2:T}> ${3};${4}
# std::unordered_multiset
snippet umset
std::unordered_multiset<${1:T}> ${2};${3}
# std::unordered_multimap
snippet ummap
std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4}
# std::stack
snippet stack
std::stack<${1:T}> ${2};${3}
# std::queue
snippet queue
std::queue<${1:T}> ${2};${3}
# std::priority_queue
snippet pqueue
std::priority_queue<${1:T}> ${2};${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:`Filename('$1', 'name')`}
{
public:
$1(${2});
~$1();
private:
${3:/* data */}
};
# member function implementation
snippet mfun
${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
${5:/* code */}
}
# namespace
snippet ns
namespace ${1:`Filename('', 'my')`} {
${2}
} /* namespace $1 */
##
## Input/Output
# std::cout
snippet cout
std::cout << ${1} << std::endl;${2}
# std::cin
snippet cin
std::cin >> ${1};${2}
##
## Iteration
# for i
snippet fori
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
${4:/* code */}
}${5}
# foreach
snippet fore
for (${1:auto} ${2:i} : ${3:container}) {
${4:/* code */}
}${5}
# iterator
snippet iter
for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {
${6}
}${7}
# auto iterator
snippet itera
for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) {
${2:std::cout << *$1 << std::endl;}
}${3}
##
## Lambdas
# lamda (one line)
snippet ld
[${1}](${2}){${3:/* code */}}${4}
# lambda (multi-line)
snippet lld
[${1}](${2}){
${3:/* code */}
}${4}

View File

@ -0,0 +1,374 @@
# 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!
#
# entry point
snippet sim
public static int Main(string[] args) {
${1}
return 0;
}
snippet simc
public class Application {
public static int Main(string[] args) {
${1}
return 0;
}
}
# if condition
snippet if
if (${1}) {
${2}
}
snippet el
else {
${1}
}
snippet ifs
if (${1})
${2}
# ternary conditional
snippet t
${1} ? ${2} : ${3}
snippet ?
${1} ? ${2} : ${3}
# do while loop
snippet do
do {
${2}
} while (${1});
# while loop
snippet wh
while (${1}) {
${2}
}
# for loop
snippet for
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++}) {
${4}
}
# foreach
snippet fore
foreach (var ${1:entry} in ${2}) {
${3}
}
snippet foreach
foreach (var ${1:entry} in ${2}) {
${3}
}
snippet each
foreach (var ${1:entry} in ${2}) {
${3}
}
# interfaces
snippet interface
public interface ${1:`Filename()`} {
${2}
}
snippet if+
public interface ${1:`Filename()`} {
${2}
}
# class bodies
snippet class
public class ${1:`Filename()`} {
${2}
}
snippet cls
${2:public} class ${1:`Filename()`} {
${3}
}
snippet cls+
public class ${1:`Filename()`} {
${2}
}
snippet cls+^
public static class ${1:`Filename()`} {
${2}
}
snippet cls&
internal class ${1:`Filename()`} {
${2}
}
snippet cls&^
internal static class ${1:`Filename()`} {
${2}
}
snippet cls|
protected class ${1:`Filename()`} {
${2}
}
snippet cls|%
protected abstract class ${1:`Filename()`} {
${2}
}
# constructor
snippet ctor
public ${1:`Filename()`}() {
${2}
}
# properties - auto properties by default.
# default type is int with layout get / set.
snippet prop
${1:public} ${2:int} ${3:} { get; set; }${4}
snippet p
${1:public} ${2:int} ${3:} { get; set; }${4}
snippet p+
public ${1:int} ${2:} { get; set; }${3}
snippet p+&
public ${1:int} ${2:} { get; internal set; }${3}
snippet p+|
public ${1:int} ${2:} { get; protected set; }${3}
snippet p+-
public ${1:int} ${2:} { get; private set; }${3}
snippet p&
internal ${1:int} ${2:} { get; set; }${3}
snippet p&|
internal ${1:int} ${2:} { get; protected set; }${3}
snippet p&-
internal ${1:int} ${2:} { get; private set; }${3}
snippet p|
protected ${1:int} ${2:} { get; set; }${3}
snippet p|-
protected ${1:int} ${2:} { get; private set; }${3}
snippet p-
private ${1:int} ${2:} { get; set; }${3}
# property - bool
snippet pi
${1:public} int ${2:} { get; set; }${3}
snippet pi+
public int ${1} { get; set; }${2}
snippet pi+&
public int ${1} { get; internal set; }${2}
snippet pi+|
public int ${1} { get; protected set; }${2}
snippet pi+-
public int ${1} { get; private set; }${2}
snippet pi&
internal int ${1} { get; set; }${2}
snippet pi&|
internal int ${1} { get; protected set; }${2}
snippet pi&-
internal int ${1} { get; private set; }${2}
snippet pi|
protected int ${1} { get; set; }${2}
snippet pi|-
protected int ${1} { get; private set; }${2}
snippet pi-
private int ${1} { get; set; }${2}
# property - bool
snippet pb
${1:public} bool ${2:} { get; set; }${3}
snippet pb+
public bool ${1} { get; set; }${2}
snippet pb+&
public bool ${1} { get; internal set; }${2}
snippet pb+|
public bool ${1} { get; protected set; }${2}
snippet pb+-
public bool ${1} { get; private set; }${2}
snippet pb&
internal bool ${1} { get; set; }${2}
snippet pb&|
internal bool ${1} { get; protected set; }${2}
snippet pb&-
internal bool ${1} { get; private set; }${2}
snippet pb|
protected bool ${1} { get; set; }${2}
snippet pb|-
protected bool ${1} { get; private set; }${2}
snippet pb-
private bool ${1} { get; set; }${2}
# property - string
snippet ps
${1:public} string ${2:} { get; set; }${3}
snippet ps+
public string ${1} { get; set; }${2}
snippet ps+&
public string ${1} { get; internal set; }${2}
snippet ps+|
public string ${1} { get; protected set; }${2}
snippet ps+-
public string ${1} { get; private set; }${2}
snippet ps&
internal string ${1} { get; set; }${2}
snippet ps&|
internal string ${1} { get; protected set; }${2}
snippet ps&-
internal string ${1} { get; private set; }${2}
snippet ps|
protected string ${1} { get; set; }${2}
snippet ps|-
protected string ${1} { get; private set; }${2}
snippet ps-
private string ${1} { get; set; }${2}
# members - void
snippet m
${1:public} ${2:void} ${3:}(${4:}) {
${5:}
}
snippet m+
public ${1:void} ${2:}(${3:}) {
${4:}
}
snippet m&
internal ${1:void} ${2:}(${3:}) {
${4:}
}
snippet m|
protected ${1:void} ${2:}(${3:}) {
${4:}
}
snippet m-
private ${1:void} ${2:}(${3:}) {
${4:}
}
# members - int
snippet mi
${1:public} int ${2:}(${3:}) {
${4:return 0;}
}
snippet mi+
public int ${1:}(${2:}) {
${3:return 0;}
}
snippet mi&
internal int ${1:}(${2:}) {
${3:return 0;}
}
snippet mi|
protected int ${1:}(${2:}) {
${3:return 0;}
}
snippet mi-
private int ${1:}(${2:}) {
${3:return 0;}
}
# members - bool
snippet mb
${1:public} bool ${2:}(${3:}) {
${4:return false;}
}
snippet mb+
public bool ${1:}(${2:}) {
${3:return false;}
}
snippet mb&
internal bool ${1:}(${2:}) {
${3:return false;}
}
snippet mb|
protected bool ${1:}(${2:}) {
${3:return false;}
}
snippet mb-
private bool ${1:}(${2:}) {
${3:return false;}
}
# members - string
snippet ms
${1:public} string ${2:}(${3:}) {
${4:return "";}
}
snippet ms+
public string ${1:}(${2:}) {
${3:return "";}
}
snippet ms&
internal string ${1:}(${2:}) {
${3:return "";}
}
snippet ms|
protected string ${1:}(${2:}) {
${3:return "";}
}
snippet ms-
private string ${1:}(${2:}) {
${3:return "";}
}
# structure
snippet struct
public struct ${1:`Filename()`} {
${2}
}
# enumeration
snippet enum
public enum ${1} {
${2}
}
# preprocessor directives
snippet #if
#if
${1}
#endif
# inline xml documentation
snippet ///
/// <summary>
/// ${1}
/// </summary>
snippet <p
<param name="${1}">${2:$1}</param>${3}
snippet <ex
<exception cref="${1:System.Exception}">${2}</exception>${3}
snippet <r
<returns>${1}</returns>{${2}
snippet <s
<see cref="${1}"/>${2}
snippet <rem
<remarks>${1}</remarks>${2}
snippet <c
<code>${1}</code>${2}

View File

@ -0,0 +1,967 @@
snippet .
${1} {
${2}
}
snippet !
!important
snippet bdi:m+
-moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};
snippet bdi:m
-moz-border-image: ${1};
snippet bdrz:m
-moz-border-radius: ${1};
snippet bxsh:m+
-moz-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet bxsh:m
-moz-box-shadow: ${1};
snippet bdi:w+
-webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};
snippet bdi:w
-webkit-border-image: ${1};
snippet bdrz:w
-webkit-border-radius: ${1};
snippet bxsh:w+
-webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet bxsh:w
-webkit-box-shadow: ${1};
snippet @f
@font-face {
font-family: ${1};
src: url(${2});
}
snippet @i
@import url(${1});
snippet @m
@media ${1:print} {
${2}
}
snippet bg+
background: #${1:FFF} url(${2}) ${3:0} ${4:0} ${5:no-repeat};
snippet bga
background-attachment: ${1};
snippet bga:f
background-attachment: fixed;
snippet bga:s
background-attachment: scroll;
snippet bgbk
background-break: ${1};
snippet bgbk:bb
background-break: bounding-box;
snippet bgbk:c
background-break: continuous;
snippet bgbk:eb
background-break: each-box;
snippet bgcp
background-clip: ${1};
snippet bgcp:bb
background-clip: border-box;
snippet bgcp:cb
background-clip: content-box;
snippet bgcp:nc
background-clip: no-clip;
snippet bgcp:pb
background-clip: padding-box;
snippet bgc
background-color: #${1:FFF};
snippet bgc:t
background-color: transparent;
snippet bgi
background-image: url(${1});
snippet bgi:n
background-image: none;
snippet bgo
background-origin: ${1};
snippet bgo:bb
background-origin: border-box;
snippet bgo:cb
background-origin: content-box;
snippet bgo:pb
background-origin: padding-box;
snippet bgpx
background-position-x: ${1};
snippet bgpy
background-position-y: ${1};
snippet bgp
background-position: ${1:0} ${2:0};
snippet bgr
background-repeat: ${1};
snippet bgr:n
background-repeat: no-repeat;
snippet bgr:x
background-repeat: repeat-x;
snippet bgr:y
background-repeat: repeat-y;
snippet bgr:r
background-repeat: repeat;
snippet bgz
background-size: ${1};
snippet bgz:a
background-size: auto;
snippet bgz:ct
background-size: contain;
snippet bgz:cv
background-size: cover;
snippet bg
background: ${1};
snippet bg:ie
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${2:crop}');
snippet bg:n
background: none;
snippet bd+
border: ${1:1px} ${2:solid} #${3:000};
snippet bdb+
border-bottom: ${1:1px} ${2:solid} #${3:000};
snippet bdbc
border-bottom-color: #${1:000};
snippet bdbi
border-bottom-image: url(${1});
snippet bdbi:n
border-bottom-image: none;
snippet bdbli
border-bottom-left-image: url(${1});
snippet bdbli:c
border-bottom-left-image: continue;
snippet bdbli:n
border-bottom-left-image: none;
snippet bdblrz
border-bottom-left-radius: ${1};
snippet bdbri
border-bottom-right-image: url(${1});
snippet bdbri:c
border-bottom-right-image: continue;
snippet bdbri:n
border-bottom-right-image: none;
snippet bdbrrz
border-bottom-right-radius: ${1};
snippet bdbs
border-bottom-style: ${1};
snippet bdbs:n
border-bottom-style: none;
snippet bdbw
border-bottom-width: ${1};
snippet bdb
border-bottom: ${1};
snippet bdb:n
border-bottom: none;
snippet bdbk
border-break: ${1};
snippet bdbk:c
border-break: close;
snippet bdcl
border-collapse: ${1};
snippet bdcl:c
border-collapse: collapse;
snippet bdcl:s
border-collapse: separate;
snippet bdc
border-color: #${1:000};
snippet bdci
border-corner-image: url(${1});
snippet bdci:c
border-corner-image: continue;
snippet bdci:n
border-corner-image: none;
snippet bdf
border-fit: ${1};
snippet bdf:c
border-fit: clip;
snippet bdf:of
border-fit: overwrite;
snippet bdf:ow
border-fit: overwrite;
snippet bdf:r
border-fit: repeat;
snippet bdf:sc
border-fit: scale;
snippet bdf:sp
border-fit: space;
snippet bdf:st
border-fit: stretch;
snippet bdi
border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};
snippet bdi:n
border-image: none;
snippet bdl+
border-left: ${1:1px} ${2:solid} #${3:000};
snippet bdlc
border-left-color: #${1:000};
snippet bdli
border-left-image: url(${1});
snippet bdli:n
border-left-image: none;
snippet bdls
border-left-style: ${1};
snippet bdls:n
border-left-style: none;
snippet bdlw
border-left-width: ${1};
snippet bdl
border-left: ${1};
snippet bdl:n
border-left: none;
snippet bdlt
border-length: ${1};
snippet bdlt:a
border-length: auto;
snippet bdrz
border-radius: ${1};
snippet bdr+
border-right: ${1:1px} ${2:solid} #${3:000};
snippet bdrc
border-right-color: #${1:000};
snippet bdri
border-right-image: url(${1});
snippet bdri:n
border-right-image: none;
snippet bdrs
border-right-style: ${1};
snippet bdrs:n
border-right-style: none;
snippet bdrw
border-right-width: ${1};
snippet bdr
border-right: ${1};
snippet bdr:n
border-right: none;
snippet bdsp
border-spacing: ${1};
snippet bds
border-style: ${1};
snippet bds:ds
border-style: dashed;
snippet bds:dtds
border-style: dot-dash;
snippet bds:dtdtds
border-style: dot-dot-dash;
snippet bds:dt
border-style: dotted;
snippet bds:db
border-style: double;
snippet bds:g
border-style: groove;
snippet bds:h
border-style: hidden;
snippet bds:i
border-style: inset;
snippet bds:n
border-style: none;
snippet bds:o
border-style: outset;
snippet bds:r
border-style: ridge;
snippet bds:s
border-style: solid;
snippet bds:w
border-style: wave;
snippet bdt+
border-top: ${1:1px} ${2:solid} #${3:000};
snippet bdtc
border-top-color: #${1:000};
snippet bdti
border-top-image: url(${1});
snippet bdti:n
border-top-image: none;
snippet bdtli
border-top-left-image: url(${1});
snippet bdtli:c
border-corner-image: continue;
snippet bdtli:n
border-corner-image: none;
snippet bdtlrz
border-top-left-radius: ${1};
snippet bdtri
border-top-right-image: url(${1});
snippet bdtri:c
border-top-right-image: continue;
snippet bdtri:n
border-top-right-image: none;
snippet bdtrrz
border-top-right-radius: ${1};
snippet bdts
border-top-style: ${1};
snippet bdts:n
border-top-style: none;
snippet bdtw
border-top-width: ${1};
snippet bdt
border-top: ${1};
snippet bdt:n
border-top: none;
snippet bdw
border-width: ${1};
snippet bd
border: ${1};
snippet bd:n
border: none;
snippet b
bottom: ${1};
snippet b:a
bottom: auto;
snippet bxsh+
box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet bxsh
box-shadow: ${1};
snippet bxsh:n
box-shadow: none;
snippet bxz
box-sizing: ${1};
snippet bxz:bb
box-sizing: border-box;
snippet bxz:cb
box-sizing: content-box;
snippet cps
caption-side: ${1};
snippet cps:b
caption-side: bottom;
snippet cps:t
caption-side: top;
snippet cl
clear: ${1};
snippet cl:b
clear: both;
snippet cl:l
clear: left;
snippet cl:n
clear: none;
snippet cl:r
clear: right;
snippet cp
clip: ${1};
snippet cp:a
clip: auto;
snippet cp:r
clip: rect(${1:0} ${2:0} ${3:0} ${4:0});
snippet c
color: #${1:000};
snippet ct
content: ${1};
snippet ct:a
content: attr(${1});
snippet ct:cq
content: close-quote;
snippet ct:c
content: counter(${1});
snippet ct:cs
content: counters(${1});
snippet ct:ncq
content: no-close-quote;
snippet ct:noq
content: no-open-quote;
snippet ct:n
content: normal;
snippet ct:oq
content: open-quote;
snippet coi
counter-increment: ${1};
snippet cor
counter-reset: ${1};
snippet cur
cursor: ${1};
snippet cur:a
cursor: auto;
snippet cur:c
cursor: crosshair;
snippet cur:d
cursor: default;
snippet cur:ha
cursor: hand;
snippet cur:he
cursor: help;
snippet cur:m
cursor: move;
snippet cur:p
cursor: pointer;
snippet cur:t
cursor: text;
snippet d
display: ${1};
snippet d:mib
display: -moz-inline-box;
snippet d:mis
display: -moz-inline-stack;
snippet d:b
display: block;
snippet d:cp
display: compact;
snippet d:ib
display: inline-block;
snippet d:itb
display: inline-table;
snippet d:i
display: inline;
snippet d:li
display: list-item;
snippet d:n
display: none;
snippet d:ri
display: run-in;
snippet d:tbcp
display: table-caption;
snippet d:tbc
display: table-cell;
snippet d:tbclg
display: table-column-group;
snippet d:tbcl
display: table-column;
snippet d:tbfg
display: table-footer-group;
snippet d:tbhg
display: table-header-group;
snippet d:tbrg
display: table-row-group;
snippet d:tbr
display: table-row;
snippet d:tb
display: table;
snippet ec
empty-cells: ${1};
snippet ec:h
empty-cells: hide;
snippet ec:s
empty-cells: show;
snippet exp
expression()
snippet fl
float: ${1};
snippet fl:l
float: left;
snippet fl:n
float: none;
snippet fl:r
float: right;
snippet f+
font: ${1:1em} ${2:Arial},${3:sans-serif};
snippet fef
font-effect: ${1};
snippet fef:eb
font-effect: emboss;
snippet fef:eg
font-effect: engrave;
snippet fef:n
font-effect: none;
snippet fef:o
font-effect: outline;
snippet femp
font-emphasize-position: ${1};
snippet femp:a
font-emphasize-position: after;
snippet femp:b
font-emphasize-position: before;
snippet fems
font-emphasize-style: ${1};
snippet fems:ac
font-emphasize-style: accent;
snippet fems:c
font-emphasize-style: circle;
snippet fems:ds
font-emphasize-style: disc;
snippet fems:dt
font-emphasize-style: dot;
snippet fems:n
font-emphasize-style: none;
snippet fem
font-emphasize: ${1};
snippet ff
font-family: ${1};
snippet ff:c
font-family: ${1:'Monotype Corsiva','Comic Sans MS'},cursive;
snippet ff:f
font-family: ${1:Capitals,Impact},fantasy;
snippet ff:m
font-family: ${1:Monaco,'Courier New'},monospace;
snippet ff:ss
font-family: ${1:Helvetica,Arial},sans-serif;
snippet ff:s
font-family: ${1:Georgia,'Times New Roman'},serif;
snippet fza
font-size-adjust: ${1};
snippet fza:n
font-size-adjust: none;
snippet fz
font-size: ${1};
snippet fsm
font-smooth: ${1};
snippet fsm:aw
font-smooth: always;
snippet fsm:a
font-smooth: auto;
snippet fsm:n
font-smooth: never;
snippet fst
font-stretch: ${1};
snippet fst:c
font-stretch: condensed;
snippet fst:e
font-stretch: expanded;
snippet fst:ec
font-stretch: extra-condensed;
snippet fst:ee
font-stretch: extra-expanded;
snippet fst:n
font-stretch: normal;
snippet fst:sc
font-stretch: semi-condensed;
snippet fst:se
font-stretch: semi-expanded;
snippet fst:uc
font-stretch: ultra-condensed;
snippet fst:ue
font-stretch: ultra-expanded;
snippet fs
font-style: ${1};
snippet fs:i
font-style: italic;
snippet fs:n
font-style: normal;
snippet fs:o
font-style: oblique;
snippet fv
font-variant: ${1};
snippet fv:n
font-variant: normal;
snippet fv:sc
font-variant: small-caps;
snippet fw
font-weight: ${1};
snippet fw:b
font-weight: bold;
snippet fw:br
font-weight: bolder;
snippet fw:lr
font-weight: lighter;
snippet fw:n
font-weight: normal;
snippet f
font: ${1};
snippet h
height: ${1};
snippet h:a
height: auto;
snippet l
left: ${1};
snippet l:a
left: auto;
snippet lts
letter-spacing: ${1};
snippet lh
line-height: ${1};
snippet lisi
list-style-image: url(${1});
snippet lisi:n
list-style-image: none;
snippet lisp
list-style-position: ${1};
snippet lisp:i
list-style-position: inside;
snippet lisp:o
list-style-position: outside;
snippet list
list-style-type: ${1};
snippet list:c
list-style-type: circle;
snippet list:dclz
list-style-type: decimal-leading-zero;
snippet list:dc
list-style-type: decimal;
snippet list:d
list-style-type: disc;
snippet list:lr
list-style-type: lower-roman;
snippet list:n
list-style-type: none;
snippet list:s
list-style-type: square;
snippet list:ur
list-style-type: upper-roman;
snippet lis
list-style: ${1};
snippet lis:n
list-style: none;
snippet mb
margin-bottom: ${1};
snippet mb:a
margin-bottom: auto;
snippet ml
margin-left: ${1};
snippet ml:a
margin-left: auto;
snippet mr
margin-right: ${1};
snippet mr:a
margin-right: auto;
snippet mt
margin-top: ${1};
snippet mt:a
margin-top: auto;
snippet m
margin: ${1};
snippet m:4
margin: ${1:0} ${2:0} ${3:0} ${4:0};
snippet m:3
margin: ${1:0} ${2:0} ${3:0};
snippet m:2
margin: ${1:0} ${2:0};
snippet m:0
margin: 0;
snippet m:a
margin: auto;
snippet mah
max-height: ${1};
snippet mah:n
max-height: none;
snippet maw
max-width: ${1};
snippet maw:n
max-width: none;
snippet mih
min-height: ${1};
snippet miw
min-width: ${1};
snippet op
opacity: ${1};
snippet op:ie
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100});
snippet op:ms
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100})';
snippet orp
orphans: ${1};
snippet o+
outline: ${1:1px} ${2:solid} #${3:000};
snippet oc
outline-color: ${1:#000};
snippet oc:i
outline-color: invert;
snippet oo
outline-offset: ${1};
snippet os
outline-style: ${1};
snippet ow
outline-width: ${1};
snippet o
outline: ${1};
snippet o:n
outline: none;
snippet ovs
overflow-style: ${1};
snippet ovs:a
overflow-style: auto;
snippet ovs:mq
overflow-style: marquee;
snippet ovs:mv
overflow-style: move;
snippet ovs:p
overflow-style: panner;
snippet ovs:s
overflow-style: scrollbar;
snippet ovx
overflow-x: ${1};
snippet ovx:a
overflow-x: auto;
snippet ovx:h
overflow-x: hidden;
snippet ovx:s
overflow-x: scroll;
snippet ovx:v
overflow-x: visible;
snippet ovy
overflow-y: ${1};
snippet ovy:a
overflow-y: auto;
snippet ovy:h
overflow-y: hidden;
snippet ovy:s
overflow-y: scroll;
snippet ovy:v
overflow-y: visible;
snippet ov
overflow: ${1};
snippet ov:a
overflow: auto;
snippet ov:h
overflow: hidden;
snippet ov:s
overflow: scroll;
snippet ov:v
overflow: visible;
snippet pb
padding-bottom: ${1};
snippet pl
padding-left: ${1};
snippet pr
padding-right: ${1};
snippet pt
padding-top: ${1};
snippet p
padding: ${1};
snippet p:4
padding: ${1:0} ${2:0} ${3:0} ${4:0};
snippet p:3
padding: ${1:0} ${2:0} ${3:0};
snippet p:2
padding: ${1:0} ${2:0};
snippet p:0
padding: 0;
snippet pgba
page-break-after: ${1};
snippet pgba:aw
page-break-after: always;
snippet pgba:a
page-break-after: auto;
snippet pgba:l
page-break-after: left;
snippet pgba:r
page-break-after: right;
snippet pgbb
page-break-before: ${1};
snippet pgbb:aw
page-break-before: always;
snippet pgbb:a
page-break-before: auto;
snippet pgbb:l
page-break-before: left;
snippet pgbb:r
page-break-before: right;
snippet pgbi
page-break-inside: ${1};
snippet pgbi:a
page-break-inside: auto;
snippet pgbi:av
page-break-inside: avoid;
snippet pos
position: ${1};
snippet pos:a
position: absolute;
snippet pos:f
position: fixed;
snippet pos:r
position: relative;
snippet pos:s
position: static;
snippet q
quotes: ${1};
snippet q:en
quotes: '\201C' '\201D' '\2018' '\2019';
snippet q:n
quotes: none;
snippet q:ru
quotes: '\00AB' '\00BB' '\201E' '\201C';
snippet rz
resize: ${1};
snippet rz:b
resize: both;
snippet rz:h
resize: horizontal;
snippet rz:n
resize: none;
snippet rz:v
resize: vertical;
snippet r
right: ${1};
snippet r:a
right: auto;
snippet tbl
table-layout: ${1};
snippet tbl:a
table-layout: auto;
snippet tbl:f
table-layout: fixed;
snippet tal
text-align-last: ${1};
snippet tal:a
text-align-last: auto;
snippet tal:c
text-align-last: center;
snippet tal:l
text-align-last: left;
snippet tal:r
text-align-last: right;
snippet ta
text-align: ${1};
snippet ta:c
text-align: center;
snippet ta:l
text-align: left;
snippet ta:r
text-align: right;
snippet td
text-decoration: ${1};
snippet td:l
text-decoration: line-through;
snippet td:n
text-decoration: none;
snippet td:o
text-decoration: overline;
snippet td:u
text-decoration: underline;
snippet te
text-emphasis: ${1};
snippet te:ac
text-emphasis: accent;
snippet te:a
text-emphasis: after;
snippet te:b
text-emphasis: before;
snippet te:c
text-emphasis: circle;
snippet te:ds
text-emphasis: disc;
snippet te:dt
text-emphasis: dot;
snippet te:n
text-emphasis: none;
snippet th
text-height: ${1};
snippet th:a
text-height: auto;
snippet th:f
text-height: font-size;
snippet th:m
text-height: max-size;
snippet th:t
text-height: text-size;
snippet ti
text-indent: ${1};
snippet ti:-
text-indent: -9999px;
snippet tj
text-justify: ${1};
snippet tj:a
text-justify: auto;
snippet tj:d
text-justify: distribute;
snippet tj:ic
text-justify: inter-cluster;
snippet tj:ii
text-justify: inter-ideograph;
snippet tj:iw
text-justify: inter-word;
snippet tj:k
text-justify: kashida;
snippet tj:t
text-justify: tibetan;
snippet to+
text-outline: ${1:0} ${2:0} #${3:000};
snippet to
text-outline: ${1};
snippet to:n
text-outline: none;
snippet tr
text-replace: ${1};
snippet tr:n
text-replace: none;
snippet tsh+
text-shadow: ${1:0} ${2:0} ${3:0} #${4:000};
snippet tsh
text-shadow: ${1};
snippet tsh:n
text-shadow: none;
snippet tt
text-transform: ${1};
snippet tt:c
text-transform: capitalize;
snippet tt:l
text-transform: lowercase;
snippet tt:n
text-transform: none;
snippet tt:u
text-transform: uppercase;
snippet tw
text-wrap: ${1};
snippet tw:no
text-wrap: none;
snippet tw:n
text-wrap: normal;
snippet tw:s
text-wrap: suppress;
snippet tw:u
text-wrap: unrestricted;
snippet t
top: ${1};
snippet t:a
top: auto;
snippet va
vertical-align: ${1};
snippet va:bl
vertical-align: baseline;
snippet va:b
vertical-align: bottom;
snippet va:m
vertical-align: middle;
snippet va:sub
vertical-align: sub;
snippet va:sup
vertical-align: super;
snippet va:tb
vertical-align: text-bottom;
snippet va:tt
vertical-align: text-top;
snippet va:t
vertical-align: top;
snippet v
visibility: ${1};
snippet v:c
visibility: collapse;
snippet v:h
visibility: hidden;
snippet v:v
visibility: visible;
snippet whsc
white-space-collapse: ${1};
snippet whsc:ba
white-space-collapse: break-all;
snippet whsc:bs
white-space-collapse: break-strict;
snippet whsc:k
white-space-collapse: keep-all;
snippet whsc:l
white-space-collapse: loose;
snippet whsc:n
white-space-collapse: normal;
snippet whs
white-space: ${1};
snippet whs:n
white-space: normal;
snippet whs:nw
white-space: nowrap;
snippet whs:pl
white-space: pre-line;
snippet whs:pw
white-space: pre-wrap;
snippet whs:p
white-space: pre;
snippet wid
widows: ${1};
snippet w
width: ${1};
snippet w:a
width: auto;
snippet wob
word-break: ${1};
snippet wob:ba
word-break: break-all;
snippet wob:bs
word-break: break-strict;
snippet wob:k
word-break: keep-all;
snippet wob:l
word-break: loose;
snippet wob:n
word-break: normal;
snippet wos
word-spacing: ${1};
snippet wow
word-wrap: ${1};
snippet wow:no
word-wrap: none;
snippet wow:n
word-wrap: normal;
snippet wow:s
word-wrap: suppress;
snippet wow:u
word-wrap: unrestricted;
snippet z
z-index: ${1};
snippet z:a
z-index: auto;
snippet zoo
zoom: 1;

View File

@ -0,0 +1,82 @@
snippet lib
#library('${1}');
${2}
snippet im
#import('${1}');
${2}
snippet so
#source('${1}');
${2}
snippet main
static void main() {
${1:/* code */}
}
snippet st
static ${1}
snippet fi
final ${1}
snippet re
return ${1}
snippet br
break;
snippet th
throw ${1}
snippet cl
class ${1:`Filename("", "untitled")`} ${2}
snippet in
interface ${1:`Filename("", "untitled")`} ${2}
snippet imp
implements ${1}
snippet ext
extends ${1}
snippet if
if (${1:true}) {
${2}
}
snippet ife
if (${1:true}) {
${2}
} else {
${3}
}
snippet el
else
snippet sw
switch (${1}) {
${2}
}
snippet cs
case ${1}:
${2}
snippet de
default:
${1}
snippet for
for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) {
${4:$1[$2]}
}
snippet fore
for (final ${2:item} in ${1:itemList}) {
${3:/* code */}
}
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}
snippet dowh
do {
${2:/* code */}
} while (${1:/* condition */});
snippet as
assert(${1:/* condition */});
snippet try
try {
${2}
} catch (${1:Exception e}) {
}
snippet tryf
try {
${2}
} catch (${1:Exception e}) {
} finally {
}

View File

@ -0,0 +1,11 @@
# 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: ${9:upstream version|url|commit}

View File

@ -0,0 +1,108 @@
# 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(${2})
snippet bool
${1:FIELDNAME} = models.BooleanField(${2:default=True})
snippet char
${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True})
snippet comma
${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${3:, blank=True})
snippet date
${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})
snippet datetime
${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})
snippet decimal
${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3})
snippet email
${1:FIELDNAME} = models.EmailField(max_length=${2:75}${3:, blank=True})
snippet file
${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${3:, 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}${6:, blank=True, })
snippet float
${1:FIELDNAME} = models.FloatField(${2})
snippet image
${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100})
snippet int
${1:FIELDNAME} = models.IntegerField(${2})
snippet ip
${1:FIELDNAME} = models.IPAddressField(${2})
snippet nullbool
${1:FIELDNAME} = models.NullBooleanField(${2})
snippet posint
${1:FIELDNAME} = models.PositiveIntegerField(${2})
snippet possmallint
${1:FIELDNAME} = models.PositiveSmallIntegerField(${2})
snippet slug
${1:FIELDNAME} = models.SlugField(max_length=${2:50}${3:, blank=True})
snippet smallint
${1:FIELDNAME} = models.SmallIntegerField(${2})
snippet text
${1:FIELDNAME} = models.TextField(${2:blank=True})
snippet time
${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})
snippet url
${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${4:, blank=True})
snippet xml
${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${3:, blank=True})
# Relational Fields
snippet fk
${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''})
snippet m2m
${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''})
snippet o2o
${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''})
# Code Skeletons
snippet form
class ${1:FormName}(forms.Form):
"""${2:docstring}"""
${3}
snippet model
class ${1:ModelName}(models.Model):
"""${2:docstring}"""
${3}
class Meta:
${4}
def __unicode__(self):
${5}
def save(self, force_insert=False, force_update=False):
${6}
@models.permalink
def get_absolute_url(self):
return ('${7:view_or_url_name}' ${8})
snippet modeladmin
class ${1:ModelName}Admin(admin.ModelAdmin):
${2}
admin.site.register($1, $1Admin)
snippet tabularinline
class ${1:ModelName}Inline(admin.TabularInline):
model = $1
snippet stackedinline
class ${1:ModelName}Inline(admin.StackedInline):
model = $1
snippet r2r
return render_to_response('${1:template.html}', {
${2}
}${3:, context_instance=RequestContext(request)}
)

View File

@ -0,0 +1,160 @@
# module and export all
snippet mod
-module(${1:`Filename('', 'my')`}).
-compile([export_all]).
start() ->
${2}
stop() ->
ok.
# define directive
snippet def
-define(${1:macro}, ${2:body}).${3}
# export directive
snippet exp
-export([${1:function}/${2:arity}]).
# include directive
snippet inc
-include("${1:file}").${2}
# behavior directive
snippet beh
-behaviour(${1:behaviour}).${2}
# if expression
snippet if
if
${1:guard} ->
${2:body}
end
# case expression
snippet case
case ${1:expression} of
${2:pattern} ->
${3:body};
end
# anonymous function
snippet fun
fun (${1:Parameters}) -> ${2:body} end${3}
# try...catch
snippet try
try
${1}
catch
${2:_:_} -> ${3:got_some_exception}
end
# record directive
snippet rec
-record(${1:record}, {
${2:field}=${3:value}}).${4}
# todo comment
snippet todo
%% TODO: ${1}
## 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 ${1}
# end of doc comment
snippet %e
%% @end
# specification comment
snippet %s
%% @spec ${1}
# private function marker
snippet %p
%% @private
# OTP application
snippet application
-module(${1:`Filename('', 'my')`}).
-behaviour(application).
-export([start/2, stop/1]).
start(_Type, _StartArgs) ->
case ${2:root_supervisor}:start_link() of
{ok, Pid} ->
{ok, Pid};
Other ->
{error, Other}
end.
stop(_State) ->
ok.
# OTP supervisor
snippet supervisor
-module(${1:`Filename('', 'my')`}).
-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 = {${2: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(${1:`Filename('', 'my')`}).
-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
%%%===================================================================

View File

@ -0,0 +1,113 @@
# .erb and .rhmtl files
# Includes html.snippets
# Rails *****************************
snippet rc
<% ${1} %>
snippet rce
<%= ${1} %>${2}
snippet %
<% ${1} %>
snippet =
<%= ${1} %>${2}
snippet end
<% end %>${1}
snippet ead
<% ${1}.each do |${2}| %>
${3}
<% end %>
snippet for
<% for ${2:item} in ${1} %>
${3}
<% end %>
snippet rp
<%= render :partial => '${1:item}' %>
snippet rpl
<%= render :partial => '${1:item}', :locals => { :${2:name} => '${3:value}'$4 } %>
snippet rps
<%= render :partial => '${1:item}', :status => ${2:500} %>
snippet rpc
<%= render :partial => '${1:item}', :collection => ${2:items} %>
snippet lia
<%= link_to '${1:link text...}', :action => '${2:index}' %>
snippet liai
<%= link_to '${1:link text...}', :action => '${2:edit}', :id => ${3:@item} %>
snippet lic
<%= link_to '${1:link text...}', :controller => '${2:items}' %>
snippet lica
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:index}' %>
snippet licai
<%= link_to '${1:link text...}', :controller => '${2:items}', :action => '${3:edit}', :id => ${4:@item} %>
snippet yield
<%= yield ${1::content_symbol} %>${2}
snippet conf
<% content_for :${1:head} do %>
${2}
<% end %>
snippet cs
<%= collection_select <+object+>, <+method+>, <+collection+>, <+value_method+>, <+text_method+><+, <+[options]+>, <+[html_options]+>+> %>
snippet ct
<%= content_tag '${1:DIV}', ${2:content}${3:,options} %>
snippet ff
<% form_for @${1:model} do |f| %>
${2}
<% end %>
snippet ffcb
<%= ${1:f}.check_box :${2:attribute} %>
snippet ffe
<% error_messages_for :${1:model} %>
<% form_for @${2:model} do |f| %>
${3}
<% end %>
snippet ffff
<%= ${1:f}.file_field :${2:attribute} %>
snippet ffhf
<%= ${1:f}.hidden_field :${2:attribute} %>
snippet ffl
<%= ${1:f}.label :${2:attribute}, '${3:$2}' %>
snippet ffpf
<%= ${1:f}.password_field :${2:attribute} %>
snippet ffrb
<%= ${1:f}.radio_button :${2:attribute}, :${3:tag_value} %>
snippet ffs
<%= ${1:f}.submit "${2:submit}" %>
snippet ffta
<%= ${1:f}.text_area :${2:attribute} %>
snippet fftf
<%= ${1:f}.text_field :${2:attribute} %>
snippet fields
<% fields_for :${1:model}, @$1 do |${2:f}| %>
${3}
<% end %>
snippet i18
I18n.t('${1:type.key}')${2}
snippet it
<%= image_tag "${1}"${2} %>
snippet jit
<%= javascript_include_tag ${1::all} %>
snippet jsit
<%= javascript_include_tag "${1}" %>
snippet lim
<%= link_to ${1:model}.${2:name}, ${3:$1}_path(${4:$1}) %>
snippet linp
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${5:@$3}) %>
snippet linpp
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}) %>
snippet lip
<%= link_to "${1:Link text...}", ${2:model}_path(${3:@$2}) %>
snippet lipp
<%= link_to "${1:Link text...}", ${2:model}s_path %>
snippet lt
<%= link_to "${1:name}", ${2:dest} %>
snippet ofcfs
<%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${4:selected_value} %>
snippet rf
<%= render :file => "${1:file}"${2} %>
snippet rt
<%= render :template => "${1:file}"${2} %>
snippet slt
<%= stylesheet_link_tag ${1::all}, :cache => ${2:true} %>
snippet sslt
<%= stylesheet_link_tag "${1}" %>

View File

@ -0,0 +1,71 @@
snippet #!
#!/usr/bin/env falcon
# Import
snippet imp
import ${1:module}
# Function
snippet fun
function ${2:function_name}(${3})
${4:/* code */}
end
# Class
snippet class
class ${1:class_name}(${2:class_params})
${3:/* members/methods */}
end
# If
snippet if
if ${1:condition}
${2:/* code */}
end
# If else
snippet ife
if ${1:condition}
${2:/* code */}
else
${1}
end
# If else if
snippet elif
elif ${1:condition}
${2:/* code */}
# Switch case
snippet switch
switch ${1:expression}
case ${2:item}
case ${3:item}
default
end
# Select
snippet select
select ${1:variable}
case ${2:TypeSpec}
case ${3:TypeSpec}
default
end
# For/in Loop
snippet forin
for ${1:element} in ${2:container}
${3:/* code */}
end
# For/to Loop
snippet forto
for ${1:lowerbound} to ${2:upperbound}
${3:/* code */}
end
# While Loop
snippet while
while ${1:conidition}
${2:/* code */}
end

View File

@ -0,0 +1,213 @@
# append
snippet ap
append(${1:slice}, ${2:value})
# bool
snippet bl
bool
# byte
snippet bt
byte
# break
snippet br
break
# channel
snippet ch
chan ${1:int}
# case
snippet cs
case ${1:value}:
${2:/* code */}
# const
snippet c
const ${1:NAME} = ${2:0}
# constants with iota
snippet co
const (
${1:NAME1} = iota
${2:NAME2}
)
# continue
snippet cn
continue
# defer
snippet df
defer ${1:func}()
# defer recover
snippet dfr
defer func() {
if err := recover(); err != nil {
${1:/* code */}
}
}()
# gpl
snippet gpl
/*
* 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/>.
*
* Copyright (C) ${1:Author}, `strftime("%Y")`
*/
${2}
# int
snippet i
int
# import
snippet im
import (
"${1:package}"
)${2}
# interface
snippet in
interface{}
# full interface snippet
snippet inf
interface ${1:name} {
${2:/* methods */}
}${3}
# if condition
snippet if
if ${1:/* condition */} {
${2:/* code */}
}${2}
# else snippet
snippet el
else {
${1}
}${2}
# error snippet
snippet ir
if err != nil {
return err
}
${1}
# false
snippet f
false
# fallthrough
snippet ft
fallthrough
# float
snippet fl
float32
# float32
snippet f3
float32
# float64
snippet f6
float64
# if else
snippet ie
if ${1:/* condition */} {
${2:/* code */}
} else {
${3}
}
${4}
# for loop
snippet fo
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
${4:/* code */}
}
${5}
# for range loop
snippet fr
for ${1:k}, ${2:v} := range ${3} {
${4:/* code */}
}
${5}
# function simple
snippet fun
func ${1:funcName}(${2}) ${3:error} {
${4:/* code */}
}
${5}
# function on receiver
snippet fum
func (self ${1:type}) ${2:funcName}(${3}) ${4:error} {
${5:/* code */}
}
${6}
# log printf
snippet lf
log.Printf("%${1:s}", ${2:var})${3}
# log printf
snippet lp
log.Println("${1}")${2}
# make
snippet mk
make(${1:[]string}, ${2:0})
# map
snippet mp
map[${1:string}]${2:int}
# main()
snippet main
func main() {
${1:/* code */}
}
${2}
# new
snippet nw
new(${1:type})
# panic
snippet pn
panic("${1:msg}")
# print
snippet pr
fmt.Printf("%${1:s}\n", ${2:var})${3}
# range
snippet rn
range ${1}
# return
snippet rt
return ${1}
# result
snippet rs
result
# select
snippet sl
select {
case ${1:v1} := <-${2:chan1}
${3:/* code */}
case ${4:v2} := <-${5:chan2}
${6:/* code */}
default:
${7:/* code */}
}
# string
snippet sr
string
# struct
snippet st
struct ${1:name} {
${2:/* data */}
}
${3}
# switch
snippet sw
switch ${1:var} {
case ${2:value1}:
${3:/* code */}
case ${4:value2}:
${5:/* code */}
default:
${6:/* code */}
}
snippet sp
fmt.Sprintf("%${1:s}", ${2:var})${3}
# true
snippet t
true
# variable declaration
snippet v
var ${1:t} ${2:string}

View File

@ -0,0 +1,20 @@
snippet t
%table
%tr
%th
${1:headers}
%tr
%td
${2:headers}
snippet ul
%ul
%li
${1:item}
%li
snippet =rp
= render :partial => '${1:partial}'
snippet =rpl
= render :partial => '${1:partial}', :locals => {}
snippet =rpc
= render :partial => '${1:partial}', :collection => @$1

View File

@ -0,0 +1,82 @@
snippet lang
{-# LANGUAGE ${1:OverloadedStrings} #-}
snippet info
-- |
-- Module : ${1:Module.Namespace}
-- Copyright : ${2:Author} ${3:2011-2012}
-- License : ${4:BSD3}
--
-- Maintainer : ${5:email@something.com}
-- Stability : ${6:experimental}
-- Portability : ${7:unknown}
--
-- ${8:Description}
--
snippet import
import ${1:Data.Text}
snippet import2
import ${1:Data.Text} (${2:head})
snippet importq
import qualified ${1:Data.Text} as ${2:T}
snippet inst
instance ${1:Monoid} ${2:Type} where
${3}
snippet type
type ${1:Type} = ${2:Type}
snippet data
data ${1:Type} = ${2:$1} ${3:Int}
snippet newtype
newtype ${1:Type} = ${2:$1} ${3:Int}
snippet class
class ${1:Class} a where
${2}
snippet module
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` (
) where
`expand('%') =~ 'Main' ? "\n\nmain = do\n print \"hello world\"" : ""`
snippet const
${1:name} :: ${2:a}
$1 = ${3:undefined}
snippet fn
${1:fn} :: ${2:a} -> ${3:a}
$1 ${4} = ${5:undefined}
snippet fn2
${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}
$1 ${5} = ${6:undefined}
snippet ap
${1:map} ${2:fn} ${3:list}
snippet do
do
snippet λ
\${1:x} -> ${2}
snippet \
\${1:x} -> ${2}
snippet <-
${1:a} <- ${2:m a}
snippet ←
${1:a} <- ${2:m a}
snippet ->
${1:m a} -> ${2:a}
snippet →
${1:m a} -> ${2:a}
snippet tup
(${1:a}, ${2:b})
snippet tup2
(${1:a}, ${2:b}, ${3:c})
snippet tup3
(${1:a}, ${2:b}, ${3:c}, ${4:d})
snippet rec
${1:Record} { ${2:recFieldA} = ${3:undefined}
, ${4:recFieldB} = ${5:undefined}
}
snippet case
case ${1:something} of
${2} -> ${3}
snippet let
let ${1} = ${2}
in ${3}
snippet where
where
${1:fn} = ${2:undefined}

View File

@ -0,0 +1,828 @@
# Some useful Unicode entities
# Non-Breaking Space
snippet nbs
&nbsp;
# ←
snippet left
&#x2190;
# →
snippet right
&#x2192;
# ↑
snippet up
&#x2191;
# ↓
snippet down
&#x2193;
# ↩
snippet return
&#x21A9;
# ⇤
snippet backtab
&#x21E4;
# ⇥
snippet tab
&#x21E5;
# ⇧
snippet shift
&#x21E7;
# ⌃
snippet ctrl
&#x2303;
# ⌅
snippet enter
&#x2305;
# ⌘
snippet cmd
&#x2318;
# ⌥
snippet option
&#x2325;
# ⌦
snippet delete
&#x2326;
# ⌫
snippet backspace
&#x232B;
# ⎋
snippet esc
&#x238B;
# Generic Doctype
snippet doctype HTML 4.01 Strict
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
snippet doctype HTML 4.01 Transitional
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
snippet doctype HTML 5
<!DOCTYPE HTML>
snippet doctype XHTML 1.0 Frameset
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet doctype XHTML 1.0 Strict
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
snippet doctype XHTML 1.0 Transitional
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
snippet doctype XHTML 1.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
# 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}="${2:property}"
snippet attr+
${1:attribute}="${2:property}" attr+${3}
snippet .
class="${1}"${2}
snippet #
id="${1}"${2}
snippet alt
alt="${1}"${2}
snippet charset
charset="${1:utf-8}"${2}
snippet data
data-${1}="${2:$1}"${3}
snippet for
for="${1}"${2}
snippet height
height="${1}"${2}
snippet href
href="${1:#}"${2}
snippet lang
lang="${1:en}"${2}
snippet media
media="${1}"${2}
snippet name
name="${1}"${2}
snippet rel
rel="${1}"${2}
snippet scope
scope="${1:row}"${2}
snippet src
src="${1}"${2}
snippet title=
title="${1}"${2}
snippet type
type="${1}"${2}
snippet value
value="${1}"${2}
snippet width
width="${1}"${2}
# Elements
snippet a
<a href="${1:#}">${2:$1}</a>
snippet a.
<a class="${1}" href="${2:#}">${3:$1}</a>
snippet a#
<a id="${1}" href="${2:#}">${3:$1}</a>
snippet a:ext
<a href="http://${1:example.com}">${2:$1}</a>
snippet a:mail
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
snippet abbr
<abbr title="${1}">${2}</abbr>
snippet address
<address>
${1}
</address>
snippet area
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
snippet area+
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}" />
area+${5}
snippet area:c
<area shape="circle" coords="${1}" href="${2}" alt="${3}" />
snippet area:d
<area shape="default" coords="${1}" href="${2}" alt="${3}" />
snippet area:p
<area shape="poly" coords="${1}" href="${2}" alt="${3}" />
snippet area:r
<area shape="rect" coords="${1}" href="${2}" alt="${3}" />
snippet article
<article>
${1}
</article>
snippet article.
<article class="${1}">
${2}
</article>
snippet article#
<article id="${1}">
${2}
</article>
snippet aside
<aside>
${1}
</aside>
snippet aside.
<aside class="${1}">
${2}
</aside>
snippet aside#
<aside id="${1}">
${2}
</aside>
snippet audio
<audio src="${1}>${2}</audio>
snippet b
<b>${1}</b>
snippet base
<base href="${1}" target="${2}" />
snippet bdi
<bdi>${1}</bdo>
snippet bdo
<bdo dir="${1}">${2}</bdo>
snippet bdo:l
<bdo dir="ltr">${1}</bdo>
snippet bdo:r
<bdo dir="rtl">${1}</bdo>
snippet blockquote
<blockquote>
${1}
</blockquote>
snippet body
<body>
${1}
</body>
snippet br
<br />${1}
snippet button
<button type="${1:submit}">${2}</button>
snippet button.
<button class="${1:button}" type="${2:submit}">${3}</button>
snippet button#
<button id="${1}" type="${2:submit}">${3}</button>
snippet button:s
<button type="submit">${1}</button>
snippet button:r
<button type="reset">${1}</button>
snippet canvas
<canvas>
${1}
</canvas>
snippet caption
<caption>${1}</caption>
snippet cite
<cite>${1}</cite>
snippet code
<code>${1}</code>
snippet col
<col />${1}
snippet col+
<col />
col+${1}
snippet colgroup
<colgroup>
${1}
</colgroup>
snippet colgroup+
<colgroup>
<col />
col+${1}
</colgroup>
snippet command
<command type="command" label="${1}" icon="${2}" />
snippet command:c
<command type="checkbox" label="${1}" icon="${2}" />
snippet command:r
<command type="radio" radiogroup="${1}" label="${2}" icon="${3}" />
snippet datagrid
<datagrid>
${1}
</datagrid>
snippet datalist
<datalist>
${1}
</datalist>
snippet datatemplate
<datatemplate>
${1}
</datatemplate>
snippet dd
<dd>${1}</dd>
snippet dd.
<dd class="${1}">${2}</dd>
snippet dd#
<dd id="${1}">${2}</dd>
snippet del
<del>${1}</del>
snippet details
<details>${1}</details>
snippet dfn
<dfn>${1}</dfn>
snippet dialog
<dialog>
${1}
</dialog>
snippet div
<div>
${1}
</div>
snippet div.
<div class="${1}">
${2}
</div>
snippet div#
<div id="${1}">
${2}
</div>
snippet dl
<dl>
${1}
</dl>
snippet dl.
<dl class="${1}">
${2}
</dl>
snippet dl#
<dl id="${1}">
${2}
</dl>
snippet dl+
<dl>
<dt>${1}</dt>
<dd>${2}</dd>
dt+${3}
</dl>
snippet dt
<dt>${1}</dt>
snippet dt.
<dt class="${1}">${2}</dt>
snippet dt#
<dt id="${1}">${2}</dt>
snippet dt+
<dt>${1}</dt>
<dd>${2}</dd>
dt+${3}
snippet em
<em>${1}</em>
snippet embed
<embed src=${1} type="${2} />
snippet fieldset
<fieldset>
${1}
</fieldset>
snippet fieldset.
<fieldset class="${1}">
${2}
</fieldset>
snippet fieldset#
<fieldset id="${1}">
${2}
</fieldset>
snippet fieldset+
<fieldset>
<legend><span>${1}</span></legend>
${2}
</fieldset>
fieldset+${3}
snippet figcaption
<figcaption>${1}</figcaption>
snippet figure
<figure>${1}</figure>
snippet footer
<footer>
${1}
</footer>
snippet footer.
<footer class="${1}">
${2}
</footer>
snippet footer#
<footer id="${1}">
${2}
</footer>
snippet form
<form action="${1}" method="${2:get}" accept-charset="utf-8">
${3}
</form>
snippet form.
<form class="${1}" action="${2}" method="${3:get}" accept-charset="utf-8">
${4}
</form>
snippet form#
<form id="${1}" action="${2}" method="${3:get}" accept-charset="utf-8">
${4}
</form>
snippet h1
<h1>${1}</h1>
snippet h1.
<h1 class="${1}">${2}</h1>
snippet h1#
<h1 id="${1}">${2}</h1>
snippet h2
<h2>${1}</h2>
snippet h2.
<h2 class="${1}">${2}</h2>
snippet h2#
<h2 id="${1}">${2}</h2>
snippet h3
<h3>${1}</h3>
snippet h3.
<h3 class="${1}">${2}</h3>
snippet h3#
<h3 id="${1}">${2}</h3>
snippet h4
<h4>${1}</h4>
snippet h4.
<h4 class="${1}">${2}</h4>
snippet h4#
<h4 id="${1}">${2}</h4>
snippet h5
<h5>${1}</h5>
snippet h5.
<h5 class="${1}">${2}</h5>
snippet h5#
<h5 id="${1}">${2}</h5>
snippet h6
<h6>${1}</h6>
snippet h6.
<h6 class="${1}">${2}</h6>
snippet h6#
<h6 id="${1}">${2}</h6>
snippet head
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2}
</head>
snippet header
<header>
${1}
</header>
snippet header.
<header class="${1}">
${2}
</header>
snippet header#
<header id="${1}">
${2}
</header>
snippet hgroup
<hgroup>
${1}
</hgroup>
snippet hgroup.
<hgroup class="${1}>
${2}
</hgroup>
snippet hr
<hr />${1}
snippet html
<html>
${1}
</html>
snippet xhtml
<html xmlns="http://www.w3.org/1999/xhtml">
${1}
</html>
snippet html5
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${2:meta}
</head>
<body>
${3:body}
</body>
</html>
snippet i
<i>${1}</i>
snippet iframe
<iframe src="${1}" frameborder="0"></iframe>${2}
snippet iframe.
<iframe class="${1}" src="${2}" frameborder="0"></iframe>${3}
snippet iframe#
<iframe id="${1}" src="${2}" frameborder="0"></iframe>${3}
snippet img
<img src="${1}" alt="${2}" />${3}
snippet img.
<img class="${1}" src="${2}" alt="${3}" />${4}
snippet img#
<img id="${1}" src="${2}" alt="${3}" />${4}
snippet input
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}" />${5}
snippet input.
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}" />${6}
snippet input:text
<input type="text" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:submit
<input type="submit" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:hidden
<input type="hidden" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:button
<input type="button" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:image
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}" />${5}
snippet input:checkbox
<input type="checkbox" name="${1}" id="${2:$1}" />${3}
snippet input:radio
<input type="radio" name="${1}" id="${2:$1}" />${3}
snippet input:color
<input type="color" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:date
<input type="date" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:datetime
<input type="datetime" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:datetime-local
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:email
<input type="email" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:file
<input type="file" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:month
<input type="month" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:number
<input type="number" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:password
<input type="password" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:range
<input type="range" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:reset
<input type="reset" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:search
<input type="search" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:time
<input type="time" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:url
<input type="url" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet input:week
<input type="week" name="${1}" id="${2:$1}" value="${3}" />${4}
snippet ins
<ins>${1}</ins>
snippet kbd
<kbd>${1}</kbd>
snippet keygen
<keygen>${1}</keygen>
snippet label
<label for="${2:$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}" />${7}
snippet label:s
<label for="${2:$1}">${1}</label>
<select name="${3:$2}" id="${4:$2}">
<option value="${5}">${6:$5}</option>
</select>
snippet legend
<legend>${1}</legend>
snippet legend+
<legend><span>${1}</span></legend>
snippet li
<li>${1}</li>
snippet li.
<li class="${1}">${2}</li>
snippet li+
<li>${1}</li>
li+${2}
snippet lia
<li><a href="${2:#}">${1}</a></li>
snippet lia+
<li><a href="${2:#}">${1}</a></li>
lia+${3}
snippet link
<link rel="${1}" href="${2}" title="${3}" type="${4}" />${5}
snippet link:atom
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml" />${2}
snippet link:css
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}" />${3}
snippet link:favicon
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon" />${2}
snippet link:rss
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml" />${2}
snippet link:touch
<link rel="apple-touch-icon" href="${1:favicon.png}" />${2}
snippet map
<map name="${1}">
${2}
</map>
snippet map.
<map class="${1}" name="${2}">
${3}
</map>
snippet map#
<map name="${1}" id="${2:$1}>
${3}
</map>
snippet map+
<map name="${1}">
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
</map>${7}
snippet mark
<mark>${1}</mark>
snippet menu
<menu>
${1}
</menu>
snippet menu:c
<menu type="context">
${1}
</menu>
snippet menu:t
<menu type="toolbar">
${1}
</menu>
snippet meta
<meta http-equiv="${1}" content="${2}" />${3}
snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}" />${3}
snippet meta:refresh
<meta http-equiv="refresh" content="text/html;charset=UTF-8" />${3}
snippet meta:utf
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />${3}
snippet meter
<meter>${1}</meter>
snippet nav
<nav>
${1}
</nav>
snippet nav.
<nav class="${1}">
${2}
</nav>
snippet nav#
<nav id="${1}">
${2}
</nav>
snippet noscript
<noscript>
${1}
</noscript>
snippet object
<object data="${1}" type="${2}">
${3}
</object>${4}
# 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>${6}
snippet ol
<ol>
${1}
</ol>
snippet ol.
<ol class="${1}>
${2}
</ol>
snippet ol#
<ol id="${1}>
${2}
</ol>
snippet ol+
<ol>
<li>${1}</li>
li+${2}
</ol>
snippet opt
<option value="${1}">${2:$1}</option>
snippet opt+
<option value="${1}">${2:$1}</option>
opt+${3}
snippet optt
<option>${1}</option>
snippet optgroup
<optgroup>
<option value="${1}">${2:$1}</option>
opt+${3}
</optgroup>
snippet output
<output>${1}</output>
snippet p
<p>${1}</p>
snippet param
<param name="${1}" value="${2}" />${3}
snippet pre
<pre>
${1}
</pre>
snippet progress
<progress>${1}</progress>
snippet q
<q>${1}</q>
snippet rp
<rp>${1}</rp>
snippet rt
<rt>${1}</rt>
snippet ruby
<ruby>
<rp><rt>${1}</rt></rp>
</ruby>
snippet s
<s>${1}</s>
snippet samp
<samp>
${1}
</samp>
snippet script
<script type="text/javascript" charset="utf-8">
${1}
</script>
snippet scriptsrc
<script src="${1}.js" type="text/javascript" charset="utf-8"></script>
snippet section
<section>
${1}
</section>
snippet section.
<section class="${1}">
${2}
</section>
snippet section#
<section id="${1}">
${2}
</section>
snippet select
<select name="${1}" id="${2:$1}">
${3}
</select>
snippet select.
<select name="${1}" id="${2:$1}" class="${3}>
${4}
</select>
snippet select+
<select name="${1}" id="${2:$1}">
<option value="${3}">${4:$3}</option>
opt+${5}
</select>
snippet small
<small>${1}</small>
snippet source
<source src="${1}" type="${2}" media="${3}" />
snippet span
<span>${1}</span>
snippet strong
<strong>${1}</strong>
snippet style
<style type="text/css" media="${1:all}">
${2}
</style>
snippet sub
<sub>${1}</sub>
snippet summary
<summary>
${1}
</summary>
snippet sup
<sup>${1}</sup>
snippet table
<table border="${1:0}">
${2}
</table>
snippet table.
<table class="${1}" border="${2:0}">
${3}
</table>
snippet table#
<table id="${1}" border="${2:0}">
${3}
</table>
snippet tbody
<tbody>
${1}
</tbody>
snippet td
<td>${1}</td>
snippet td.
<td class="${1}">${2}</td>
snippet td#
<td id="${1}">${2}</td>
snippet td+
<td>${1}</td>
td+${2}
snippet textarea
<textarea name="${1}" id=${2:$1} rows="${3:8}" cols="${4:40}">${5}</textarea>${6}
snippet tfoot
<tfoot>
${1}
</tfoot>
snippet th
<th>${1}</th>
snippet th.
<th class="${1}">${2}</th>
snippet th#
<th id="${1}">${2}</th>
snippet th+
<th>${1}</th>
th+${2}
snippet thead
<thead>
${1}
</thead>
snippet time
<time datetime="${1}" pubdate="${2:$1}">${3:$1}</time>
snippet title
<title>${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
snippet tr
<tr>
${1}
</tr>
snippet tr+
<tr>
<td>${1}</td>
td+${2}
</tr>
snippet track
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}</track>${6}
snippet ul
<ul>
${1}
</ul>
snippet ul.
<ul class="${1}">
${2}
</ul>
snippet ul#
<ul id="${1}">
${2}
</ul>
snippet ul+
<ul>
<li>${1}</li>
li+${2}
</ul>
snippet var
<var>${1}</var>
snippet video
<video src="${1} height="${2}" width="${3}" preload="${5:none}" autoplay="${6:autoplay}>${7}</video>${8}
snippet wbr
<wbr />${1}

View File

@ -0,0 +1,141 @@
# Generic tags
snippet %
{% ${1} %}${2}
snippet %%
{% ${1:tag_name} %}
${2}
{% end$1 %}
snippet {
{{ ${1} }}${2}
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${2}
{% endautoescape %}
snippet block
{% block ${1} %}
${2}
{% endblock %}
snippet #
{# ${1:comment} #}
snippet comment
{% comment %}
${1}
{% endcomment %}
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
snippet debug
{% debug %}
snippet extends
{% extends "${1:base.html}" %}
snippet filter
{% filter ${1} %}
${2}
{% endfilter %}
snippet firstof
{% firstof ${1} %}
snippet for
{% for ${1} in ${2} %}
${3}
{% endfor %}
snippet empty
{% empty %}
${1}
snippet if
{% if ${1} %}
${2}
{% endif %}
snippet else
{% else %}
${1}
snippet elif
{% elif ${1} %}
${2}
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
snippet ifequal
{% ifequal ${1} ${2} %}
${3}
{% endifequal %}
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${3}
{% endifnotequal %}
snippet include
{% include "${1}" %}
snippet load
{% load ${1} %}
snippet now
{% now "${1:jS F Y H:i}" %}
snippet regroup
{% regroup ${1} by ${2} as ${3} %}
snippet spaceless
{% spaceless %}${1}{% endspaceless %}
snippet ssi
{% ssi ${1} %}
snippet trans
{% trans "${1:string}" %}
snippet url
{% url ${1} as ${2} %}
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}
snippet with
{% with ${1} as ${2} %}
${3}
{% 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:"${1}"
snippet center
center:"${1}"
snippet cut
cut:"${1}"
snippet date
date:"${1}"
snippet default
default:"${1}"
snippet defaultifnone
default_if_none:"${1}"
snippet dictsort
dictsort:"${1}"
snippet dictsortrev
dictsortreversed:"${1}"
snippet divisibleby
divisibleby:"${1}"
snippet floatformat
floatformat:"${1}"
snippet getdigit
get_digit:"${1}"
snippet join
join:"${1}"
snippet lengthis
length_is:"${1}"
snippet pluralize
pluralize:"${1}"
snippet removetags
removetags:"${1}"
snippet slice
slice:"${1}"
snippet stringformat
stringformat:"${1}"
snippet time
time:"${1}"
snippet truncatewords
truncatewords:${1}
snippet truncatewordshtml
truncatewords_html:${1}
snippet urlizetrunc
urlizetrunc:${1}
snippet wordwrap
wordwrap:${1}

View File

@ -0,0 +1,55 @@
# Generic tags
snippet {
{{ ${1} }}
# Template tags
snippet extends
{% extends "${1:base.html}" %}
snippet autoescape
{% autoescape ${1:xhtml_escape | None} %}
snippet apply
{% apply ${1:function} %}
${2}
{% end %}
snippet block
{% block ${1} %}
${2}
{% end %}
snippet for
{% for ${1:item} in ${2} %}
${3}
{% end %}
snippet from
{% from ${1:x} import ${2:y} %}
snippet if
{% if ${1:condition} %}
${2}
{% end %}
snippet elif
{% elif ${1:condition} %}
snippet else
{% else %}
snippet import
{% import ${1:module} %}
snippet include
{% include "${1:filename}" %}
snippet module
{% module ${1:expression} %}
snippet raw
{% raw ${1:expression} %}
snippet set
{% set ${1:x} = ${2:y} %}
snippet try
{% try %}
${1}
{% except %}
${2}
{% finallly %}
${3}
{% end %}
snippet while
{% while ${1:condition} %}
${2}
{% end %}

View File

@ -0,0 +1,240 @@
## Access Modifiers
snippet po
protected
snippet pu
public
snippet pr
private
##
## Annotations
snippet before
@Before
static void ${1:intercept}(${2:args}) { ${3} }
snippet mm
@ManyToMany
${1}
snippet mo
@ManyToOne
${1}
snippet om
@OneToMany${1:(cascade=CascadeType.ALL)}
${2}
snippet oo
@OneToOne
${1}
##
## Basic Java packages and import
snippet im
import
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:`Filename("", "untitled")`} ${2}
snippet in
interface ${1:`Filename("", "untitled")`} ${2:extends Parent}${3}
snippet tc
public class ${1:`Filename()`} extends ${2:TestCase}
##
## Class Enhancements
snippet ext
extends
snippet imp
implements
##
## Comments
snippet /*
/*
* ${1}
*/
##
## Constants
snippet co
static public final ${1:String} ${2:var} = ${3};${4}
snippet cos
static public final String ${1:var} = "${2}";${3}
##
## Control Statements
snippet case
case ${1}:
${2}
snippet def
default:
${2}
snippet el
else
snippet elif
else if (${1}) ${2}
snippet if
if (${1}) ${2}
snippet sw
switch (${1}) {
${2}
}
##
## Create a Method
snippet m
${1:void} ${2:method}(${3}) ${4:throws }${5}
##
## Create a Variable
snippet v
${1:String} ${2:var}${3: = null}${4};${5}
##
## Enhancements to Methods, variables, classes, etc.
snippet ab
abstract
snippet fi
final
snippet st
static
snippet sy
synchronized
##
## Error Methods
snippet err
System.err.print("${1:Message}");
snippet errf
System.err.printf("${1:Message}", ${2:exception});
snippet errln
System.err.println("${1:Message}");
##
## Exception Handling
snippet as
assert ${1:test} : "${2:Failure message}";${3}
snippet ca
catch(${1:Exception} ${2:e}) ${3}
snippet thr
throw
snippet ths
throws
snippet try
try {
${3}
} catch(${1:Exception} ${2:e}) {
}
snippet tryf
try {
${3}
} catch(${1:Exception} ${2:e}) {
} finally {
}
##
## Find Methods
snippet findall
List<${1:listName}> ${2:items} = ${1}.findAll();${3}
snippet findbyid
${1:var} ${2:item} = ${1}.findById(${3});${4}
##
## Javadocs
snippet /**
/**
* ${1}
*/
snippet @au
@author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")`
snippet @br
@brief ${1:Description}
snippet @fi
@file ${1:`Filename()`}.java
snippet @pa
@param ${1:param}
snippet @re
@return ${1:param}
##
## Logger Methods
snippet debug
Logger.debug(${1:param});${2}
snippet error
Logger.error(${1:param});${2}
snippet info
Logger.info(${1:param});${2}
snippet warn
Logger.warn(${1:param});${2}
##
## Loops
snippet enfor
for (${1} : ${2}) ${3}
snippet for
for (${1}; ${2}; ${3}) ${4}
snippet wh
while (${1}) ${2}
##
## Main method
snippet main
public static void main (String[] args) {
${1:/* code */}
}
##
## Print Methods
snippet print
System.out.print("${1:Message}");
snippet printf
System.out.printf("${1:Message}", ${2:args});
snippet println
System.out.println(${1});
##
## Render Methods
snippet ren
render(${1:param});${2}
snippet rena
renderArgs.put("${1}", ${2});${3}
snippet renb
renderBinary(${1:param});${2}
snippet renj
renderJSON(${1:param});${2}
snippet renx
renderXml(${1:param});${2}
##
## Setter and Getter Methods
snippet set
${1:public} void set${3:}(${2:String} ${4:}){
this.$4 = $4;
}
snippet get
${1:public} ${2:String} get${3:}(){
return this.${4:};
}
##
## Terminate Methods or Loops
snippet re
return
snippet br
break;
##
## Test Methods
snippet t
public void test${1:Name}() throws Exception {
${2}
}
snippet test
@Test
public void test${1:Name}() throws Exception {
${2}
}
##
## Utils
snippet Sc
Scanner
##
## Miscellaneous
snippet action
public static void ${1:index}(${2:args}) { ${3} }
snippet rnf
notFound(${1:param});${2}
snippet rnfin
notFoundIfNull(${1:param});${2}
snippet rr
redirect(${1:param});${2}
snippet ru
unauthorized(${1:param});${2}
snippet unless
(unless=${1:param});${2}

View File

@ -0,0 +1,589 @@
snippet add
${1:obj}.add('${2:selector expression}')${3}
snippet addClass
${1:obj}.addClass('${2:class name}')${3}
snippet after
${1:obj}.after('${2:Some text <b>and bold!</b>}')${3}
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) {
${7:// error callback}
}
});
snippet ajaxcomplete
${1:obj}.ajaxComplete(function (${1:e}, xhr, settings) {
${2:// callback}
});
snippet ajaxerror
${1:obj}.ajaxError(function (${1:e}, xhr, settings, thrownError) {
${2:// error callback}
});
${3}
snippet ajaxget
$.get('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${3:// success callback}
}
);
snippet ajaxpost
$.post('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${3:// success callback}
}
);
snippet ajaxprefilter
$.ajaxPrefilter(function (${1:options}, ${2:originalOptions}, jqXHR) {
${3: // Modify options, control originalOptions, store jqXHR, etc}
});
snippet ajaxsend
${1:obj}.ajaxSend(function (${1:request, settings}) {
${2:// error callback}
});
${3}
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) {
${7:// error callback}
}
});
snippet ajaxstart
$.ajaxStart(function () {
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress};
});
${2}
snippet ajaxstop
$.ajaxStop(function () {
${1:// handler for when all AJAX calls have been completed};
});
${2}
snippet ajaxsuccess
$.ajaxSuccess(function (${1:e}, xhr, settings) {
${2:// handler for when any AJAX call is successfully completed};
});
${2}
snippet andself
${1:obj}.andSelf()${2}
snippet animate
${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})${4}
snippet append
${1:obj}.append('${2:Some text <b>and bold!</b>}')${3}
snippet appendTo
${1:obj}.appendTo('${2:selector expression}')${3}
snippet attr
${1:obj}.attr('${2:attribute}', '${3:value}')${4}
snippet attrm
${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})${6}
snippet before
${1:obj}.before('${2:Some text <b>and bold!</b>}')${3}
snippet bind
${1:obj}.bind('${2:event name}', function (${3:e}) {
${4:// event handler}
});
snippet blur
${1:obj}.blur(function (${2:e}) {
${3:// event handler}
});
snippet C
$.Callbacks()${1}
snippet Cadd
${1:callbacks}.add(${2:callbacks})${3}
snippet Cdis
${1:callbacks}.disable()${2}
snippet Cempty
${1:callbacks}.empty()${2}
snippet Cfire
${1:callbacks}.fire(${2:args})${3}
snippet Cfired
${1:callbacks}.fired()${2}
snippet Cfirew
${1:callbacks}.fireWith(${2:this}, ${3:args})${4}
snippet Chas
${1:callbacks}.has(${2:callback})${3}
snippet Clock
${1:callbacks}.lock()${2}
snippet Clocked
${1:callbacks}.locked()${2}
snippet Crem
${1:callbacks}.remove(${2:callbacks})${3}
snippet change
${1:obj}.change(function (${2:e}) {
${3:// event handler}
});
snippet children
${1:obj}.children('${2:selector expression}')${3}
snippet clearq
${1:obj}.clearQueue(${2:'queue name'})${3}
snippet click
${1:obj}.click(function (${2:e}) {
${3:// event handler}
});
snippet clone
${1:obj}.clone()${2}
snippet contains
$.contains(${1:container}, ${2:contents});
snippet css
${1:obj}.css('${2:attribute}', '${3:value}')${4}
snippet csshooks
$.cssHooks['${1:CSS prop}'] = {
get: function (elem, computed, extra) {
${2: // handle getting the CSS property}
},
set: function (elem, value) {
${3: // handle setting the CSS value}
}
};
snippet cssm
${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})${6}
snippet D
$.Deferred()${1}
snippet Dalways
${1:deferred}.always(${2:callbacks})${3}
snippet Ddone
${1:deferred}.done(${2:callbacks})${3}
snippet Dfail
${1:deferred}.fail(${2:callbacks})${3}
snippet Disrej
${1:deferred}.isRejected()${2}
snippet Disres
${1:deferred}.isResolved()${2}
snippet Dnotify
${1:deferred}.notify(${2:args})${3}
snippet Dnotifyw
${1:deferred}.notifyWith(${2:this}, ${3:args})${4}
snippet Dpipe
${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter})${5}
snippet Dprog
${1:deferred}.progress(${2:callbacks})${3}
snippet Dprom
${1:deferred}.promise(${2:target})${3}
snippet Drej
${1:deferred}.reject(${2:args})${3}
snippet Drejw
${1:deferred}.rejectWith(${2:this}, ${3:args})${4}
snippet Dres
${1:deferred}.resolve(${2:args})${3}
snippet Dresw
${1:deferred}.resolveWith(${2:this}, ${3:args})${4}
snippet Dstate
${1:deferred}.state()${2}
snippet Dthen
${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks})${5}
snippet Dwhen
$.when(${1:deferreds})${2}
snippet data
${1:obj}.data(${2:obj})${3}
snippet dataa
$.data('${1:selector expression}', '${2:key}'${3:, 'value'})${4}
snippet dblclick
${1:obj}.dblclick(function (${2:e}) {
${3:// event handler}
});
snippet delay
${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'})${4}
snippet dele
${1:obj}.delegate('${2:selector expression}', '${3:event name}', function (${4:e}) {
${5:// event handler}
});
snippet deq
${1:obj}.dequeue(${2:'queue name'})${3}
snippet deqq
$.dequeue('${1:selector expression}'${2:, 'queue name'})${3}
snippet detach
${1:obj}.detach('${2:selector expression}')${3}
snippet die
${1:obj}.die(${2:event}, ${3:handler})${4}
snippet each
${1:obj}.each(function (index) {
${2:this.innerHTML = this + " is the element, " + index + " is the position";}
});
snippet el
$('<${1}/>'${2:, {}})${3}
snippet eltrim
$.trim('${1:string}')${2}
snippet empty
${1:obj}.empty()${2}
snippet end
${1:obj}.end()${2}
snippet eq
${1:obj}.eq(${2:element index})${3}
snippet error
${1:obj}.error(function (${2:e}) {
${3:// event handler}
});
snippet eventsmap
{
:f${1}
}
snippet extend
$.extend(${1:true, }${2:target}, ${3:obj})${4}
snippet fadein
${1:obj}.fadeIn('${2:slow/400/fast}')${3}
snippet fadeinc
${1:obj}.fadeIn('slow/400/fast', function () {
${2:// callback};
});
snippet fadeout
${1:obj}.fadeOut('${2:slow/400/fast}')${3}
snippet fadeoutc
${1:obj}.fadeOut('slow/400/fast', function () {
${2:// callback};
});
snippet fadeto
${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})${4}
snippet fadetoc
${1:obj}.fadeTo('slow/400/fast', ${2:0.5}, function () {
${3:// callback};
});
snippet filter
${1:obj}.filter('${2:selector expression}')${3}
snippet filtert
${1:obj}.filter(function (${2:index}) {
${3:// test code}
})${4}
snippet find
${1:obj}.find('${2:selector expression}')${3}
snippet focus
${1:obj}.focus(function (${2:e}) {
${3:// event handler}
});
snippet focusin
${1:obj}.focusIn(function (${2:e}) {
${3:// event handler}
});
snippet focusout
${1:obj}.focusOut(function (${2:e}) {
${3:// event handler}
});
snippet get
${1:obj}.get(${2:element index})${3}
snippet getjson
$.getJSON('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${3:// success callback}
}
);
snippet getscript
$.getScript('${1:mydomain.com/url}', function (script, textStatus, jqXHR) {
${2:// callback}
});
snippet grep
$.grep(${1:array}, function (item, index) {
${2:// test code}
}${3:, true});
snippet hasc
${1:obj}.hasClass('${2:className}')${3}
snippet hasd
$.hasData('${1:selector expression}');
snippet height
${1:obj}.height(${2:integer})${3}
snippet hide
${1:obj}.hide('${2:slow/400/fast}')${3}
snippet hidec
${1:obj}.hide('${2:slow/400/fast}', function () {
${3:// callback}
});
snippet hover
${1:obj}.hover(function (${2:e}) {
${3:// event handler}
}, function ($2) {
${4:// event handler}
});${5}
snippet html
${1:obj}.html('${2:Some text <b>and bold!</b>}')${3}
snippet inarr
$.inArray(${1:value}, ${2:array});
snippet insa
${1:obj}.insertAfter('${2:selector expression}')${3}
snippet insb
${1:obj}.insertBefore('${2:selector expression}')${3}
snippet is
${1:obj}.is('${2:selector expression}')${3}
snippet isarr
$.isArray(${1:obj})${2}
snippet isempty
$.isEmptyObject(${1:obj})${2}
snippet isfunc
$.isFunction(${1:obj})${2}
snippet isnum
$.isNumeric(${1:value})${2}
snippet isobj
$.isPlainObject(${1:obj})${2}
snippet iswin
$.isWindow(${1:obj})${2}
snippet isxml
$.isXMLDoc(${1:node})${2}
snippet jj
$('${1:selector}')${2}
snippet kdown
${1:obj}.keydown(function (${2:e}) {
${3:// event handler}
});
snippet kpress
${1:obj}.keypress(function (${2:e}) {
${3:// event handler}
});
snippet kup
${1:obj}.keyup(function (${2:e}) {
${3:// event handler}
});
snippet last
${1:obj}.last('${1:selector expression}')${3}
snippet live
${1:obj}.live('${2:events}', function (${3:e}) {
${4:// event handler}
});
snippet load
${1:obj}.load(function (${2:e}) {
${3:// event handler}
});
snippet loadf
${1:obj}.load('${2:mydomain.com/url}',
${2:{ param1: value1 },}
function (responseText, textStatus, xhr) {
${3:// success callback}
}
});
snippet makearray
$.makeArray(${1:obj});
snippet map
${1:obj}.map(function (${2:index}, ${3:element}) {
${4:// callback}
});
snippet mapp
$.map(${1:arrayOrObject}, function (${2:value}, ${3:indexOrKey}) {
${4:// callback}
});
snippet merge
$.merge(${1:target}, ${2:original});
snippet mdown
${1:obj}.mousedown(function (${2:e}) {
${3:// event handler}
});
snippet menter
${1:obj}.mouseenter(function (${2:e}) {
${3:// event handler}
});
snippet mleave
${1:obj}.mouseleave(function (${2:e}) {
${3:// event handler}
});
snippet mmove
${1:obj}.mousemove(function (${2:e}) {
${3:// event handler}
});
snippet mout
${1:obj}.mouseout(function (${2:e}) {
${3:// event handler}
});
snippet mover
${1:obj}.mouseover(function (${2:e}) {
${3:// event handler}
});
snippet mup
${1:obj}.mouseup(function (${2:e}) {
${3:// event handler}
});
snippet next
${1:obj}.next('${2:selector expression}')${3}
snippet nexta
${1:obj}.nextAll('${2:selector expression}')${3}
snippet nextu
${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'})${4}
snippet not
${1:obj}.not('${2:selector expression}')${3}
snippet off
${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler})${5}
snippet offset
${1:obj}.offset()${2}
snippet offsetp
${1:obj}.offsetParent()${2}
snippet on
${1:obj}.on('${2:events}', '${3:selector expression}', function (${4:e}) {
${5:// event handler}
});
snippet one
${1:obj}.one('${2:event name}', function (${3:e}) {
${4:// event handler}
});
snippet outerh
${1:obj}.outerHeight()${2}
snippet outerw
${1:obj}.outerWidth()${2}
snippet param
$.param(${1:obj})${2}
snippet parent
${1:obj}.parent('${2:selector expression}')${3}
snippet parents
${1:obj}.parents('${2:selector expression}')${3}
snippet parentsu
${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'})${4}
snippet parsejson
$.parseJSON(${1:data})${2}
snippet parsexml
$.parseXML(${1:data})${2}
snippet pos
${1:obj}.position()${2}
snippet prepend
${1:obj}.prepend('${2:Some text <b>and bold!</b>}')${3}
snippet prependto
${1:obj}.prependTo('${2:selector expression}')${3}
snippet prev
${1:obj}.prev('${2:selector expression}')${3}
snippet preva
${1:obj}.prevAll('${2:selector expression}')${3}
snippet prevu
${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'})${4}
snippet promise
${1:obj}.promise(${2:'fx'}, ${3:target})${4}
snippet prop
${1:obj}.prop('${2:property name}')${3}
snippet proxy
$.proxy(${1:function}, ${2:this})${3}
snippet pushstack
${1:obj}.pushStack(${2:elements})${3}
snippet queue
${1:obj}.queue(${2:name}${3:, newQueue})${4}
snippet queuee
$.queue(${1:element}${2:, name}${3:, newQueue})${4}
snippet ready
$(function () {
${1}
});
snippet rem
${1:obj}.remove()${2}
snippet rema
${1:obj}.removeAttr('${2:attribute name}')${3}
snippet remc
${1:obj}.removeClass('${2:class name}')${3}
snippet remd
${1:obj}.removeData('${2:key name}')${3}
snippet remdd
$.removeData(${1:element}${2:, 'key name}')${3}
snippet remp
${1:obj}.removeProp('${2:property name}')${3}
snippet repa
${1:obj}.replaceAll(${2:target})${3}
snippet repw
${1:obj}.replaceWith(${2:content})${3}
snippet reset
${1:obj}.reset(function (${2:e}) {
${3:// event handler}
});
snippet resize
${1:obj}.resize(function (${2:e}) {
${3:// event handler}
});
snippet scroll
${1:obj}.scroll(function (${2:e}) {
${3:// event handler}
});
snippet scrolll
${1:obj}.scrollLeft(${2:value})${3}
snippet scrollt
${1:obj}.scrollTop(${2:value})${3}
snippet sdown
${1:obj}.slideDown('${2:slow/400/fast}')${3}
snippet sdownc
${1:obj}.slideDown('${2:slow/400/fast}', function () {
${3:// callback};
});
snippet select
${1:obj}.select(function (${2:e}) {
${3:// event handler}
});
snippet serialize
${1:obj}.serialize()${2}
snippet serializea
${1:obj}.serializeArray()${2}
snippet show
${1:obj}.show('${2:slow/400/fast}')${3}
snippet showc
${1:obj}.show('${2:slow/400/fast}', function () {
${3:// callback}
});
snippet sib
${1:obj}.siblings('${2:selector expression}')${3}
snippet size
${1:obj}.size()${2}
snippet slice
${1:obj}.slice(${2:start}${3:, end})${4}
snippet stoggle
${1:obj}.slideToggle('${2:slow/400/fast}')${3}
snippet stop
${1:obj}.stop('${2:queue}', ${3:false}, ${4:false})${5}
snippet submit
${1:obj}.submit(function (${2:e}) {
${3:// event handler}
});
snippet sup
${1:obj}.slideUp('${2:slow/400/fast}')${3}
snippet supc
${1:obj}.slideUp('${2:slow/400/fast}', function () {
${3:// callback};
});
snippet text
${1:obj}.text(${2:'some text'})${3}
snippet this
$(this)${1}
snippet toarr
${1:obj}.toArray()
snippet tog
${1:obj}.toggle(function (${2:e}) {
${3:// event handler}
}, function ($2) {
${4:// event handler}
});
${4}
snippet togclass
${1:obj}.toggleClass('${2:class name}')${3}
snippet togsh
${1:obj}.toggle('${2:slow/400/fast}')${3}
snippet trig
${1:obj}.trigger('${2:event name}')${3}
snippet trigh
${1:obj}.triggerHandler('${2:event name}')${3}
snippet $trim
$.trim(${1:str})${2}
snippet $type
$.type(${1:obj})${2}
snippet unbind
${1:obj}.unbind('${2:event name}')${3}
snippet undele
${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler})${5}
snippet uniq
$.unique(${1:array})${2}
snippet unload
${1:obj}.unload(function (${2:e}) {
${3:// event handler}
});
snippet unwrap
${1:obj}.unwrap()${2}
snippet val
${1:obj}.val('${2:text}')${3}
snippet width
${1:obj}.width(${2:integer})${3}
snippet wrap
${1:obj}.wrap('${2:&lt;div class="extra-wrapper"&gt;&lt;/div&gt;}')${3}

View File

@ -0,0 +1,163 @@
# Prototype
snippet proto
${1:class_name}.prototype.${2:method_name} =
function(${3:first_argument}) {
${4:// body...}
};
# Function
snippet fun
function ${1:function_name}(${2:argument}) {
${3:// body...}
}
# Anonymous Function
snippet f
function (${1}) {
${3}
}${2:;}
# Immediate function
snippet (f
(function (${1}) {
${3:/* code */}
}(${2}));
# if
snippet if
if (${1:true}) {
${2}
}
# if ... else
snippet ife
if (${1:true}) {
${2}
} else {
${3}
}
# tertiary conditional
snippet ter
${1:/* condition */} ? ${2:a} : ${3:b}
# switch
snippet switch
switch (${1:expression}) {
case '${3:case}':
${4:// code}
break;
${5}
default:
${2:// code}
}
# case
snippet case
case '${1:case}':
${2:// code}
break;
${3}
# for (...) {...}
snippet for
for (var ${2:i} = 0, l = ${1:arr}.length; $2 < l; $2 ++) {
var ${3:v} = $1[$2];${4:}
}
# for (...) {...} (Improved Native For-Loop)
snippet forr
for (var ${2:i} = ${1:arr}.length - 1; $2 >= 0; $2 --) {
var ${3:v} = $1[$2];${4:}
}
# while (...) {...}
snippet wh
while (${1:/* condition */}) {
${2:/* code */}
}
# try
snippet try
try {
${1:/* code */}
} catch (${2:e}) {
${3:/* handle error */}
}
# do...while
snippet do
do {
${2:/* code */}
} while (${1:/* condition */});
# Object Method
snippet :f
${1:method_name}: function (${2:attribute}) {
${4}
}${3:,}
# setTimeout function
snippet timeout
setTimeout(function () {${3}}${2}, ${1:10});
# Get Elements
snippet get
getElementsBy${1:TagName}('${2}')${3}
# Get Element
snippet gett
getElementBy${1:Id}('${2}')${3}
# console.log (Firebug)
snippet cl
console.log(${1});
# return
snippet ret
return ${1:result}
# for (property in object ) { ... }
snippet fori
for (var ${1:prop} in ${2:Things}) {
${3:$2[$1]}
}
# hasOwnProperty
snippet has
hasOwnProperty(${1})
# docstring
snippet /**
/**
* ${1:description}
*
*/
snippet @par
@param {${1:type}} ${2:name} ${3:description}
snippet @ret
@return {${1:type}} ${2:description}
# JSON.parse
snippet jsonp
JSON.parse(${1:jstr});
# JSON.stringify
snippet jsons
JSON.stringify(${1:object});
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {
${3:// initial code ...}
$1 = function ($2) {
${4:// main code}
};
};
# 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;
${3:// code ...}
return instance;
}
# Crockford's object function
snippet obj
function object(o) {
function F() {}
F.prototype = o;
return new F();
}

View File

@ -0,0 +1 @@
javascript-jquery.snippets

View File

@ -0,0 +1,99 @@
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="${2}" />
snippet cset
<c:set var="${1}" value="${2}" />
snippet cremove
<c:remove var="${1}" scope="${2:page}" />
snippet ccatch
<c:catch var="${1}" />
snippet cif
<c:if test="${${1}}">
${2}
</c:if>
snippet cchoose
<c:choose>
${1}
</c:choose>
snippet cwhen
<c:when test="${${1}}">
${2}
</c:when>
snippet cother
<c:otherwise>
${1}
</c:otherwise>
snippet cfore
<c:forEach items="${${1}}" var="${2}" varStatus="${3}">
${4:<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:,}">
${5:<c:out value="$3" />}
</c:forTokens>
snippet cparam
<c:param name="${1}" value="${2}" />
snippet cparam+
<c:param name="${1}" value="${2}" />
cparam+${3}
snippet cimport
<c:import url="${1}" />
snippet cimport+
<c:import url="${1}">
<c:param name="${2}" value="${3}" />
cparam+${4}
</c:import>
snippet curl
<c:url value="${1}" var="${2}" />
<a href="${$2}">${3}</a>
snippet curl+
<c:url value="${1}" var="${2}">
<c:param name="${4}" value="${5}" />
cparam+${6}
</c:url>
<a href="${$2}">${3}</a>
snippet credirect
<c:redirect url="${1}" />
snippet contains
${fn:contains(${1:string}, ${2:substr})}
snippet contains:i
${fn:containsIgnoreCase(${1:string}, ${2:substr})}
snippet endswith
${fn:endsWith(${1:string}, ${2:suffix})}
snippet escape
${fn:escapeXml(${1:string})}
snippet indexof
${fn:indexOf(${1:string}, ${2:substr})}
snippet join
${fn:join(${1:collection}, ${2:delims})}
snippet length
${fn:length(${1:collection_or_string})}
snippet replace
${fn:replace(${1:string}, ${2:substr}, ${3:replace})}
snippet split
${fn:split(${1:string}, ${2:delims})}
snippet startswith
${fn:startsWith(${1:string}, ${2:prefix})}
snippet substr
${fn:substring(${1:string}, ${2:begin}, ${3:end})}
snippet substr:a
${fn:substringAfter(${1:string}, ${2:substr})}
snippet substr:b
${fn:substringBefore(${1:string}, ${2:substr})}
snippet lc
${fn:toLowerCase(${1:string})}
snippet uc
${fn:toUpperCase(${1:string})}
snippet trim
${fn:trim(${1:string})}

View File

@ -0,0 +1,5 @@
# Ledger <http://ledger-cli.org/>
snippet ent
`strftime("%Y/%m/%d")` ${1:transaction}
${2:account} ${3:value}
${4:account}

View File

@ -0,0 +1,21 @@
snippet #!
#!/usr/bin/env lua
$1
snippet local
local ${1:x} = ${2:1}
snippet fun
function ${1:fname}(${2:...})
${3:-- body}
end
snippet for
for ${1:i}=${2:1},${3:10} do
${4:print(i)}
end
snippet forp
for ${1:i},${2:v} in pairs(${3:table_name}) do
${4:-- body}
end
snippet fori
for ${1:i},${2:v} in ipairs(${3:table_name}) do
${4:-- body}
end

View File

@ -0,0 +1,4 @@
snippet ifeq
ifeq (${1:cond0},${2:cond1})
${3:code}
endif

View File

@ -0,0 +1,54 @@
snippet def
<%def name="${1:name}">
${2:}
</%def>
snippet call
<%call expr="${1:name}">
${2:}
</%call>
snippet doc
<%doc>
${1:}
</%doc>
snippet text
<%text>
${1:}
</%text>
snippet for
% for ${1:i} in ${2:iter}:
${3:}
% endfor
snippet if if
% if ${1:condition}:
${2:}
% endif
snippet if if/else
% if ${1:condition}:
${2:}
% else:
${3:}
% endif
snippet try
% try:
${1:}
% except${2:}:
${3:pass}
% endtry
snippet wh
% while ${1:}:
${2:}
% endwhile
snippet $
${ ${1:} }
snippet <%
<% ${1:} %>
snippet <!%
<!% ${1:} %>
snippet inherit
<%inherit file="${1:filename}" />
snippet include
<%include file="${1:filename}" />
snippet namespace
<%namespace file="${1:name}" />
snippet page
<%page args="${1:}" />

View File

@ -0,0 +1,87 @@
# Markdown
# Includes octopress (http://octopress.org/) snippets
snippet [
[${1:text}](http://${2:address} "${3:title}")
snippet [*
[${1:link}](${2:`@*`} "${3:title}")${4}
snippet [:
[${1:id}]: http://${2:url} "${3:title}"
snippet [:*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet ![
![${1:alttext}](${2:/images/image.jpg} "${3:title}")
snippet ![*
![${1:alt}](${2:`@*`} "${3:title}")${4}
snippet ![:
![${1:id}]: ${2:url} "${3:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet ===
`repeat('=', strlen(getline(line(".") - 1)))`
${1}
snippet ---
`repeat('-', strlen(getline(line(".") - 1)))`
${1}
snippet blockquote
{% blockquote %}
${1:quote}
{% endblockquote %}
snippet blockquote-author
{% blockquote ${1:author}, ${2:title} %}
${3:quote}
{% endblockquote %}
snippet blockquote-link
{% blockquote ${1:author} ${2:URL} ${3:link_text} %}
${4:quote}
{% endblockquote %}
snippet bt-codeblock-short
```
${1:code_snippet}
```
snippet bt-codeblock-full
``` ${1:language} ${2:title} ${3:URL} ${4:link_text}
${5:code_snippet}
```
snippet codeblock-short
{% codeblock %}
${1:code_snippet}
{% endcodeblock %}
snippet codeblock-full
{% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %}
${5:code_snippet}
{% endcodeblock %}
snippet gist-full
{% gist ${1:gist_id} ${2:filename} %}
snippet gist-short
{% gist ${1:gist_id} %}
snippet img
{% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${6:alt_text} %}
snippet youtube
{% youtube ${1:video_id} %}
# 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} "} ${3:text}
{% endpullquote %}

View File

@ -0,0 +1,247 @@
# #import <...>
snippet Imp
#import <${1:Cocoa/Cocoa.h}>${2}
# #import "..."
snippet imp
#import "${1:`Filename()`.h}"${2}
# @selector(...)
snippet sel
@selector(${1:method}:)${3}
# @"..." string
snippet s
@"${1}"${2}
# Object
snippet o
${1:NSObject} *${2:foo} = [${3:$1 alloc}]${4};${5}
# NSLog(...)
snippet log
NSLog(@"${1:%@}"${2});${3}
# Class
snippet objc
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
{
}
@end
@implementation $1
${3}
@end
# Class Interface
snippet int
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
{${3}
}
${4}
@end
snippet @interface
@interface ${1:`Filename('', 'someClass')`} : ${2:NSObject}
{${3}
}
${4}
@end
# Class Implementation
snippet impl
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
snippet @implementation
@implementation ${1:`Filename('', 'someClass')`}
${2}
@end
# Protocol
snippet pro
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
snippet @protocol
@protocol ${1:`Filename('$1Delegate', 'MyProtocol')`} ${2:<NSObject>}
${3}
@end
# init Definition
snippet init
- (id)init
{
if (self = [super init]) {
${1}
}
return self;
}
# dealloc Definition
snippet dealloc
- (void) dealloc
{
${1:deallocations}
[super dealloc];
}
snippet su
[super ${1:init}]${2}
snippet ibo
IBOutlet ${1:NSSomeClass} *${2:$1};${3}
# Category
snippet cat
@interface ${1:NSObject} (${2:MyCategory})
@end
@implementation $1 ($2)
${3}
@end
# Category Interface
snippet cath
@interface ${1:`Filename('$1', 'NSObject')`} (${2:MyCategory})
${3}
@end
# Method
snippet m
- (${1:id})${2:method}
{
${3}
}
# Method declaration
snippet md
- (${1:id})${2:method};${3}
# IBAction declaration
snippet ibad
- (IBAction)${1:method}:(${2:id})sender;${3}
# IBAction method
snippet iba
- (IBAction)${1:method}:(${2:id})sender
{
${3}
}
# awakeFromNib method
snippet wake
- (void)awakeFromNib
{
${1}
}
# Class Method
snippet M
+ (${1:id})${2:method}
{
${3:return nil;}
}
# Sub-method (Call super)
snippet sm
- (${1:id})${2:method}
{
[super $2];${3}
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;
}${4}
# for (object in array)
snippet forin
for (${1:Class} *${2:some$1} in ${3:array}) {
${4}
}
snippet fore
for (${1:object} in ${2:array}) {
${3: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];
${4}
}
snippet fora
unsigned int ${1:object}Count = [${2:array} count];
for (unsigned int index = 0; index < $1Count; index++) {
${3:id} $1 = [$2 $1AtIndex:index];
${4}
}
# Try / Catch Block
snippet @try
@try {
${1:statements}
}
@catch (NSException * e) {
${2:handler}
}
@finally {
${3:statements}
}
snippet @catch
@catch (${1:exception}) {
${2:handler}
}
snippet @finally
@finally {
${1:statements}
}
# IBOutlet
# @property (Objective-C 2.0)
snippet prop
@property (${1:retain}) ${2:NSSomeClass} ${3:*$2};${4}
# @synthesize (Objective-C 2.0)
snippet syn
@synthesize ${1:property};${2}
# [[ alloc] init]
snippet alloc
[[${1:foo} alloc] init${2}];${3}
snippet a
[[${1:foo} alloc] init${2}];${3}
# retain
snippet ret
[${1:foo} retain];${2}
# release
snippet rel
[${1:foo} release];
# autorelease
snippet arel
[${1:foo} autorelease];
# autorelease pool
snippet pool
NSAutoreleasePool *${1:pool} = [[NSAutoreleasePool alloc] init];
${2:/* code */}
[$1 drain];
# Throw an exception
snippet except
NSException *${1:badness};
$1 = [NSException exceptionWithName:@"${2:$1Name}"
reason:@"${3}"
userInfo:nil];
[$1 raise];
snippet prag
#pragma mark ${1:-}
snippet cl
@class ${1:Foo};${2}
snippet color
[[NSColor ${1:blackColor}] set];
# NSArray
snippet array
NSMutableArray *${1:array} = [NSMutable array];${2}
snippet nsa
NSArray ${1}
snippet nsma
NSMutableArray ${1}
snippet aa
NSArray * array;${1}
snippet ma
NSMutableArray * array;${1}
# NSDictionary
snippet dict
NSMutableDictionary *${1:dict} = [NSMutableDictionary dictionary];${2}
snippet nsd
NSDictionary ${1}
snippet nsmd
NSMutableDictionary ${1}
# NSString
snippet nss
NSString ${1}
snippet nsms
NSMutableString ${1}

View File

@ -0,0 +1,53 @@
# 0/*
snippet fv
type fixedValue;
value uniform ${1};
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 (${5:0 0 0});
}
# system/fvSolution
# solvers
snippet gamg
${1:p}
{
solver GAMG;
tolerance 1e-${2:6};
relTol ${3: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 ${3:0.0};
}
# PIMPLE
snippet pimple
PIMPLE
{
nOuterCorrectors ${1:outer};
nCorrectors ${2:inner};
nNonOrthogonalCorrectors ${3:nonOrtho};
pRefCell ${4:cell};
pRefValue ${5:value for $4};
}

View File

@ -0,0 +1,347 @@
# #!/usr/bin/perl
snippet #!
#!/usr/bin/env perl
# Hash Pointer
snippet .
=>
# Function
snippet sub
sub ${1:function_name} {
${2:#body ...}
}
# Conditional
snippet if
if (${1}) {
${2:# body...}
}
# Conditional if..else
snippet ife
if (${1}) {
${2:# body...}
}
else {
${3:# else...}
}
# Conditional if..elsif..else
snippet ifee
if (${1}) {
${2:# body...}
}
elsif (${3}) {
${4:# elsif...}
}
else {
${5:# else...}
}
# Conditional One-line
snippet xif
${1:expression} if ${2:condition};${3}
# Unless conditional
snippet unless
unless (${1}) {
${2:# body...}
}
# Unless conditional One-line
snippet xunless
${1:expression} unless ${2:condition};${3}
# Try/Except
snippet eval
local $@;
eval {
${1:# do something risky...}
};
if (my $e = $@) {
${2:# handle failure...}
}
# While Loop
snippet wh
while (${1}) {
${2:# body...}
}
# While Loop One-line
snippet xwh
${1:expression} while ${2:condition};${3}
# C-style For Loop
snippet cfor
for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4:# body...}
}
# For loop one-line
snippet xfor
${1:expression} for @${2:array};${3}
# Foreach Loop
snippet for
foreach my $${1:x} (@${2:array}) {
${3:# body...}
}
# Foreach Loop One-line
snippet fore
${1:expression} foreach @${2:array};${3}
# Package
snippet package
package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`};
${2}
1;
__END__
# Package syntax perl >= 5.14
snippet packagev514
package ${1:`substitute(Filename('', 'Page Title'), '^.', '\u&', '')`} ${2:0.99};
${3}
1;
__END__
#moose
snippet moose
use Moose;
use namespace::autoclean;
${1:#}BEGIN {extends '${2:ParentClass}'};
${3}
# parent
snippet parent
use parent qw(${1:Parent Class});
# Read File
snippet slurp
my $${1:var} = do { local $/; open my $file, '<', "${2:file}"; <$file> };
${3}
# strict warnings
snippet strwar
use strict;
use warnings;
# older versioning with perlcritic bypass
snippet vers
## no critic
our $VERSION = '${1:version}';
eval $VERSION;
## use critic
# new 'switch' like feature
snippet switch
use feature 'switch';
# Anonymous subroutine
snippet asub
sub {
${1:# body }
}
# Begin block
snippet begin
BEGIN {
${1:# begin body}
}
# call package function with some parameter
snippet pkgmv
__PACKAGE__->${1:package_method}(${2:var})
# call package function without a parameter
snippet pkgm
__PACKAGE__->${1:package_method}()
# call package "get_" function without a parameter
snippet pkget
__PACKAGE__->get_${1:package_method}()
# call package function with a parameter
snippet pkgetv
__PACKAGE__->get_${1:package_method}(${2:var})
# complex regex
snippet qrx
qr/
${1:regex}
/xms
#simpler regex
snippet qr/
qr/${1:regex}/x
#given
snippet given
given ($${1:var}) {
${2:# cases}
${3:# default}
}
# switch-like case
snippet when
when (${1:case}) {
${2:# body}
}
# hash slice
snippet hslice
@{ ${1:hash} }{ ${2:array} }
# map
snippet map
map { ${2: body } } ${1: @array } ;
# Pod stub
snippet ppod
=head1 NAME
${1:ClassName} - ${2:ShortDesc}
=head1 SYNOPSIS
use $1;
${3:# synopsis...}
=head1 DESCRIPTION
${4:# longer description...}
=head1 INTERFACE
=head1 DEPENDENCIES
=head1 SEE ALSO
# Heading for a subroutine stub
snippet psub
=head2 ${1:MethodName}
${2:Summary....}
# Heading for inline subroutine pod
snippet psubi
=head2 ${1:MethodName}
${2:Summary...}
=cut
# inline documented subroutine
snippet subpod
=head2 $1
Summary of $1
=cut
sub ${1:subroutine_name} {
${2:# body...}
}
# Subroutine signature
snippet parg
=over 2
=item
Arguments
=over 3
=item
C<${1:DataStructure}>
${2:Sample}
=back
=item
Return
=over 3
=item
C<${3:...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}
},
${5:# other attributes}
);
# override
snippet override
override ${1:attribute} => sub {
${2:# my $self = shift;};
${3:# 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} = '${1:regex}';
# runtestclass
snippet trunner
use ${1: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;
${4:# body}
}
# Test::Routine-style test
snippet trsub
test ${1:test_name} => { description => '${2:Description of test.}'} => sub {
my ($self) = @_;
${3:# test code}
};
#prep test method
snippet tprep
sub prep${1:number}_${2:test_case} :Test(startup) {
my $self = shift;
${4:# body}
}
# cause failures to print stack trace
snippet debug_trace
use Carp; # 'verbose';
# cloak "die"
# warn "warning"
$SIG{'__DIE__'} = sub {
require Carp; Carp::confess
};

View File

@ -0,0 +1,384 @@
snippet <?
<?php
${1}
snippet ec
echo ${1};
snippet <?e
<?php echo ${1} ?>
# this one is for php5.4
snippet <?=
<?=${1}?>
snippet ns
namespace ${1:Foo\Bar\Baz};
${2}
snippet use
use ${1:Foo\Bar\Baz};
${2}
snippet c
${1:abstract }class ${2:`Filename()`}
{
${3}
}
snippet i
interface ${1:`Filename()`}
{
${2}
}
snippet t.
$this->${1}
snippet f
function ${1:foo}(${2:array }${3:$bar})
{
${4}
}
# method
snippet m
${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})
{
${7}
}
# setter method
snippet sm
/**
* Sets the value of ${1:foo}
*
* @param ${2:$1} $$1 ${3:description}
*
* @return ${4:`Filename()`}
*/
${5:public} function set${6:$2}(${7:$2 }$$1)
{
$this->${8:$1} = $$1;
return $this;
}${9}
# getter method
snippet gm
/**
* Gets the value of ${1:foo}
*
* @return ${2:$1}
*/
${3:public} function get${4:$2}()
{
return $this->${5:$1};
}${6}
#setter
snippet $s
${1:$foo}->set${2:Bar}(${3});
#getter
snippet $g
${1:$foo}->get${2:Bar}();
# Tertiary conditional
snippet =?:
$${1:foo} = ${2:true} ? ${3:a} : ${4};
snippet ?:
${1:true} ? ${2:a} : ${3}
snippet C
$_COOKIE['${1:variable}']${2}
snippet E
$_ENV['${1:variable}']${2}
snippet F
$_FILES['${1:variable}']${2}
snippet G
$_GET['${1:variable}']${2}
snippet P
$_POST['${1:variable}']${2}
snippet R
$_REQUEST['${1:variable}']${2}
snippet S
$_SERVER['${1:variable}']${2}
snippet SS
$_SESSION['${1:variable}']${2}
# the following are old ones
snippet inc
include '${1:file}';${2}
snippet inc1
include_once '${1:file}';${2}
snippet req
require '${1:file}';${2}
snippet req1
require_once '${1:file}';${2}
# Start Docblock
snippet /*
/**
* ${1}
*/
# Class - post doc
snippet doc_cp
/**
* ${1:undocumented class}
*
* @package ${2:default}
* @subpackage ${3:default}
* @author ${4:`g:snips_author`}
*/${5}
# Class Variable - post doc
snippet doc_vp
/**
* ${1:undocumented class variable}
*
* @var ${2:string}
*/${3}
# Class Variable
snippet doc_v
/**
* ${3:undocumented class variable}
*
* @var ${4:string}
*/
${1:var} $${2};${5}
# Class
snippet doc_c
/**
* ${3:undocumented class}
*
* @package ${4:default}
* @subpackage ${5:default}
* @author ${6:`g:snips_author`}
*/
${1:}class ${2:}
{
${7}
} // END $1class $2
# Constant Definition - post doc
snippet doc_dp
/**
* ${1:undocumented constant}
*/${2}
# Constant Definition
snippet doc_d
/**
* ${3:undocumented constant}
*/
define(${1}, ${2});${4}
# Function - post doc
snippet doc_fp
/**
* ${1:undocumented function}
*
* @return ${2:void}
* @author ${3:`g:snips_author`}
*/${4}
# Function signature
snippet doc_s
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
*/
${1}function ${2}(${3});${7}
# Function
snippet doc_f
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
*/
${1}function ${2}(${3})
{${7}
}
# Header
snippet doc_h
/**
* ${1}
*
* @author ${2:`g:snips_author`}
* @version ${3:$Id$}
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${5:default}
*/
# Interface
snippet interface
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
*/
interface ${1:`Filename()`}
{
${5}
}
# class ...
snippet class
/**
* ${1}
*/
class ${2:`Filename()`}
{
${3}
/**
* ${4}
*/
${5:public} function ${6:__construct}(${7:argument})
{
${8:// code...}
}
}
snippet nc
namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`};
${2:abstract }class ${3:`Filename()`}
{
${4}
}
# define(...)
snippet def
define('${1}'${2});${3}
# defined(...)
snippet def?
${1}defined('${2}')${3}
snippet wh
while (${1:/* condition */}) {
${2:// code...}
}
# do ... while
snippet do
do {
${2:// code... }
} while (${1:/* condition */});
snippet if
if (${1:/* condition */}) {
${2:// code...}
}
snippet ifil
<?php if (${1:/* condition */}): ?>
${2:<!-- code... -->}
<?php endif; ?>
snippet ife
if (${1:/* condition */}) {
${2:// code...}
} else {
${3:// code...}
}
${4}
snippet ifeil
<?php if (${1:/* condition */}): ?>
${2:<!-- html... -->}
<?php else: ?>
${3:<!-- html... -->}
<?php endif; ?>
${4}
snippet else
else {
${1:// code...}
}
snippet elseif
elseif (${1:/* condition */}) {
${2:// code...}
}
snippet switch
switch ($${1:variable}) {
case '${2:value}':
${3:// code...}
break;
${5}
default:
${4:// code...}
break;
}
snippet case
case '${1:value}':
${2:// code...}
break;${3}
snippet for
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${4: // code...}
}
snippet foreach
foreach ($${1:variable} as $${2:value}) {
${3:// code...}
}
snippet foreachil
<?php foreach ($${1:variable} as $${2:value}): ?>
${3:<!-- html... -->}
<?php endforeach; ?>
snippet foreachk
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${4:// code...}
}
snippet foreachkil
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
${4:<!-- html... -->}
<?php endforeach; ?>
# $... = array (...)
snippet array
$${1:arrayName} = array('${2}' => ${3});${4}
snippet try
try {
${2}
} catch (${1:Exception} $e) {
}
# lambda with closure
snippet lambda
${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {
${4}
};
# pre_dump();
snippet pd
echo '<pre>'; var_dump(${1}); echo '</pre>';
# pre_dump(); die();
snippet pdd
echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});
snippet vd
var_dump(${1});
snippet vdd
var_dump(${1}); die(${2:});
snippet http_redirect
header ("HTTP/1.1 301 Moved Permanently");
header ("Location: ".URL);
exit();
# Getters & Setters
snippet gs
/**
* Gets the value of ${1:foo}
*
* @return ${2:$1}
*/
public function get${3:$2}()
{
return $this->${4:$1};
}
/**
* Sets the value of $1
*
* @param $2 $$1 ${5:description}
*
* @return ${6:`Filename()`}
*/
public function set$3(${7:$2 }$$1)
{
$this->$4 = $$1;
return $this;
}${8}
# anotation, get, and set, useful for doctrine
snippet ags
/**
* ${1:description}
*
* @${7}
*/
${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;

View File

@ -0,0 +1,109 @@
# create package spec
snippet ps
create or replace package ${1:name}
as
${2:-- spec}
end; -- end of package spec $1
# create package body
snippet pb
create or replace package body ${1:name}
as
${2:-- body}
end; -- end of package body $1;
# package procedure spec
snippet pps
procedure ${1:name}(${2:args});
# package procedure body
snippet ppb
procedure ${1:name}(${2:args})
as
begin
${3:-- body}
end $2;
# package function spec
snippet pfs
function ${1:name}(${2:args})
return ${3:type};
# package function body
snippet pfb
function ${1:name}(${2:args})
return ${3:type}
as
l_res $3;
begin
${4:-- body};
return l_res;
end $1;
# snow errors
snippet err
show errors;
# proc/func in parameter
snippet p
${1:name} ${2:in} ${3:type} ${4: := null}
# package type: record
snippet tr
type tr_${1:name} is record (${2:/* columns */});
# package type: nested table
snippet tt
type tt_${1:name} is table of tr_${2:name};
# package type: indexed table
snippet tti
type tt_${1:name} is table of tr_${2:name} index by binary_integer;
# proc/func comment
snippet doc
/*
* ${1: comment ...}
*/
# plsql block
snippet beg
begin
${1}
end;
# plsql block with declare part
snippet dec
declare
${1}
begin
${2}
end;
# return pipe row
snippet rpipe
for ${1:i} in 1 .. ${2:l_res}.count loop
pipe row( $2($1) );
end loop;
return;
# bulk collect
snippet bc
bulk collect into ${1}
# local variable
snippet l
l_${1} ${2:number};
# output
snippet log
dbms_output.put_line('${1}');
# for loop
snippet for
for ${1:i} in ${2:1}..${3:42} loop
${3}
end loop;
# for loop with select
snippet fors
for ${1:rec} in (${2: select}) loop
${3}
end loop;
# for loop with collection
snippet forc
for ${1:i} in ${2:l_var}.first .. $2.last loop
${3: -- dbms_output.put_line($2($1)); }
end loop;
# if
snippet if
if ${1} then
${2}
end if;
snippet ife
if ${1} then
${2}
else
${3}
end if;

View File

@ -0,0 +1,5 @@
snippet msg
msgid "${1}"
msgstr "${2}"
${3}

View File

@ -0,0 +1,784 @@
#BASICS
# doc
snippet doc
/**
* ${1:Description}
*
* @author ${2:name}
* @since ${3:`strftime("%d/%m/%y %H:%M:%S")`}
*/
${4}
# doc comment
snippet docc
/**
* ${1:@private}$0
*/
${2}
# 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 ${4:package};
# function
snippet fun
${1:void/private/protected/public}${2: static} ${3:name}(${4}) {
${5://if not void return null;}
}
${6}
snippet fn
${1:void }${2:name}(${3}) {
${4://if not void return null;}
}
${5}
# constant
snippet const
static final ${1:Object} ${2:VAR_NAM} = ${3};
# var
snippet var
${1:private/public }${2:static }${3:String} ${4:str}${5: =}${6:value};
# var objects
snippet obj
${1:private/public }${2:Object} ${3:o}${4: = new }$2(${5});
#loop for
snippet for
for (int ${2:i} = 0; $2 < ${1:Things}.length; $2${3:++}) {
${4:$1[$2]}
};
#loop while
snippet while
while (${1:/* condition */}) {
${2:/* code */}
}
#break
snippet break
break ${1:label};
#case
snippet case
case ${1:expression} :
${2}
break;
#default
snippet default
default :
${1}
break;
#switch
snippet switch
switch(${1:expression}) {
case '${3:case}':
${4:// code}
break;
${5}
default:
${2:// code}
}
#try
snippet try
try {
${3}
} catch(${1:Exception} ${2:e}) {
}
#try catch finally
snippet tryf
try {
${3}
} catch(${1:Exception} ${2:e}) {
} finally {
}
#throw
snippet throw
throw new ("${1:Exception()}");
#ternary
snippet ?
? ${1:trueExpression} : ${2:falseExpression}
${3}
snippet if
if (${1:true}) {${2}}
# if ... else
snippet ife
if (${1:true}) {${2}}
else{${3}}
#get
snippet get
public ${1:String} get${2}() {
return ${2:fieldName};
}
#set
snippet set
public void set${1}(${2:String} new${1}) {
${1:fieldName} = new${1};
}
#printIn
snippet println
println("${1:`fnamemodify(bufname("%"),":t:r")`}::${2:method}() "${3: +} ${4});
#println string
snippet pr
println("${1}");
#setup draw
snippet setup
void setup(){
${1}
}
void draw(){
${2}
}
#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(){
${5}
}
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();
${1}
pgl.endGL();
snippet gl gl swap interval
// specify the minimum swap interval for buffer swaps.
gl.setSwapInterval(${1:interval});
snippet gl gl call list
// execute a display list
gl.glCallList(${1: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 = ${3: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
${2:// A buffer ID of zero unbinds a buffer object}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, ${1:0});
snippet gl gl delete buffers
${3:// 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(${1: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}, ${2:0.0f});
snippet gl gl vertex 2f
gl.glVertex2f(${1:0.0f}, ${2:0.0f});
snippet gl gl vertex 3f
gl.glVertex3f(${1:0.0f}, ${2:0.0f}, ${3:0.0f});
snippet gl gl translate f
// multiply the current matrix by a translation matrix
gl.glTranslatef(${1:x}, ${2:y}, ${3:z});
snippet gl gl rotate f
// rotate, x-axis, y-axis, z-axiz
gl.glRotatef(${1:angle}, ${2:x}, ${3:y}, ${4:z});
snippet gl gl scale f
// multiply the current matrix by a general scaling matrix
gl.glScalef(${1:x}, ${2:y}, ${3:z});
snippet gl gl color 4f
gl.glColor4f(${1:red}, ${2:green}, ${3:blue}, ${4:alpha});
snippet gl gl clear color
gl.glClearColor(${1:red}, ${2:green}, ${3:blue}, ${4:alpha});
snippet gl gl color 3f
gl.glColor3f(${1:red}, ${2:green}, ${3:blue});
snippet gl gl push matrix
// spush and pop the current matrix stack
gl.glPushMatrix();
${1}
gl.glPopMatrix();
snippet gl gl gen lists
gl.glGenLists(${1:1})
snippet gl gl flush
// Empties buffers. Call this when all previous issues commands completed
gl.glFlush();
${1}
snippet gl gl get error
println(gl.glGetError());
snippet gl gl clear
gl.glClear(${1:GL.GL_COLOR_BUFFER_BIT}${2: | }${3:GL.GL_DEPTH_BUFFER_BIT});
#frame operations
snippet fr framerate
frameRate(${1:30});
${2}
snippet fr frameRate
frameRate
snippet fr frameCount
frameCount
snippet fr saveFrame
saveFrame("${1:filename-####}${2:.ext}");
#size
snippet size normal size
size(${1:200}, ${2:200}${3:, P3D});
snippet size opengl size
size(${1:200}, ${2:200}${3:, OPENGL});
#PRIMITIVES
#color
snippet color
color ${1:c}${2: = color(}${3:value1, }${4:value2, }${5:value3)};
#char
snippet char
char ${1:m}${2: = "}${3:char"};
#float
snippet float
float ${1:f}${2: = }${3:0.0f};
#int
snippet int
int ${1:f}${2: = }${3:0};
#boolean
snippet boolean
boolean ${1:b}${2: = }${3:true};
#byte
snippet byte
byte ${1:b}${2: = }${3:127};
#string
snippet string
String ${1:str}${2: = "}${3:CCCP"};
#array
snippet array
${1:int}[] ${2:numbers}${3: = new $1}[${4:length}];
#object
snippet object
${1:Object} ${2:o}${3: = new $1}(${4});
#curve
snippet curve curve
curve(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3}, ${7:x4}, ${8:y4});
snippet curve 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}, ${12:z4});
snippet curve curve Detail
curveDetail(${1:detail});
snippet curve curve point
curvePoint(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:t});
snippet curve curve tightness
curveTightness(${1:squishy});
#bezier
snippet bezier bezier
bezier(${1:x1}, ${2:y1}, ${3:cx1}, ${4:cy1}, ${5:cx2}, ${6:cy2}, ${7:x2}, ${8:y2});
snippet bezier 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}, ${12:z2});
snippet bezier bezier detail
bezierDetail(${1:detail});
snippet bezier bezier tangent
bezierTangent(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:t});
snippet bezier bezier point
bezierPoint(${1:a}, ${2:b}, ${3:c}, ${4:d}, ${5:t});
#vertex
snippet vertex vertex
vertex(${1:x}, ${2:y}${3:, }${4:u}${5:, }${6:v});
snippet vertex vertex 3D
vertex(${1:x}, ${2:y}, ${3:z}${4:, }${5:u}${6:, }${7:v});
snippet vertex vertex bezier
bezierVertex(${1:cx1}, ${2:cy1}, ${3:cx2}, ${4:cy2}, ${5:x}, ${6:y});
snippet vertex vertex bezier 3D
bezierVertex(${1:cx1}, ${2:cy1}, ${3:cz1}, ${4:cx2}, ${5:cy2}, ${6:cz2}, ${7:x}, ${8:y}, ${9:z});
snippet vertex vertex curve
curveVertex(${1:x}, ${2:y});
snippet vertex vertex curve 3D
curveVertex(${1:x}, ${2:y}, ${3:z});
#stroke
snippet stroke stroke
stroke(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet stroke stroke weight
strokeWeight(${1:1});
snippet stroke no stroke
noStroke();
#mouse
snippet mouse mouse x
mouseX
snippet mouse mouse y
mouseY
snippet mouse mouse drag
void mouseDragged(){
${1}
}
snippet mouse mouse move
void mouseMoved(){
${1}
}
snippet mouse mouse release
void mouseReleased(){
${1}
}
snippet mouse mouse pressed
void mousePressed(){
${1}
}
snippet mouse mouse pressed?
mousePressed
snippet mouse mouse button?
mouseButton
snippet mouse pmouse X
pmouseX
snippet mouse pmouse Y
pmouseY
#key
snippet key keycode?
keyCode
snippet key key
key
snippet key key released
void keyReleased(){
${1}
}
snippet key key typed
void keyTyped(){
${1}
}
snippet key key pressed
void keyPressed(){
${1}
}
snippet key key pressed?
keyPressed
#file
snippet file load string
loadStrings("${1:filename}");
snippet file save string
saveStrings(${1:filename}, ${2:strings});
snippet file load bytes
loadBytes("${1:filename}");
snippet file begin record
beginRecord(${1:renderer}, ${2:filename});
snippet file end record
endRecord();
snippet file save bytes
saveBytes(${1:filename}, ${2:bytes});
snippet file create writer
createWriter(${1:filename});
snippet file create reader
createReader(${1:filename});
#time
snippet time hour
hour()
snippet time milliseconds
millis()
snippet time year
year()
snippet time minutes
minutes()
snippet time month
month()
snippet time second
second()
#matrix
snippet matrix reset matrix
translate(${1:x}, ${2:y}, ${3:z});
snippet matrix print matrix
printMatrix();
snippet matrix push matrix
pushMatrix();
${1:};
popMatrix();
#text
snippet txt text data
text(${1:data}, ${2:x}, ${3:y}${4:, }${5:z});
snippet txt text string data
text(${1:stringdata}, ${2:x}, ${3:y}, ${4:width}, ${5:height}${6:, }${7:z});
snippet txt text size
textSize(${1:size});
snippet txt text leading
textLeading(${1:size});
snippet txt text width
textWidth(${1:data});
snippet txt text descent
textDescent();
snippet txt text ascent
textAscent();
snippet txt font
PFont ${1:font};
$1 = loadFont("${2:FFScala-32.vlw}");
#load font
snippet txt load font
${1:font} = loadFont("${2:FFScala-32.vlw}");
snippet txt text font
textFont(${1:font}${2:, }${3:size});
#math
snippet math tangent
tan(${1:rad});
snippet math atan
atan(${1:rad});
snippet math atan2
atan2(${1:rad});
snippet math sin
sin(${1:rad});
snippet math asin
asin(${1:rad});
snippet math cos
cos(${1:rad});
snippet math acos
acos(${1:rad});
snippet math degrees
degrees(${1:rad});
snippet math radians
radians(${1:deg});
snippet math random seed
randomSeed(${1:value});
snippet math random
random(${1:value1}${2:, }${3:value2});
snippet math half PI
HALF_PI
snippet math 2 PI
TWO_PI
snippet math PI
PI
snippet math pow
pow(${1:num}, ${2:exponent});
snippet math floor
floor(${1:value});
snippet math sqrt
sqrt(${1:value});
snippet math abs
abs(${1:value});
snippet math sq
sq(${1:value});
snippet math ceil
ceil(${1:value});
snippet math exp
exp(${1:value});
snippet math round
round(${1:value}};
snippet math min
min(${1:value1}, ${2:value2}${3:, }${4:value3});
snippet math max
max(${1:value1}, ${2:value2}${3:, }${4:value3});
snippet math array max
max(${1:array});
snippet math array min
min(${1:array});
snippet math logarithm
log(${1:value});
snippet math map
map(${1:value}, ${2:low1}, ${4:high1}, ${5:low2}, ${6:high2});
snippet math normalize
norm(${1:value}, ${2:low}, ${3:high});
snippet math constrain
constrain(${1:value}, ${2:min}, ${3:max});
snippet math magnitude of a vector
mag(${1:a}, ${2:b}${3:, }${4:c});
snippet math distance
dist(${1:x1}, ${2:y1}, ${4:x2}, ${5:y2});
snippet math distance 3D
dist(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${6:z2});
#noise math
snippet noise set noise
noise(${1:x}${2:, }${3:y}${4:, }${5:z});
snippet noise noise detail
noiseDetail(${1:octaves}${2:, }${3:falloff});
snippet noise noise seed
noiseSeed(${1:x});
#material
snippet material shininess
shininess(${1:shine});
snippet material specular
specular(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet material ambient
ambient(${1:value1}, ${2:value2}, ${3:value3});
snippet material emissive
emissive(${1:value1}, ${2:value2}, ${3:value3});
#light
snippet light no light
noLights();
snippet light light
lights();
snippet light diretional light
directionalLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:nx}, ${5:ny}, ${6:nz});
snippet light point light
pointLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:nx}, ${5:ny}, ${6:nz});
snippet light falloff light
lightFalloff(${1:constant}, ${2:linear}, ${3:quadratic});
snippet light normal light
normal(${1:nx}, ${2:ny}, ${3:nz});
snippet light specular light
lightFalloff(${1:v1}, ${2:v2}, ${3:v3});
snippet light ambient light
ambientLight(${1:v1}, ${2:v2}, ${3:v3}${7:, ${4:x}, ${5:y}, ${6:z}});
snippet light spot light
spotLight(${1:v1}, ${2:v2}, ${3:v3}, ${4:x}, ${5:y}, ${6:z}, ${7:nx}, ${8:ny}, ${9:nz}, ${10:angle}, ${11:concentration});
#camera
snippet cam camera
camera(${1:eyeX}, ${2:eyeY}, ${3:eyeZ}, ${4:centerX}, ${5:centerY}, ${6:centerZ}, ${7:upX}, ${8:upY}, ${9:upZ});
snippet cam ortho
ortho(${1:left}, ${2:right}, ${3:bottom}, ${4:top}, ${5:near}, ${6:far});
snippet cam begin camera
beginCamera();
snippet cam end camera
endCamera();
snippet cam print camera
printCamera();
snippet cam print camera projection
printProjection();
snippet cam perspective camera
perspective(${1:fov}, ${2:aspect}, ${3:zNear}, ${4:zFar});
snippet cam frustrum
frustrum(${1:left}, ${2:right}, ${3:bottom}, ${4:top}, ${5:near}, ${6:far});
#transformations
snippet trans rotate
rotate${1:X}(${1:angle});
snippet trans translate
translate(${1:x}, ${2:y}${3:, }${4:z});
snippet trans scale size
scale(${1:size});
snippet trans scale
scale(${1:x}, ${2:y}${3:, }${4:z});
#coordinates
snippet coord
${1:model/screen}${2:X}(${3:x}, ${4:y}, ${5:z});
#effects
snippet fx brightness
brightness(${1:color});
snippet fx lerp color
lerpColor(${1:c1}, ${2:c2}, ${3:amt});
snippet fx saturation
saturation(${1:color});
snippet fx hue
hue(${1:color});
snippet fx alpha
alpha(${1:color});
snippet fx tint
tint(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet fx notint
noTint();
#pixel
snippet px set pixel
set(${1:x}, ${2:y}, ${3:color/image});
snippet px update pixel
updatePixels();
snippet px load pixel
loadPixels();
snippet px pixels
pixels[${1:index}]
snippet px get pixel
get(${1:x}, ${2:y}${3:, }${4:width}${5:, }${6:height});
#geometric figures
snippet geof triangle
triangle(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3});
snippet geof line
line(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2});
snippet geof line 3D
line(${1:x1}, ${2:y1}, ${3:z1}, ${4:x2}, ${5:y2}, ${6:z2});
snippet geof arc
arc(${1:x}, ${2:y}, ${3:width}, ${4:height}, ${5:start}, ${6:stop});
snippet geof point
point(${1:x}, ${2:y}${3:, }${4:z});
snippet geof quad
quad(${1:x1}, ${2:y1}, ${3:x2}, ${4:y2}, ${5:x3}, ${6:y3}, ${7:x4}, ${8:y4});
snippet geof ellipse
ellipse(${1:x}, ${2:y}, ${3:width}, ${4:height});
snippet geof rect
rect(${1:x}, ${2:y}, ${3:width}, ${4:height});
snippet geof box
box(${1:width}, ${2:height}, ${3:depth});
snippet geof sphere
sphere(${1:radius});
snippet geof sphere details
sphereDetail(${1:n});
snippet geof set smooth
smooth();
snippet geof set no smooth
noSmooth();
#array operations
snippet arrop normal split
split("${1:str}"${2: , }${3:delimiter});
snippet arrop split Tokens
splitTokens(${1:str}${2:, }${3:tokens});
snippet arrop join
join(${1:strgArray}${2: , }${3:seperator});
snippet arrop shorten
shorten(${1:array});
snippet arrop concat
concat(${1:array1}, ${2:array2});
snippet arrop subset
subset(${1:array}, ${2:offset});
snippet arrop append
append(${1:array}, ${2:element});
snippet arrop reverse
reverse(${1:array});
snippet arrop splice
splice(${1:array}, ${2:value/array2}, ${3:index});
snippet arrop sort
sort(${1:dataArray}${2:, }${3:count});
snippet arrop expand
expand(${1:array}${2:, }${3:newSize});
snippet arrop array copy
arrayCopy(${1:src}, ${2:dest}, ${3:, }${3:length});
#string operations
snippet strop str
str("${1:str}");
snippet strop match
match(${1:str}, ${2:regexp});
snippet strop trim
trim(${1:str});
snippet strop nf
nf(${2:value}, ${3:left}${4:, }${5:right});
snippet strop nfs
nfs(${2:value}, ${3:left}${4:, }${5:right});
snippet strop nfp
nfp(${2:value}, ${3:left}${4:, }${5:right});
snippet strop nfc
nfc(${1:value}${2:, }${3:right});
#convert
snippet convert unbinary
unbinary("${1:str}"});
snippet convert hexadecimal
hex(${1:c});
snippet convert unhex
unhex(${1:c});
snippet convert binary
binary(${1:value}${2:, }${3:digits});
#image operations
snippet image load image
loadImage(${1:filename});
snippet image image
image(${1:img}, ${2:x}, ${3:y}${4:, }${5:width}${6:, }${7:height});
snippet copy copy
copy(${1:srcImg}${2:, }${3:x}, ${4:y}, ${5:width}, ${6:height}, ${7:dx}, ${8:dy}, ${9:dwidth}, ${10:dheight});
#containers
snippet bg
background(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
snippet pg
PGraphics pg;
pg = createGraphics(${1:width}, ${2:height}${3:, }${4:applet});
snippet pimage
PImage(${1:width}, ${2:height});
#UTILS
#nofill
snippet nofill
noFill();
#fill
snippet fill
fill(${1:value1}, ${2:value2}, ${3:value3}${4:, }${5:alpha});
#red
snippet red
red(${1:color});
#green
snippet green
green(${1:color});
#blue
snippet blue
blue(${1:color});
#status
snippet status
status(${1:text});
#param
snippet param
param(${1:s});
#link
snippet link
link(${1:url}${2:, }${3:target});
#@param
snippet @
@${1:param/return/private/public} ${1:parameter} ${2:description}

View File

@ -0,0 +1,58 @@
# Progress/OpenEdge ABL snippets
# define
snippet defbuf
DEFINE BUFFER b_${1:TableName} FOR $1 ${2}.
snippet defvar
DEFINE VARIABLE ${1:VariableName} AS ${2}.
snippet nl
NO-LOCK
snippet ne
NO-ERROR
snippet nle
NO-LOCK NO-ERROR
snippet ini
INITIAL ${1:?}
snippet nu
NO-UNDO
snippet err
ERROR
snippet ff
FIND FIRST ${1:BufferName}
${2:WHERE $1.${3}} ${4}
snippet input
DEFINE INPUT PARAMETER ${1:ParamName} AS ${2}.
snippet output
DEFINE OUTPUT PARAMETER ${1:ParamName} AS ${2:ParamType}.
snippet proc
/******************************************************************************/
PROCEDURE ${1:ProcName}:
${2}
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}:
${2}
END.
# datatypes
snippet int
INTEGER
snippet char
CHARACTER
snippet log
LOGICAL
snippet dec
DECIMAL
snippet sep
/* ------------------------------------------------------------------------- */

View File

@ -0,0 +1,155 @@
# Snippets for use with VIM and http://www.vim.org/scripts/script.php?script_id=2540
#
# Please contact R.I.Pienaar <rip@devco.net> for additions and feedback,
# see it in action @ http://www.devco.net/archives/2009/09/22/vim_and_puppet.php
# Language Constructs
snippet class
class ${1:`Filename('', 'name')`} {
${2}
}
snippet node
node "${1:`Filename('', 'fqdn')`}" {
${2}
}
snippet case
case $${1:variable} {
default: { ${2} }
}
snippet ife
if $${1:variable} {
${2}
} else {
${3}
}
snippet if
if $${1:variable} {
${2}
}
snippet else
else {
${1}
}
snippet ?
? {
'${1}' => ${2}
}
#
# blocks etc and general syntax sugar
snippet [
[ ${1} ]${2}
snippet >
${1} => ${2}
snippet p:
"puppet://puppet/${1:module name}/${2:file name}"
#
# Functions
snippet alert
alert("${1:message}")${2}
snippet crit
crit("${1:message}")${2}
snippet debug
debug("${1:message}")${2}
snippet defined
defined(${1:Resource}["${2:name}"])${3}
snippet emerg
emerg("${1:message}")${2}
snippet extlookup Simple extlookup
extlookup("${1:variable}")${2}
snippet extlookup Extlookup with defaults
extlookup("${1:variable}", "${2:default}")${3}
snippet extlookup Extlookup with defaults and custom data file
extlookup("${1:variable}", "${2:default}", "${3:data source}")${4}
snippet fail
fail("${1:message}")${2}
snippet info
info("${1:message}")${2}
snippet inline_template
inline_template("<%= ${1} %>")${2}
snippet notice
notice("${1:message}")${2}
snippet realize
realize(${1:Resource}[${2:name}])${3}
snippet regsubst
regsubst(${1:hay stack}, ${2:needle}, "${3:replacement}")${4}
snippet inc
include ${1:classname}${2}
snippet split
split(${1:hay stack}, "${2:patten}")${3}
snippet versioncmp
versioncmp("${1:version}", "${2:version}")${3}
snippet warning
warning("${1:message}")${2}
#
# Types
snippet cron
cron{ "${1:name}":
command => "${2}",
user => "${3:root}",
${4} => ${5}
}
snippet exec
exec{ "${1:name}":
command => "${2:$1}",
user => "${3:root}",
${4} => ${5}
}
snippet user
user{ "${1:user}":
comment => "${2:$1}",
ensure => present,
managehome => true,
home => "${3:/home/$1}"
}
snippet group
group{ "${1:group}":
ensure => ${2:present}
}
snippet host
host{ "${1:hostname}":
ip => ${2:127.0.0.1}
}
snippet mailalias
mailalias{ "${1:localpart}":
recipient => "${2:recipient}"
}
snippet mount
mount{ "${1:destination path}":
ensure => ${2:mounted},
device => "${3:device name or path}"
}
snippet package
package{ "${1:package name}":
ensure => ${2:present}
}
snippet yumrepo
yumrepo{ "${1:repo name}":
descr => "${2:$1}",
enabled => ${3:1}
}
snippet define
define ${1} (${2}) {
${3}
}
snippet service
service{ "${1:service}":
enable => ${2:true},
ensure => ${3:running},
hasstatus => true,
}
snippet file
file{ "${1:path}":
${2} => ${3}
}

View File

@ -0,0 +1,164 @@
snippet #!
#!/usr/bin/env python
snippet imp
import ${1:module}
snippet from
from ${1:package} import ${2:module}
# Module Docstring
snippet docs
"""
File: ${1:`Filename('$1.py', 'foo.py')`}
Author: `g:snips_author`
Email: `g:snips_email`
Github: `g:snips_github`
Description: ${2}
"""
snippet wh
while ${1:condition}:
${2:# TODO: write code...}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
${1:# TODO: write code...}
if ${2:condition}:
break
snippet with
with ${1:expr} as ${2:var}:
${3:# TODO: write code...}
# 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
${6}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${4:# TODO: write code...}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${3:# TODO: write code...}
# New Method
snippet defs
def ${1:mname}(self, ${2:arg}):
${3:# TODO: write code...}
# New Property
snippet property
def ${1:foo}():
doc = "${2:The $1 property.}"
def fget(self):
${3:return self._$1}
def fset(self, value):
${4:self._$1 = value}
def fdel(self):
${5:del self._$1}
return locals()
$1 = property(**$1())
# Ifs
snippet if
if ${1:condition}:
${2:# TODO: write code...}
snippet el
else:
${1:# TODO: write code...}
snippet ei
elif ${1:condition}:
${2:# TODO: write code...}
# For
snippet for
for ${1:item} in ${2:items}:
${3:# TODO: write code...}
# Encodes
snippet cutf8
# -*- coding: utf-8 -*-
snippet clatin1
# -*- coding: latin-1 -*-
snippet cascii
# -*- coding: ascii -*-
# Lambda
snippet ld
${1:var} = lambda ${2:vars} : ${3:action}
snippet .
self.
snippet try Try/Except
try:
${1:# TODO: write code...}
except ${2:Exception}, ${3:e}:
${4:raise $3}
snippet try Try/Except/Else
try:
${1:# TODO: write code...}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:# TODO: write code...}
snippet try Try/Except/Finally
try:
${1:# TODO: write code...}
except ${2:Exception}, ${3:e}:
${4:raise $3}
finally:
${5:# TODO: write code...}
snippet try Try/Except/Else/Finally
try:
${1:# TODO: write code...}
except ${2:Exception}, ${3:e}:
${4:raise $3}
else:
${5:# TODO: write code...}
finally:
${6:# TODO: write code...}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
${1:main()}
# __magic__
snippet _
__${1:init}__${2}
# python debugger (pdb)
snippet pdb
import pdb; pdb.set_trace()
# ipython debugger (ipdb)
snippet ipdb
import ipdb; ipdb.set_trace()
# ipython debugger (pdbbb)
snippet pdbbb
import pdbpp; pdbpp.set_trace()
snippet pprint
import pprint; pprint.pprint(${1})${2}
snippet "
"""
${1:doc}
"""
# test function/method
snippet test
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
${3:# TODO: write code...}
# test case
snippet testcase
class ${1:ExampleCase}(unittest.TestCase):
def test_${2:description}(self):
${3:# TODO: write code...}
snippet fut
from __future__ import ${1}
#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"):
${4}
elif option in ("-v", "--verbose"):
verbose = argument

View File

@ -0,0 +1,121 @@
snippet #!
#!/usr/bin/env Rscript
# includes
snippet lib
library(${1:package})
snippet req
require(${1:package})
snippet source
source('${1:file}')
# conditionals
snippet if
if (${1:condition}) {
${2:code}
}
snippet el
else {
${1:code}
}
snippet ei
else if (${1:condition}) {
${2:code}
}
# functions
snippet fun
${1:name} = function (${2:variables}) {
${3:code}
}
snippet ret
return(${1:code})
# dataframes, lists, etc
snippet df
${1:name}[${2:rows}, ${3:cols}]
snippet c
c(${1:items})
snippet li
list(${1:items})
snippet mat
matrix(${1:data}, nrow=${2:rows}, ncol=${3:cols})
# apply functions
snippet apply
apply(${1:array}, ${2:margin}, ${3:function})
snippet lapply
lapply(${1:list}, ${2:function})
snippet sapply
lapply(${1:list}, ${2:function})
snippet vapply
vapply(${1:list}, ${2:function}, ${3:type})
snippet mapply
mapply(${1:function}, ${2:...})
snippet tapply
tapply(${1:vector}, ${2:index}, ${3:function})
snippet rapply
rapply(${1:list}, ${2:function})
# plyr functions
snippet dd
ddply(${1:frame}, ${2:variables}, ${3:function})
snippet dl
dlply(${1:frame}, ${2:variables}, ${3:function})
snippet da
daply(${1:frame}, ${2:variables}, ${3:function})
snippet d_
d_ply(${1:frame}, ${2:variables}, ${3:function})
snippet ad
adply(${1:array}, ${2:margin}, ${3:function})
snippet al
alply(${1:array}, ${2:margin}, ${3:function})
snippet aa
aaply(${1:array}, ${2:margin}, ${3:function})
snippet a_
a_ply(${1:array}, ${2:margin}, ${3:function})
snippet ld
ldply(${1:list}, ${2:function})
snippet ll
llply(${1:list}, ${2:function})
snippet la
laply(${1:list}, ${2:function})
snippet l_
l_ply(${1:list}, ${2:function})
snippet md
mdply(${1:matrix}, ${2:function})
snippet ml
mlply(${1:matrix}, ${2:function})
snippet ma
maply(${1:matrix}, ${2:function})
snippet m_
m_ply(${1:matrix}, ${2:function})
# plot functions
snippet pl
plot(${1:x}, ${2:y})
snippet ggp
ggplot(${1:data}, aes(${2:aesthetics}))
snippet img
${1:(jpeg,bmp,png,tiff)}(filename="${2:filename}", width=${3}, height=${4}, unit="${5}")
${6:plot}
dev.off()
# statistical test functions
snippet fis
fisher.test(${1:x}, ${2:y})
snippet chi
chisq.test(${1:x}, ${2:y})
snippet tt
t.test(${1:x}, ${2:y})
snippet wil
wilcox.test(${1:x}, ${2:y})
snippet cor
cor.test(${1:x}, ${2:y})
snippet fte
var.test(${1:x}, ${2:y})
snippet kvt
kv.test(${1:x}, ${2:y})

View File

@ -0,0 +1,22 @@
# rst
snippet :
:${1:field name}: ${2:field body}
snippet *
*${1:Emphasis}*
snippet **
**${1:Strong emphasis}**
snippet _
\`${1:hyperlink-name}\`_
.. _\`$1\`: ${2:link-block}
snippet =
${1:Title}
=====${2:=}
${3}
snippet -
${1:Title}
-----${2:-}
${3}
snippet cont:
.. contents::

View File

@ -0,0 +1,961 @@
########################################
# Ruby snippets - for Rails, see below #
########################################
# encoding for Ruby 1.9
snippet enc
# encoding: utf-8
# #!/usr/bin/env ruby
snippet #!
#!/usr/bin/env ruby
# encoding: utf-8
# New Block
snippet =b
=begin rdoc
${1}
=end
snippet y
:yields: ${1:arguments}
snippet rb
#!/usr/bin/env ruby -wKU
snippet beg
begin
${3}
rescue ${1:Exception} => ${2:e}
end
snippet req require
require "${1}"${2}
snippet reqr
require_relative "${1}"${2}
snippet #
# =>
snippet end
__END__
snippet case
case ${1:object}
when ${2:condition}
${3}
end
snippet when
when ${1:condition}
${2}
snippet def
def ${1:method_name}
${2}
end
snippet deft
def test_${1:case_name}
${2}
end
snippet if
if ${1:condition}
${2}
end
snippet ife
if ${1:condition}
${2}
else
${3}
end
snippet elsif
elsif ${1:condition}
${2}
snippet unless
unless ${1:condition}
${2}
end
snippet while
while ${1:condition}
${2}
end
snippet for
for ${1:e} in ${2:c}
${3}
end
snippet until
until ${1:condition}
${2}
end
snippet cla class .. end
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
end
snippet cla class .. initialize .. end
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
def initialize(${2:args})
${3}
end
end
snippet cla class .. < ParentClass .. initialize .. end
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < ${2:ParentClass}
def initialize(${3:args})
${4}
end
end
snippet cla ClassName = Struct .. do .. end
${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} = Struct.new(:${2:attr_names}) do
def ${3:method_name}
${4}
end
end
snippet cla class BlankSlate .. initialize .. end
class ${1:BlankSlate}
instance_methods.each { |meth| undef_method(meth) unless meth =~ /\A__/ }
end
snippet cla class << self .. end
class << ${1:self}
${2}
end
# class .. < DelegateClass .. initialize .. end
snippet cla-
class ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} < DelegateClass(${2:ParentClass})
def initialize(${3:args})
super(${4:del_obj})
${5}
end
end
snippet mod module .. end
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
${2}
end
snippet mod module .. module_function .. end
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module_function
${2}
end
snippet mod module .. ClassMethods .. end
module ${1:`substitute(Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
module ClassMethods
${2}
end
module InstanceMethods
end
def self.included(receiver)
receiver.extend ClassMethods
receiver.send :include, InstanceMethods
end
end
# attr_reader
snippet r
attr_reader :${1:attr_names}
# attr_writer
snippet w
attr_writer :${1:attr_names}
# attr_accessor
snippet rw
attr_accessor :${1:attr_names}
snippet atp
attr_protected :${1:attr_names}
snippet ata
attr_accessible :${1:attr_names}
# include Enumerable
snippet Enum
include Enumerable
def each(&block)
${1}
end
# include Comparable
snippet Comp
include Comparable
def <=>(other)
${1}
end
# extend Forwardable
snippet Forw-
extend Forwardable
# def self
snippet defs
def self.${1:class_method_name}
${2}
end
# def method_missing
snippet defmm
def method_missing(meth, *args, &blk)
${1}
end
snippet defd
def_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}
snippet defds
def_delegators :${1:@del_obj}, :${2:del_methods}
snippet am
alias_method :${1:new_name}, :${2:old_name}
snippet app
if __FILE__ == $PROGRAM_NAME
${1}
end
# usage_if()
snippet usai
if ARGV.${1}
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3}
end
# usage_unless()
snippet usau
unless ARGV.${1}
abort "Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}"${3}
end
snippet array
Array.new(${1:10}) { |${2:i}| ${3} }
snippet hash
Hash.new { |${1:hash}, ${2:key}| $1[$2] = ${3} }
snippet file File.foreach() { |line| .. }
File.foreach(${1:"path/to/file"}) { |${2:line}| ${3} }
snippet file File.read()
File.read(${1:"path/to/file"})${2}
snippet Dir Dir.global() { |file| .. }
Dir.glob(${1:"dir/glob/*"}) { |${2:file}| ${3} }
snippet Dir Dir[".."]
Dir[${1:"glob/**/*.rb"}]${2}
snippet dir
Filename.dirname(__FILE__)
snippet deli
delete_if { |${1:e}| ${2} }
snippet fil
fill(${1:range}) { |${2:i}| ${3} }
# flatten_once()
snippet flao
inject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)}${3}
snippet zip
zip(${1:enums}) { |${2:row}| ${3} }
# downto(0) { |n| .. }
snippet dow
downto(${1:0}) { |${2:n}| ${3} }
snippet ste
step(${1:2}) { |${2:n}| ${3} }
snippet tim
times { |${1:n}| ${2} }
snippet upt
upto(${1:1.0/0.0}) { |${2:n}| ${3} }
snippet loo
loop { ${1} }
snippet ea
each { |${1:e}| ${2} }
snippet ead
each do |${1:e}|
${2}
end
snippet eab
each_byte { |${1:byte}| ${2} }
snippet eac- each_char { |chr| .. }
each_char { |${1:chr}| ${2} }
snippet eac- each_cons(..) { |group| .. }
each_cons(${1:2}) { |${2:group}| ${3} }
snippet eai
each_index { |${1:i}| ${2} }
snippet eaid
each_index do |${1:i}|
${2}
end
snippet eak
each_key { |${1:key}| ${2} }
snippet eakd
each_key do |${1:key}|
${2}
end
snippet eal
each_line { |${1:line}| ${2} }
snippet eald
each_line do |${1:line}|
${2}
end
snippet eap
each_pair { |${1:name}, ${2:val}| ${3} }
snippet eapd
each_pair do |${1:name}, ${2:val}|
${3}
end
snippet eas-
each_slice(${1:2}) { |${2:group}| ${3} }
snippet easd-
each_slice(${1:2}) do |${2:group}|
${3}
end
snippet eav
each_value { |${1:val}| ${2} }
snippet eavd
each_value do |${1:val}|
${2}
end
snippet eawi
each_with_index { |${1:e}, ${2:i}| ${3} }
snippet eawid
each_with_index do |${1:e}, ${2:i}|
${3}
end
snippet eawo
each_with_object(${1:init}) { |${2:e}, ${3:var}| ${4} }
snippet eawod
each_with_object(${1:init}) do |${2:e}, ${3:var}|
${4}
end
snippet reve
reverse_each { |${1:e}| ${2} }
snippet reved
reverse_each do |${1:e}|
${2}
end
snippet inj
inject(${1:init}) { |${2:mem}, ${3:var}| ${4} }
snippet injd
inject(${1:init}) do |${2:mem}, ${3:var}|
${4}
end
snippet map
map { |${1:e}| ${2} }
snippet mapd
map do |${1:e}|
${2}
end
snippet mapwi-
enum_with_index.map { |${1:e}, ${2:i}| ${3} }
snippet sor
sort { |a, b| ${1} }
snippet sorb
sort_by { |${1:e}| ${2} }
snippet ran
sort_by { rand }
snippet all
all? { |${1:e}| ${2} }
snippet any
any? { |${1:e}| ${2} }
snippet cl
classify { |${1:e}| ${2} }
snippet col
collect { |${1:e}| ${2} }
snippet cold
collect do |${1:e}|
${2}
end
snippet det
detect { |${1:e}| ${2} }
snippet detd
detect do |${1:e}|
${2}
end
snippet fet
fetch(${1:name}) { |${2:key}| ${3} }
snippet fin
find { |${1:e}| ${2} }
snippet find
find do |${1:e}|
${2}
end
snippet fina
find_all { |${1:e}| ${2} }
snippet finad
find_all do |${1:e}|
${2}
end
snippet gre
grep(${1:/pattern/}) { |${2:match}| ${3} }
snippet sub
${1:g}sub(${2:/pattern/}) { |${3:match}| ${4} }
snippet sca
scan(${1:/pattern/}) { |${2:match}| ${3} }
snippet scad
scan(${1:/pattern/}) do |${2:match}|
${3}
end
snippet max
max { |a, b| ${1} }
snippet min
min { |a, b| ${1} }
snippet par
partition { |${1:e}| ${2} }
snippet pard
partition do |${1:e}|
${2}
end
snippet rej
reject { |${1:e}| ${2} }
snippet rejd
reject do |${1:e}|
${2}
end
snippet sel
select { |${1:e}| ${2} }
snippet seld
select do |${1:e}|
${2}
end
snippet lam
lambda { |${1:args}| ${2} }
snippet doo
do
${1}
end
snippet dov
do |${1:variable}|
${2}
end
snippet :
:${1:key} => ${2:"value"}${3}
snippet ope
open(${1:"path/or/url/or/pipe"}, "${2:w}") { |${3:io}| ${4} }
# path_from_here()
snippet fpath
File.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2}
# unix_filter {}
snippet unif
ARGF.each_line${1} do |${2:line}|
${3}
end
# option_parse {}
snippet optp
require "optparse"
options = {${1:default => "args"}}
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)}
snippet opt
opts.on( "-${1:o}", "--${2:long-option-name}", ${3:String},
"${4:Option description.}") do |${5:opt}|
${6}
end
snippet tc
require "test/unit"
require "${1:library_file_name}"
class Test${2:$1} < Test::Unit::TestCase
def test_${3:case_name}
${4}
end
end
snippet ts
require "test/unit"
require "tc_${1:test_case_file}"
require "tc_${2:test_case_file}"${3}
snippet as
assert ${1:test}, "${2:Failure message.}"${3}
snippet ase
assert_equal ${1:expected}, ${2:actual}${3}
snippet asne
assert_not_equal ${1:unexpected}, ${2:actual}${3}
snippet asid
assert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2 ** -20}${4}
snippet asio
assert_instance_of ${1:ExpectedClass}, ${2:actual_instance}${3}
snippet asko
assert_kind_of ${1:ExpectedKind}, ${2:actual_instance}${3}
snippet asn
assert_nil ${1:instance}${2}
snippet asnn
assert_not_nil ${1:instance}${2}
snippet asm
assert_match /${1:expected_pattern}/, ${2:actual_string}${3}
snippet asnm
assert_no_match /${1:unexpected_pattern}/, ${2:actual_string}${3}
snippet aso
assert_operator ${1:left}, :${2:operator}, ${3:right}${4}
snippet asr
assert_raise ${1:Exception} { ${2} }
snippet asrd
assert_raise ${1:Exception} do
${2}
end
snippet asnr
assert_nothing_raised ${1:Exception} { ${2} }
snippet asnrd
assert_nothing_raised ${1:Exception} do
${2}
end
snippet asrt
assert_respond_to ${1:object}, :${2:method}${3}
snippet ass assert_same(..)
assert_same ${1:expected}, ${2:actual}${3}
snippet ass assert_send(..)
assert_send [${1:object}, :${2:message}, ${3:args}]${4}
snippet asns
assert_not_same ${1:unexpected}, ${2:actual}${3}
snippet ast
assert_throws :${1:expected} { ${2} }
snippet astd
assert_throws :${1:expected} do
${2}
end
snippet asnt
assert_nothing_thrown { ${1} }
snippet asntd
assert_nothing_thrown do
${1}
end
snippet fl
flunk "${1:Failure message.}"${2}
# Benchmark.bmbm do .. end
snippet bm-
TESTS = ${1:10_000}
Benchmark.bmbm do |results|
${2}
end
snippet rep
results.report("${1:name}:") { TESTS.times { ${2} }}
# Marshal.dump(.., file)
snippet Md
File.open(${1:"path/to/file.dump"}, "wb") { |${2:file}| Marshal.dump(${3:obj}, $2) }${4}
# Mashal.load(obj)
snippet Ml
File.open(${1:"path/to/file.dump"}, "rb") { |${2:file}| Marshal.load($2) }${3}
# deep_copy(..)
snippet deec
Marshal.load(Marshal.dump(${1:obj_to_copy}))${2}
snippet Pn-
PStore.new(${1:"file_name.pstore"})${2}
snippet tra
transaction(${1:true}) { ${2} }
# xmlread(..)
snippet xml-
REXML::Document.new(File.read(${1:"path/to/file"}))${2}
# xpath(..) { .. }
snippet xpa
elements.each(${1:"//Xpath"}) do |${2:node}|
${3}
end
# class_from_name()
snippet clafn
split("::").inject(Object) { |par, const| par.const_get(const) }
# singleton_class()
snippet sinc
class << self; self end
snippet nam
namespace :${1:`Filename()`} do
${2}
end
snippet tas
desc "${1:Task description}"
task :${2:task_name => [:dependent, :tasks]} do
${3}
end
# block
snippet b
{ |${1:var}| ${2} }
snippet begin
begin
raise 'A test exception.'
rescue Exception => e
puts e.message
puts e.backtrace.inspect
else
# other exception
ensure
# always executed
end
#debugging
snippet debug
require 'ruby-debug'; debugger; true;
snippet pry
require 'pry'; binding.pry
#############################################
# Rails snippets - for pure Ruby, see above #
#############################################
snippet art
assert_redirected_to ${1::action => "${2:index}"}
snippet artnp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${4:@$2})
snippet artnpp
assert_redirected_to ${1:parent}_${2:child}_path(${3:@$1})
snippet artp
assert_redirected_to ${1:model}_path(${2:@$1})
snippet artpp
assert_redirected_to ${1:model}s_path
snippet asd
assert_difference "${1:Model}.${2:count}", $1 do
${3}
end
snippet asnd
assert_no_difference "${1:Model}.${2:count}" do
${3}
end
snippet asre
assert_response :${1:success}, @response.body${2}
snippet asrj
assert_rjs :${1:replace}, "${2:dom id}"
snippet ass assert_select(..)
assert_select '${1:path}', :${2:text} => '${3:inner_html' ${4:do}
snippet bf
before_filter :${1:method}
snippet bt
belongs_to :${1:association}
snippet crw
cattr_accessor :${1:attr_names}
snippet defcreate
def create
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
respond_to do |wants|
if @$1.save
flash[:notice] = '$2 was successfully created.'
wants.html { redirect_to(@$1) }
wants.xml { render :xml => @$1, :status => :created, :location => @$1 }
else
wants.html { render :action => "new" }
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
end
end
end${3}
snippet defdestroy
def destroy
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
@$1.destroy
respond_to do |wants|
wants.html { redirect_to($1s_url) }
wants.xml { head :ok }
end
end${3}
snippet defedit
def edit
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
end
snippet defindex
def index
@${1:model_class_name} = ${2:ModelClassName}.all
respond_to do |wants|
wants.html # index.html.erb
wants.xml { render :xml => @$1s }
end
end${3}
snippet defnew
def new
@${1:model_class_name} = ${2:ModelClassName}.new
respond_to do |wants|
wants.html # new.html.erb
wants.xml { render :xml => @$1 }
end
end${3}
snippet defshow
def show
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |wants|
wants.html # show.html.erb
wants.xml { render :xml => @$1 }
end
end${3}
snippet defupdate
def update
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
respond_to do |wants|
if @$1.update_attributes(params[:$1])
flash[:notice] = '$2 was successfully updated.'
wants.html { redirect_to(@$1) }
wants.xml { head :ok }
else
wants.html { render :action => "edit" }
wants.xml { render :xml => @$1.errors, :status => :unprocessable_entity }
end
end
end${3}
snippet dele delegate .. to
delegate :${1:methods}, :to => :${2:object}
snippet dele delegate .. to .. prefix .. allow_nil
delegate :${1:methods}, :to => :${2:object}, :prefix => :${3:prefix}, :allow_nil => ${4:allow_nil}
snippet flash
flash[:${1:notice}] = "${2}"
snippet habtm
has_and_belongs_to_many :${1:object}, :join_table => "${2:table_name}", :foreign_key => "${3}_id"${4}
snippet hm
has_many :${1:object}
snippet hmd
has_many :${1:other}s, :class_name => "${2:$1}", :foreign_key => "${3:$1}_id", :dependent => :destroy${4}
snippet hmt
has_many :${1:object}, :through => :${2:object}
snippet ho
has_one :${1:object}
snippet i18
I18n.t('${1:type.key}')${2}
snippet ist
<%= image_submit_tag("${1:agree.png}", :id => "${2:id}"${3} %>
snippet log
Rails.logger.${1:debug} ${2}
snippet log2
RAILS_DEFAULT_LOGGER.${1:debug} ${2}
snippet logd
logger.debug { "${1:message}" }${2}
snippet loge
logger.error { "${1:message}" }${2}
snippet logf
logger.fatal { "${1:message}" }${2}
snippet logi
logger.info { "${1:message}" }${2}
snippet logw
logger.warn { "${1:message}" }${2}
snippet mapc
${1:map}.${2:connect} '${3:controller/:action/:id}'
snippet mapca
${1:map}.catch_all "*${2:anything}", :controller => "${3:default}", :action => "${4:error}"${5}
snippet mapr
${1:map}.resource :${2:resource}
snippet maprs
${1:map}.resources :${2:resource}
snippet mapwo
${1:map}.with_options :${2:controller} => '${3:thing}' do |$3|
${4}
end
snippet mbs
before_save :${1:method}
snippet mcht
change_table :${1:table_name} do |t|
${2}
end
snippet mp
map(&:${1:id})
snippet mrw
mattr_accessor :${1:attr_names}
snippet oa
order("${1:field}")
snippet od
order("${1:field} DESC")
snippet pa
params[:${1:id}]${2}
snippet ra
render :action => "${1:action}"
snippet ral
render :action => "${1:action}", :layout => "${2:layoutname}"
snippet rest
respond_to do |wants|
wants.${1:html} { ${2} }
end
snippet rf
render :file => "${1:filepath}"
snippet rfu
render :file => "${1:filepath}", :use_full_path => ${2:false}
snippet ri
render :inline => "${1:<%= 'hello' %>}"
snippet ril
render :inline => "${1:<%= 'hello' %>}", :locals => { ${2::name} => "${3:value}"${4} }
snippet rit
render :inline => "${1:<%= 'hello' %>}", :type => ${2::rxml}
snippet rjson
render :json => ${1:text to render}
snippet rl
render :layout => "${1:layoutname}"
snippet rn
render :nothing => ${1:true}
snippet rns
render :nothing => ${1:true}, :status => ${2:401}
snippet rp
render :partial => "${1:item}"
snippet rpc
render :partial => "${1:item}", :collection => ${2:@$1s}
snippet rpl
render :partial => "${1:item}", :locals => { :${2:$1} => ${3:@$1}
snippet rpo
render :partial => "${1:item}", :object => ${2:@$1}
snippet rps
render :partial => "${1:item}", :status => ${2:500}
snippet rt
render :text => "${1:text to render}"
snippet rtl
render :text => "${1:text to render}", :layout => "${2:layoutname}"
snippet rtlt
render :text => "${1:text to render}", :layout => ${2:true}
snippet rts
render :text => "${1:text to render}", :status => ${2:401}
snippet ru
render :update do |${1:page}|
$1.${2}
end
snippet rxml
render :xml => ${1:text to render}
snippet sc
scope :${1:name}, :where(:@${2:field} => ${3:value})
snippet sl
scope :${1:name}, lambda do |${2:value}|
where("${3:field = ?}", ${4:bind var})
end
snippet sha1
Digest::SHA1.hexdigest(${1:string})
snippet sweeper
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
observe $1
def after_save(${2:model_class_name})
expire_cache($2)
end
def after_destroy($2)
expire_cache($2)
end
def expire_cache($2)
expire_page
end
end
snippet tcb
t.boolean :${1:title}
${2}
snippet tcbi
t.binary :${1:title}, :limit => ${2:2}.megabytes
${3}
snippet tcd
t.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2}
${4}
snippet tcda
t.date :${1:title}
${2}
snippet tcdt
t.datetime :${1:title}
${2}
snippet tcf
t.float :${1:title}
${2}
snippet tch
t.change :${1:name}, :${2:string}, :${3:limit} => ${4:80}
${5}
snippet tci
t.integer :${1:title}
${2}
snippet tcl
t.integer :lock_version, :null => false, :default => 0
${1}
snippet tcr
t.references :${1:taggable}, :polymorphic => { :default => '${2:Photo}' }
${3}
snippet tcs
t.string :${1:title}
${2}
snippet tct
t.text :${1:title}
${2}
snippet tcti
t.time :${1:title}
${2}
snippet tcts
t.timestamp :${1:title}
${2}
snippet tctss
t.timestamps
${1}
snippet va
validates_associated :${1:attribute}
snippet vao
validates_acceptance_of :${1:terms}
snippet vc
validates_confirmation_of :${1:attribute}
snippet ve
validates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}
snippet vf
validates_format_of :${1:attribute}, :with => /${2:regex}/
snippet vi
validates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })
snippet vl
validates_length_of :${1:attribute}, :within => ${2:3}..${3:20}
snippet vn
validates_numericality_of :${1:attribute}
snippet vpo
validates_presence_of :${1:attribute}
snippet vu
validates_uniqueness_of :${1:attribute}
snippet wants
wants.${1:js|xml|html} { ${2} }
snippet wc
where(${1:"conditions"}${2:, bind_var})
snippet wh
where(${1:field} => ${2:value})
snippet xdelete
xhr :delete, :${1:destroy}, :id => ${2:1}${3}
snippet xget
xhr :get, :${1:show}, :id => ${2:1}${3}
snippet xpost
xhr :post, :${1:create}, :${2:object} => { ${3} }
snippet xput
xhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5}
snippet test
test "should ${1:do something}" do
${2}
end
#migrations
snippet mac
add_column :${1:table_name}, :${2:column_name}, :${3:data_type}
snippet mrc
remove_column :${1:table_name}, :${2:column_name}
snippet mrnc
rename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}
snippet mcc
change_column :${1:table}, :${2:column}, :${3:type}
snippet mccc
t.column :${1:title}, :${2:string}
snippet mct
create_table :${1:table_name} do |t|
t.column :${2:name}, :${3:type}
end
snippet migration
class ${1:class_name} < ActiveRecord::Migration
def self.up
${2}
end
def self.down
end
end
snippet trc
t.remove :${1:column}
snippet tre
t.rename :${1:old_column_name}, :${2:new_column_name}
${3}
snippet tref
t.references :${1:model}
#rspec
snippet it
it "${1:spec_name}" do
${2}
end
snippet itp
it "${1:spec_name}"
${2}
snippet its
its(:${1:method}) { should ${2} }
snippet itsn
its(:${1:method}) { should_not ${2} }
snippet desc
describe ${1:class_name} do
${2}
end
snippet cont
context "${1:message}" do
${2}
end
snippet bef
before :${1:each} do
${2}
end
snippet aft
after :${1:each} do
${2}
end
snippet let
let(:${1:method}) { ${2} }
snippet subj
subject { ${1} }
snippet spec
specify { subject.${1} }
snippet exp
expect(${1:object}).to ${2}
snippet btr
be_true
snippet bfa
be_false
snippet shared
shared_examples "${1:shared examples name}" ${2}
snippet itb
it_behaves_like "${1:shared examples name}"${2}

View File

@ -0,0 +1,349 @@
################################################################
# © Copyright 2011 Konstantin Gorodinskiy. All Rights Reserved.#
# Do What The Fuck You Want To Public License, Version 2. #
# See http://sam.zoy.org/wtfpl/COPYING for more details. #
################################################################
# Scala lang
#if
snippet if
if(${1:obj}) {
${2:/* code */}
}
#if not
snippet ifn
if(!${1:obj}) {
${2:/* code */}
}
#if-else
snippet ifel
if(${1:obj}) {
${2:/* code */}
} else {
${3:/* code */}
}
#if-else-if
snippet ifelif
if(${1:obj}) {
${2:/* code */}
} else if(${3:obj}) {
${4:/* code */}
}
#while loop
snippet while
while (${1:obj}) {
${2:/* code */}
}
#for loop(classic)
snippet for
for (${1:item} <- ${2:obj}) {
${3:/* code */}
}
#for loop(indexed)
snippet fori
for (${1:i} <- ${2:0} to ${3:obj}.length) {
${4:/* code */}
}
#exceptions
snippet try
try {
${1:/* code */}
} catch {
case e: FileNotFoundException => ${2:/* code */}
case e: IOException => ${3:/* code */}
} finally {
${4:/* code */}
}
#match
snippet match
${1: obj} match {
case ${2:e} => ${3:/* code */}
case _ => ${4:/* code */}
}
#case
snippet case
case ${1:value} => ${2:/* code */}
############################
# methods and arguments
#
#arg
snippet arg
${1:a}: ${2:T}${3:, arg}
#args
snippet args
${1:args}: ${2:T}*
#def
snippet def
def ${1:name}(${2:arg}) = ${3:}
#private def
snippet prdef
private def ${1:name}(${2:arg}) = ${3:}
#override def
snippet ovdef
override def ${1:name}(${2:arg}) = ${3:}
#first class function(see scalabook p 188)
snippet fcf
(${1:a}: ${2:T}) => $1 ${3:/* code */}
snippet =>
${1:name} => ${2:/* code */}
#recursion
snippet rec
def ${1:name}(${2:arg}) =
if($2) $2
else $1($2)
#curried method
snippet crdef
def ${1:name}(${2:arg})(${3:arg}) = ${4:}
#main method
#check validity of T
snippet main
def main(args: Array[String]):${1:T} = ${2:}
############################
# basic types(general purpose)
# you might want to use basic types snippets
#1
snippet T Double
dbl
#2
snippet T Int
int
#3
snippet T Long
lng
#4
snippet T Char
chr
#5
snippet T String
str
#6
snippet T Array
arr
#7
snippet T Buffer
buf
#8
snippet T List
list
#9
snippet T Tuple
tpl
#10
snippet T Set
set
#11
snippet T Map
map
#12
snippet T HashSet
hset
#13
snippet T HashMap
hmap
#14
snippet T Boolean
bool
#end
#named snippets for types
snippet bool
Boolean
snippet anyr
AnyRef
snippet dbl
Double
snippet int
Int
snippet str
String
snippet chr
Char
snippet lng
Long
snippet arr
Array${1:[T]}${2:()}
snippet buf
Buffer${1:[T]}${2:()}
snippet list
List${1:[T]}${2:()}
snippet tpl
Tuple${1:2}[${2:T},${3:T}]
snippet set
Set${1:[T]}${2:()}
snippet hset
HashSet${1:[T]}${2:()}
snippet mhset
mutable.HashSet${1:[T]}${2:()}
#for maps
snippet keyval
${1:key}->${2:val}${3:, keyval}
snippet map
Map[${1:T},${2:T}]${3:(keyval)}
snippet hmap
HashMap[${1:T},${2:T}]${3:(keyval)}
snippet mmap
mutable.Map[${1:T},${2:T}]${3:(keyval)}
snippet mhmap
mutable.HashMap[${1:T},${2:T}]${3:(keyval)}
#TODO add TreeMap and TreeSet
#asInstanceOf[]
snippet as
${1:name}.asInstanceOf[${2:T}]
#isInstanceOf[]
${1:name}.isInstanceOf[${2:T}]
#end
#collections methods
#scope() with one arg
snippet (a
(${1:a} => ${2:/* code */})
#scope() with two args
snippet {(
{(${1:a},${2:b}) =>
${3:/* code */}
}
#filter
snippet filter
${1:name}.filter (a
#map function
snippet mapf
${1:name}.map (a
#flatmap
snippet flatmap
${1:name}.flatMap${2:[T]}(a
#fold left
snippet fldl
${1:name}.foldLeft(${2:first}) {(
#fold right
snippet fldr
${1:name}.foldRight(${2:first}) {(
#fold left operator(if u wanna reduce readability of ur code)
#use wildcard symbols
snippet /:
(${1:first}/:${2:name})(${3:/* code */})
#fold right operator
snippet :\
(${1:first}:\${2:name})(${3:/* code */})
#reduce left
snippet redl
${1:name}.reduceLeft[${2:T}] {(
#reduce right
snippet redr
${1:name}.reduceRight[${2:T}] {(
#zipWithIndex(safe way).
#see http://daily-scala.blogspot.com/2010/05/zipwithindex.html
snippet zipwi
${1:name}.view.zipWithIndex
#split
snippet spl
${1:name}.split("${2:,}")
#end
snippet val
val ${1:name}${2:: T} = ${3:value}
snippet var
var ${1:name}${2:: T} = ${3:value}
############################
# classes
#
#extends
snippet extends
extends ${1:what}
#with
snippet with
with ${1:what}${2: with}
#auxiliary constructor(a. this)
snippet athis
def this(arg) = this(arg)
#abstract class
snippet abstract
abstract class ${1:name}${2:(arg)}${3: extends }${4: with} {
${5:override def toString = "$1"}
${6:/* code */}
}
#class
snippet class
class ${1:name}${2:(arg)}${3: extends }${4: with} {
${5:override def toString = "$1"}
${6:/* code */}
}
#object
snippet object
object ${1:name}${2:(arg)}${3: extends }${4: with} ${5:}
#trait
snippet trait
trait ${1:name}${2: extends }${3: with} {
${4:}
}
#class with trait Ordered(page 265)
snippet ordered
class ${1:name}${2:(arg)} extends Ordered[$1] ${3: with} {
${4:override def toString = "$1"}
def compare(that: $1) = ${5:this - that}
${6:/* code */}
}
#case class
snippet casecl
case class ${1:name}${2:(arg)}${3: extends }${4: with} ${5:}
############################
# testing
#
#scalatest imports
snippet scalatest
${1:import org.scalatest.Suite}
${2:import org.scalatest.FunSuite}
#assert
snippet assert
assert(${1:a}==${2:b})
#ensuring(p 296)
snippet ensuring
ifel ensuring(${1:a}==${2:b})
#expect
snippet expect
expect(${1:what}) {
#intercept
snippet intercept
intercept[${1:IllegalArgumentException}] {
#test
snippet test
test("${1:description}") {
#suite
snippet suite
class ${1:name} extends Suite {
def test() {
}
#funsuite
snippet fsuite
class ${1:name} extends FunSuite {
test("${2:description}") {
}
############################
# SBT
#
snippet webproject
import sbt._
class ${1:Name}(info: ProjectInfo) extends DefaultWebProject(info) {
val liftVersion = "${2:2.3}"
override def libraryDependencies = Set(
) ++ super.libraryDependencies
val snapshots = ScalaToolsSnapshots
}
#depencies
snippet liftjar
"net.liftweb" %% "${1:lib}" % liftVersion % "compile->default",
snippet jettyjar
"org.mortbay.jetty" % "jetty" % "${1:version}" % "test->default",
############################
# Lift
#
#lift imports
snippet liftimports
import _root_.net.liftweb.http._
import S._
import _root_.net.liftweb.util._
import Helpers._
import _root_.scala.xml._
#TODO LIFT,SBT,WEB.XML,HTML snippets

View File

@ -0,0 +1,86 @@
# Shebang. Executing bash via /usr/bin/env makes scripts more portable.
snippet #!
#!/usr/bin/env bash
snippet if
if [[ ${1:condition} ]]; then
${2:#statements}
fi
snippet elif
elif [[ ${1:condition} ]]; then
${2:#statements}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${3:#statements}
done
snippet fori
for ${1:needle} in ${2:haystack} ; do
${3:#statements}
done
snippet wh
while [[ ${1:condition} ]]; do
${2:#statements}
done
snippet until
until [[ ${1:condition} ]]; do
${2:#statements}
done
snippet case
case ${1:word} in
${2:pattern})
${3};;
esac
snippet go
while getopts '${1:o}' ${2:opts}
do
case $$2 in
${3:o0})
${4:#staments};;
esac
done
# Set SCRIPT_DIR variable to directory script is located.
snippet sdir
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# getopt
snippet getopt
__ScriptVersion="${1:version}"
#=== FUNCTION ================================================================
# NAME: usage
# DESCRIPTION: Display usage information.
#===============================================================================
function usage ()
{
cat <<- EOT
Usage : $${0:0} [options] [--]
Options:
-h|help Display this message
-v|version Display script version
EOT
} # ---------- end of function usage ----------
#-----------------------------------------------------------------------
# Handle command line arguments
#-----------------------------------------------------------------------
while getopts ":hv" opt
do
case $opt in
h|help ) usage; exit 0 ;;
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
\? ) echo -e "\n Option does not exist : $OPTARG\n"
usage; exit 1 ;;
esac # --- end of case ---
done
shift $(($OPTIND-1))
snippet root
if [ $(id -u) -ne 0 ]; then exec sudo $0; fi

View File

@ -0,0 +1,9 @@
# snippets for making snippets :)
snippet snip
snippet ${1:trigger}
${2}
snippet msnip
snippet ${1:trigger} ${2:description}
${3}
snippet v
{VISUAL}

Some files were not shown because too many files have changed in this diff Show More