restructuring classic snippets dir to conform to new parenting specs

This commit is contained in:
capitaomorte
2009-12-25 14:05:23 +00:00
parent eebdf516b2
commit 4426d044f6
418 changed files with 16 additions and 0 deletions

View File

@@ -1,3 +0,0 @@
#name : v.begin(), v.end()
# --
${1:v}.begin(), $1.end

View File

@@ -1,8 +0,0 @@
#name : class ... { ... }
# --
class ${1:Name}
{
public:
${1:$(yas/substr text "[^: ]*")}($2);
virtual ~${1:$(yas/substr text "[^: ]*")}();
};

View File

@@ -1,3 +0,0 @@
#name : namespace ...
# --
namespace

View File

@@ -1,3 +0,0 @@
#name : template <typename ...>
# --
template <typename ${T}>

View File

@@ -1,4 +0,0 @@
#name : using namespace ...
# --
using namespace ${std};
$0

View File

@@ -1,3 +0,0 @@
#name : FILE *fp = fopen(..., ...);
# --
FILE *${fp} = fopen(${"file"}, "${r}");

View File

@@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name : printf
# contributor : joaotavora
# --
printf ("${1:%s}\\n"${1:$(if (string-match "%" text) "," "\);")
}$2${1:$(if (string-match "%" text) "\);" "")}

View File

@@ -1,7 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : private attribute ....;
# --
/// <summary>
/// $3
/// </summary>
private $1 $2;

View File

@@ -1,21 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : private attribute ....; public property ... ... { ... }
# --
/// <summary>
/// $3
/// </summary>
private $1 $2;
/// <summary>
/// $4
/// </summary>
/// <value>$5</value>
public $1 $2
{
get {
return this.$2;
}
set {
this.$2 = value;
}
}

View File

@@ -1,21 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : private _attribute ....; public Property ... ... { ... }
# --
/// <summary>
/// $3
/// </summary>
private $1 ${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")};
/// <summary>
/// ${3:Description}
/// </summary>
/// <value><c>$1</c></value>
public ${1:Type} ${2:Name}
{
get {
return this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")};
}
set {
this.${2:$(if (> (length text) 0) (format "_%s%s" (downcase (substring text 0 1)) (substring text 1 (length text))) "")} = value;
}
}

View File

@@ -1,21 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : class ... { ... }
# --
${5:public} class ${1:Name}
{
#region Ctor & Destructor
/// <summary>
/// ${3:Standard Constructor}
/// </summary>
public $1($2)
{
}
/// <summary>
/// ${4:Default Destructor}
/// </summary>
public ~$1()
{
}
#endregion
}

View File

@@ -1,6 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : /// <summary> ... </summary>
# --
/// <summary>
/// $1
/// </summary>

View File

@@ -1,4 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : /// <param name="..."> ... </param>
# --
/// <param name="$1">$2</param>

View File

@@ -1,4 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : /// <param name="..."> ... </param>
# --
/// <returns>$1</returns>

View File

@@ -1,4 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : /// <exception cref="..."> ... </exception>
# --
/// <exception cref="$1">$2</exception>

View File

@@ -1,10 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : public void Method { ... }
# --
/// <summary>
/// ${5:Description}
/// </summary>${2:$(if (string= (upcase text) "VOID") "" (format "%s%s%s" "\n/// <returns><c>" text "</c></returns>"))}
${1:public} ${2:void} ${3:MethodName}($4)
{
$0
}

View File

@@ -1,7 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : namespace .. { ... }
# --
namespace $1
{
$0
}

View File

@@ -1,16 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : property ... ... { ... }
# --
/// <summary>
/// $5
/// </summary>
/// <value>$6</value>
$1 $2 $3
{
get {
return this.$4;
}
set {
this.$4 = value;
}
}

View File

@@ -1,6 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : #region ... #endregion
# --
#region $1
$0
#endregion

View File

@@ -1,4 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : using ...;
# --
using $1;

View File

@@ -1,4 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : using System;
# --
using System;

View File

@@ -1,4 +0,0 @@
#contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
#name : using System....;
# --
using System.$1;

View File

@@ -1,6 +0,0 @@
#name : do { ... } while (...)
# --
do
{
$0
} while (${1:condition});

View File

@@ -1,6 +0,0 @@
#name : for (...; ...; ...) { ... }
# --
for (${1:int i = 0}; ${2:i < N}; ${3:++i})
{
$0
}

View File

@@ -1,6 +0,0 @@
#name : if (...) { ... }
# --
if (${1:condition})
{
$0
}

View File

@@ -1,3 +0,0 @@
#name : #include "..."
# --
#include "$1"

View File

@@ -1,3 +0,0 @@
#name : #include <...>
# --
#include <$1>

View File

@@ -1,7 +0,0 @@
#name: int main(argc, argv) { ... }
# --
int main(int argc, char *argv[])
{
$0
return 0;
}

View File

@@ -1,13 +0,0 @@
#name : foo { ... } ; setFoo { ... }
# --
- (${1:id})${2:foo}
{
return $2;
}
- (void)set${2:$(capitalize text)}:($1)aValue
{
[$2 autorelease];
$2 = [aValue retain];
}
$0

View File

@@ -1,8 +0,0 @@
#name : #ifndef XXX; #define XXX; #endif
# --
#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (buffer-file-name))))`_H_}
#define $1
$0
#endif /* $1 */

View File

@@ -1,6 +0,0 @@
#name : struct ... { ... }
# --
struct ${1:name}
{
$0
};

View File

@@ -1,3 +0,0 @@
#name : background-color: ...
# --
background-color: #${1:DDD};

View File

@@ -1,3 +0,0 @@
#name : background-image: ...
# --
background-image: url($1);

View File

@@ -1,3 +0,0 @@
#name : border size style color
# --
border: ${1:1px} ${2:solid} #${3:999};

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : clear: ...
# --
clear: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : display: block
# --
display: block;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : display: inline
# --
display: inline;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : display: none
# --
display: none;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : font-family: ...
# --
font-family: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : font-size: ...
# --
font-size: ${12px};

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : margin-bottom: ...
# --
margin-bottom: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : margin-left: ...
# --
margin-left: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : margin: ...
# --
margin: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : margin top right bottom left
# --
margin: ${top} ${right} ${bottom} ${left};

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : margin-right: ...
# --
margin-right: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : margin-top: ...
# --
margin-top: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : padding-bottom: ...
# --
padding-bottom: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : padding-left: ...
# --
padding-left: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : padding: ...
# --
padding: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : padding: top right bottom left
# --
padding: ${top} ${right} ${bottom} ${left};

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : padding-right: ...
# --
padding-right: $1;

View File

@@ -1,4 +0,0 @@
#contributor : rejeep <johan.rejeep@gmail.com>
#name : padding-top: ...
# --
padding-top: $1;

View File

@@ -1,11 +0,0 @@
TITLE: Emacs Idiom Template Set. Version 1. 2009-02-22
DESCRIPTION: Some useful templates for emacs lisp. This template set is based on useful elisp idioms on common tasks.
LICENSING: GPL version 3.
AUTHOR: Xah Lee
Home Page: latest version at:
• Emacs Lisp Idiom Templates
http://xahlee.org/emacs/elisp_idiom_templates.html

View File

@@ -1,11 +0,0 @@
#name : function template
#contributor : Xah Lee
# --
(defun $1 ()
"thisandthat."
(interactive)
(let (var1)
(setq var1 some)
$0
)
)

View File

@@ -1,16 +0,0 @@
#name : process marked files in dired
#contributor : Xah Lee
# --
;; idiom for processing a list of files in dired's marked files
;; suppose myProcessFile is your function that takes a file path
;; and do some processing on the file
(defun dired-myProcessFile ()
"apply myProcessFile function to marked files in dired."
(interactive)
(require 'dired)
(mapc 'myProcessFile (dired-get-marked-files))
)
;; to use it, type M-x dired-myProcessFile

View File

@@ -1,17 +0,0 @@
#name : a function that process a file
#contributor : Xah Lee
# --
(defun doThisFile (fpath)
"Process the file at path FPATH ..."
(let ()
;; create temp buffer without undo record or font lock. (more efficient)
;; first space in temp buff name is necessary
(set-buffer (get-buffer-create " myTemp"))
(insert-file-contents fpath nil nil nil t)
;; process it ...
;; (goto-char 0) ; move to begining of file's content (in case it was open)
;; ... do something here
;; (write-file fpath) ;; write back to the file
(kill-buffer " myTemp")))

View File

@@ -1,17 +0,0 @@
#name : read lines of a file
#contributor : Xah Lee
# --
(defun read-lines (filePath)
"Return a list of lines in FILEPATH."
(with-temp-buffer
(insert-file-contents filePath)
(split-string
(buffer-string) "\n" t)) )
;; process all lines
(mapc
(lambda (aLine)
(message aLine) ; do your stuff here
)
(read-lines "inputFilePath")
)

View File

@@ -1,17 +0,0 @@
#name : find and replace on region
#contributor : Xah Lee
# --
(defun replace-html-chars-region (start end)
"Replace “<” to “&lt;” and other chars in HTML.
This works on the current region."
(interactive "r")
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(while (search-forward "&" nil t) (replace-match "&amp;" nil t))
(goto-char (point-min))
(while (search-forward "<" nil t) (replace-match "&lt;" nil t))
(goto-char (point-min))
(while (search-forward ">" nil t) (replace-match "&gt;" nil t))
)
)

View File

@@ -1,4 +0,0 @@
#name : grab buffer substring
#contributor : Xah Lee
# --
(setq $0 (buffer-substring-no-properties myStartPos myEndPos))

View File

@@ -1,4 +0,0 @@
#name : grab word under cursor
#contributor : Xah Lee
# --
(setq $0 (thing-at-point 'symbol))

View File

@@ -1,6 +0,0 @@
#name : traversing a directory
#contributor : Xah Lee
# --
;; apply a function to all files in a dir
(require 'find-lisp)
(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))

View File

@@ -1,27 +0,0 @@
#name : Command that works on region or word
#contributor : Xah Lee
# --
;; example of a command that works on current word or text selection
(defun down-case-word-or-region ()
"Lower case the current word or text selection."
(interactive)
(let (pos1 pos2 meat)
(if (and transient-mark-mode mark-active)
(setq pos1 (region-beginning)
pos2 (region-end))
(setq pos1 (car (bounds-of-thing-at-point 'symbol))
pos2 (cdr (bounds-of-thing-at-point 'symbol))))
; now, pos1 and pos2 are the starting and ending positions
; of the current word, or current text selection if exists
;; put your code here.
$0
;; Some example of things you might want to do
(downcase-region pos1 pos2) ; example of a func that takes region as args
(setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text.
(delete-region pos1 pos2) ; get rid of it
(insert "newText") ; insert your new text
)
)

View File

@@ -1,4 +0,0 @@
#name : after ... ->
# --
after
$1 -> $0

View File

@@ -1,5 +0,0 @@
#name : begin ... end
# --
begin
$0
end

View File

@@ -1,4 +0,0 @@
#name : -behaviour(...).
# --
-behaviour(${1:gen_server}).
$0

View File

@@ -1,5 +0,0 @@
#name : case ... of ... end
# --
case $1 of
$0
end

View File

@@ -1,4 +0,0 @@
#name : -compile(...).
# --
-compile([${1:export_all}]).
$0

View File

@@ -1,4 +0,0 @@
#name : -define(...,...).
# --
-define($1,$2).
$0

View File

@@ -1,5 +0,0 @@
#name : -export([]).
#contributor : hitesh <hitesh.jasani@gmail.com>
# --
-export([${1:start/0}]).
$0

View File

@@ -1,3 +0,0 @@
#name : fun (...) -> ... end
# --
fun ($1) -> $0 end

View File

@@ -1,6 +0,0 @@
#name : if ... -> ... ; true -> ... end
# --
if
$1 -> $2;
true -> $0
end

View File

@@ -1,5 +0,0 @@
#name : -ifdef(...). ... -endif.
# --
-ifdef($1).
$0
-endif.

View File

@@ -1,5 +0,0 @@
#name : -ifndef(...). ... -endif.
# --
-ifndef($1).
$0
-endif.

View File

@@ -1,5 +0,0 @@
#name : -import([]).
#contributor : hitesh <hitesh.jasani@gmail.com>
# --
-import(${1:lists}, [${2:map/2, sum/1}]).
$0

View File

@@ -1,4 +0,0 @@
#name : -include("...").
# --
-include("$1").
$0

View File

@@ -1,4 +0,0 @@
#name : -include_lib("...").
# --
-include_lib("$1").
$0

View File

@@ -1,8 +0,0 @@
#name : loop(...) -> receive _ -> loop(...) end.
# --
${1:loop}($2) ->
receive
${3:_} ->
$1($2)
end.
$0

View File

@@ -1,6 +0,0 @@
#name : -module().
#contributor : hitesh <hitesh.jasani@gmail.com>
# --
-module(${1:`(file-name-nondirectory
(file-name-sans-extension (or (buffer-file-name) (buffer-name))))`}).
$0

View File

@@ -1,5 +0,0 @@
#name : receive ... -> ... end
# --
receive
$1 -> $0
end

View File

@@ -1,6 +0,0 @@
#name : receive after ... -> ... end
# --
receive
after
$1 -> $0
end

View File

@@ -1,4 +0,0 @@
#name : -record(...,{...}).
# --
-record($1,{$2}).
$0

View File

@@ -1,7 +0,0 @@
#name : try ... of ... catch after end
# --
try $1 of
$0
catch
after
end

View File

@@ -1,4 +0,0 @@
#name : -undef(...).
# --
-undef($1).
$0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : automatic
# --
automatic $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : block data
# --
block data $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : continue
# --
continue $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : character
# --
character $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : complex
# --
complex $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : double complex
# --
double complex $0

View File

@@ -1,6 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : do while (...) end do
# --
do while (${1:condition})
$0
end do

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : double precision
# --
double precision $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : equivalence
# --
equivalence $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : implicit byte
# --
implicit byte $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : implicit complex
# --
implicit complex $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : implicit character
# --
implicit character $0

View File

@@ -1,6 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : if then end if
# --
if ( ${1:condition} ) then
$0
end if

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : implicit integer
# --
implicit integer $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : implicit logical
# --
implicit logical $0

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : implicit none
# --
implicit none

View File

@@ -1,4 +0,0 @@
#contributor: Li Zhu <http://www.zhuli.name>
#name : include
# --
include $0

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