Add snippets

This commit is contained in:
Tom Willemse 2016-11-24 21:41:10 +01:00
parent ec876cf254
commit 7a5cc50bb3
60 changed files with 530 additions and 1 deletions

View file

@ -6,7 +6,8 @@ SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)))
INIT_LISPS = $(addsuffix .elc,$(basename $(wildcard init/*.org))) INIT_LISPS = $(addsuffix .elc,$(basename $(wildcard init/*.org)))
VENDOR_DIRS = $(wildcard vendor-lisp/*) VENDOR_DIRS = $(wildcard vendor-lisp/*)
all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) .PHONE: all snippets
all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets
%.el: %.org %.el: %.org
$(call tangle,emacs-lisp) $(call tangle,emacs-lisp)
@ -28,3 +29,17 @@ $(AUTOLOADS_FILE): $(SITE_LISPS)
@$(EMACS) -batch \ @$(EMACS) -batch \
-eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \ -eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \
-eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")" -eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")"
### Snippets
SNIPPET_DIRS = $(wildcard snippets/*)
COMPILED_SNIPPETS = $(addsuffix /.yas-compiled-snippets.el, $(SNIPPET_DIRS))
%/.yas-compiled-snippets.el: %/*
@echo -e "\e[36mYAS\e[0m $(CURDIR)/snippets"
@$(EMACS) -batch \
-eval "(package-initialize)" \
-l yasnippet \
-eval "(yas-compile-directory \"$(CURDIR)/snippets\")"
snippets: $(COMPILED_SNIPPETS)

View file

@ -0,0 +1,2 @@
((nil
(require-final-newline . nil)))

View file

@ -0,0 +1,8 @@
;;; Compiled snippets and support files for `conf-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'conf-mode
'(("Section" "Section \"$1\"\n Identifier \"$2\"\n $0\nEndSection\n" "Xorg Section" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/conf-mode/section" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Xorg Section
# key: Section
# --
Section "$1"
Identifier "$2"
$0
EndSection

View file

@ -0,0 +1,8 @@
;;; Compiled snippets and support files for `css-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'css-mode
'(("boxshadow" "box-shadow: ${1:offset-x} ${2:offset-y}${3: [blur-radius]}${4: [spread-radius]}${5: [color]};" "box-shadow" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/css-mode/box-shadow" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: box-shadow
# key: boxshadow
# --
box-shadow: ${1:offset-x} ${2:offset-y}${3: [blur-radius]}${4: [spread-radius]}${5: [color]};

View file

@ -0,0 +1,9 @@
;;; Compiled snippets and support files for `emacs-lisp-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'emacs-lisp-mode
'(("face" " `($1 ((t (${2::foreground} $0))))" "face" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/emacs-lisp-mode/face" nil nil)
("do" "(depends-on \"$1\")$0" "depends-on" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/emacs-lisp-mode/depends-on" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: depends-on
# key: do
# --
(depends-on "$1")$0

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: face
# key: face
# --
`($1 ((t (${2::foreground} $0))))

View file

@ -0,0 +1,10 @@
;;; Compiled snippets and support files for `haml-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'haml-mode
'(("faq" "%dt\n = link_to '#' do\n .expand_icon\n $1\n%dd\n %p\n $0" "FAQ Question & Answer" nil nil
((yas-indent-line 'fixed))
"/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/haml-mode/faq" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,12 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: FAQ Question & Answer
# key: faq
# expand-env: ((yas-indent-line 'fixed))
# --
%dt
= link_to '#' do
.expand_icon
$1
%dd
%p
$0

View file

@ -0,0 +1,12 @@
;;; Compiled snippets and support files for `html-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'html-mode
'(("trans" "{% trans \"$1\"|capfirst %}" "trans with cap" pony-tpl-minor-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/trans-with-cap" nil nil)
("script" "<script src=\"$1\" type=\"${2:text/javascript}\" language=\"${3:javascript}\"></script>" "script" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/script" nil nil)
("%" "{% $1 %}\n $0\n{% end$1 %}" "Template Block" pony-tpl-minor-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/generic-block" nil nil)
("for" "{% for $1 in $2 %}\n $0\n{% endfor %}" "for" pony-tpl-minor-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/for" nil nil)
("block" "{% block $1 %}\n $0\n{% endblock %}" "block" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/html-mode/block" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: block
# key: block
# --
{% block $1 %}
$0
{% endblock %}

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: for
# key: for
# condition: pony-tpl-minor-mode
# --
{% for $1 in $2 %}
$0
{% endfor %}

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Template Block
# key: %
# condition: pony-tpl-minor-mode
# --
{% $1 %}
$0
{% end$1 %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: script
# key: script
# --
<script src="$1" type="${2:text/javascript}" language="${3:javascript}"></script>

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: trans with cap
# key: trans
# condition: pony-tpl-minor-mode
# --
{% trans "$1"|capfirst %}

View file

@ -0,0 +1,10 @@
;;; Compiled snippets and support files for `nxml-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'nxml-mode
'(("s" "<Shortcut displayName=\"$1\"\n icon=\"$2\"\n to=\"$3\">\n $0\n</Shortcut>" "Shortcut" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/nxml-mode/pencil-shortcut" nil nil)
("pv" "<PropertyValue name=\"$1\">$2</PropertyValue>" "PropertyValue" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/nxml-mode/pencil-property-value" nil nil)
("p" "<Property name=\"$1\"\n displayName=\"$2\"\n type=\"$3\">$4</Property>" "PencilProperty" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/nxml-mode/pencil-property" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: PencilProperty
# key: p
# --
<Property name="$1"
displayName="$2"
type="$3">$4</Property>

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: PropertyValue
# key: pv
# --
<PropertyValue name="$1">$2</PropertyValue>

View file

@ -0,0 +1,9 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Shortcut
# key: s
# --
<Shortcut displayName="$1"
icon="$2"
to="$3">
$0
</Shortcut>

View file

@ -0,0 +1,11 @@
;;; Compiled snippets and support files for `org-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'org-mode
'(("snippet" "#+TITLE: ${1:snippet-name}\n#+OPTIONS: toc:nil\n\n* $1\n\n ${2:A short description abount $1}\n\n #+BEGIN_SRC $3 :tangle yes\n$0\n #+END_SRC" "snippet" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/snippet" nil nil)
("project" "#+TITLE: ${1:project_name}\n#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}\n#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz\n#+LINK: zip $2$4.zip\n#+STARTUP: showall\n\n#+begin_html\n <script src=\"/keyjs.js\" type=\"text/javascript\"></script>\n <script type=\"text/javascript\">\n keyjs_initialize({ \"u\": [ \"keyjs_goto\", \"../index.html\" ],\n \"h\": [ \"keyjs_goto\", \"http://ryuslash.org\" ] });\n </script>\n#+end_html\n\n#+INCLUDE: \"dlmenu.inc\"\n\n* About\n\n ${5:A short description about $1}\n\n | $0Status | $6 |\n | Language | $7 |\n | License | ${8:GPLv3} |\n\n* Why?\n\n ${9:Why did you even think of writing $1?}\n\n* Features\n\n ${10:$1 does...}\n\n* Dependencies\n\n ${11:$1 needs to have...}\n\n* Download\n\n ${12:To download $1...}\n\n* Install\n\n ${13:To install $1...}\n\n* Usage\n\n ${14:Using $1...}" "project" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/project" nil nil)
("*" "${1:*} ${2:TODO} $3\n${1:$(make-string (length text) ?\\ )} :PROPERTIES:\n${1:$(make-string (length text) ?\\ )} :CATEGORY: $4\n${1:$(make-string (length text) ?\\ )} :END:\n${1:$(make-string (length text) ?\\ )} $0" "Heading" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/heading" nil nil)
("code" "#+begin_src $1\n $0\n#+end_src" "codeblock" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/org-mode/codeblock" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: codeblock
# key: code
# --
#+begin_src $1
$0
#+end_src

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Heading
# key: *
# --
${1:*} ${2:TODO} $3
${1:$(make-string (length text) ?\ )} :PROPERTIES:
${1:$(make-string (length text) ?\ )} :CATEGORY: $4
${1:$(make-string (length text) ?\ )} :END:
${1:$(make-string (length text) ?\ )} $0

View file

@ -0,0 +1,51 @@
# -*- mode: snippet -*-
# name: project
# key: project
# --
#+TITLE: ${1:project_name}
#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/}
#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz
#+LINK: zip $2$4.zip
#+STARTUP: showall
#+begin_html
<script src="/keyjs.js" type="text/javascript"></script>
<script type="text/javascript">
keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
"h": [ "keyjs_goto", "http://ryuslash.org" ] });
</script>
#+end_html
#+INCLUDE: "dlmenu.inc"
* About
${5:A short description about $1}
| $0Status | $6 |
| Language | $7 |
| License | ${8:GPLv3} |
* Why?
${9:Why did you even think of writing $1?}
* Features
${10:$1 does...}
* Dependencies
${11:$1 needs to have...}
* Download
${12:To download $1...}
* Install
${13:To install $1...}
* Usage
${14:Using $1...}

View file

@ -0,0 +1,14 @@
# -*- mode: snippet -*-
# name: snippet
# key: snippet
# --
#+TITLE: ${1:snippet-name}
#+OPTIONS: toc:nil
* $1
${2:A short description abount $1}
#+BEGIN_SRC $3 :tangle yes
$0
#+END_SRC

View file

@ -0,0 +1,10 @@
;;; Compiled snippets and support files for `php-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'php-mode
'(("header" "/*\n * Plugin Name: $1\n * Plugin URI: $2\n * Description: $3\n * Version: ${4:1.0}\n * Author: ${5:Tom Willemse}\n * Author URI: ${6:https://ryuslash.org}\n * License: ${7:GPLv2}\n */" "WP Plugin Header" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/php-mode/wpheader.php" nil nil)
("(" "( $0 " "opening-brace" electric-pair-mode nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/php-mode/opening-brace" nil nil)
("function" "function $1($2)\n{\n $0\n}" "function" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/php-mode/function" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: function
# key: function
# --
function $1($2)
{
$0
}

View file

@ -0,0 +1,13 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: WP Plugin Header
# key: header
# --
/*
* Plugin Name: $1
* Plugin URI: $2
* Description: $3
* Version: ${4:1.0}
* Author: ${5:Tom Willemse}
* Author URI: ${6:https://ryuslash.org}
* License: ${7:GPLv2}
*/

View file

@ -0,0 +1,15 @@
;;; Compiled snippets and support files for `python-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'python-mode
'(("url" "url(r'^$1', $2, name='$3')," "url" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/url" nil nil)
("defm" "@method_decorator(permission_required('$1',\n raise_exception=True))\ndef dispatch(self, *args, **kwargs):\n '''Make sure the user has the $1 permission.'''\n return super(${3:`(progn (re-search-backward \"^[ \\t]*class \\\\(.+\\\\)(\") (match-string 1)))`}, self).dispatch(*args, **kwargs)" "Permission guard" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/permission_guard" nil nil)
("defm" "def $1(self$2):\n '''$3'''\n $0" "method" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/method" nil nil)
("from" "from ${1:module} import ${2:class_or_module}\n" "from ... import ..." nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/import_from" nil nil)
("formvalid" "def form_valid(self, form):\n rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form)\n $0\n return rv" "form_valid with return" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/form_valid_with_return" nil nil)
("defm" "@record_activity(model=${1:`(progn (re-search-backward \"^[ \\t]*model = \\\\([a-zA-Z_].*\\\\)$\") (match-string 1))`})\ndef form_valid(self, form):\n '''Make sure any changes to the $1 model get logged.'''\n return super(${2:`(progn (re-search-backward \"^[ \\t]*class \\\\(.+\\\\)(\") (match-string 1)))`}, self).form_valid(form)" "Record form" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/form_valid" nil nil)
("form" "class ${1:Model}Form(forms.ModelForm):\n '''Form for the $1 model.'''\n\n class Meta:\n model = $1" "Model Form" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/form" nil nil)
("defm" "def ${1:name}(self, *args, **kwargs):\n '''$2'''\n return super(${3:`(progn (re-search-backward \"^[ \\t]*class \\\\(.+\\\\)(\") (match-string 1)))`}, self).$1(*args, **kwargs)" "Empty Defmethod" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/python-mode/defm_empty" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# name: Empty Defmethod
# key: defm
# --
def ${1:name}(self, *args, **kwargs):
'''$2'''
return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).$1(*args, **kwargs)

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Model Form
# key: form
# --
class ${1:Model}Form(forms.ModelForm):
'''Form for the $1 model.'''
class Meta:
model = $1

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: Record form
# key: defm
# --
@record_activity(model=${1:`(progn (re-search-backward "^[ \t]*model = \\([a-zA-Z_].*\\)$") (match-string 1))`})
def form_valid(self, form):
'''Make sure any changes to the $1 model get logged.'''
return super(${2:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).form_valid(form)

View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: form_valid with return
# key: formvalid
# --
def form_valid(self, form):
rv = super(`(let ((name (python-info-current-defun))) (substring name 0 (cl-position ?. name)))`, self).form_valid(form)
$0
return rv

View file

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# name: from ... import ...
# contributor: Tom Willemse
# key: from
# --
from ${1:module} import ${2:class_or_module}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: method
# key: defm
# --
def $1(self$2):
'''$3'''
$0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: Permission guard
# key: defm
# --
@method_decorator(permission_required('$1',
raise_exception=True))
def dispatch(self, *args, **kwargs):
'''Make sure the user has the $1 permission.'''
return super(${3:`(progn (re-search-backward "^[ \t]*class \\(.+\\)(") (match-string 1)))`}, self).dispatch(*args, **kwargs)

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: url
# key: url
# --
url(r'^$1', $2, name='$3'),

View file

@ -0,0 +1,18 @@
;;; Compiled snippets and support files for `ruby-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'ruby-mode
'(("reduce" "reduce { |a, e| $0 }" "reduce" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/reduce" nil nil)
("mod" "module ${1:`(let ((fn (capitalize (file-name-nondirectory\n (directory-file-name\n default-directory)))))\n (replace-regexp-in-string \"_\" \"\" fn t t))`}\n $0\nend" "module ... end" nil
("definitions")
nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/mod" nil nil)
("fin" "fill_in '$1', with: $2" "fill_in" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/fill_in" nil nil)
("factory" "FactoryGirl.define do\n factory :${1:`(file-name-sans-extension (file-name-nondirectory buffer-file-name))`} do\n $0\n end\nend" "factory" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/factory" nil nil)
("do" "do$0\nend" "do" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/do" nil nil)
("desc" "describe '$1' do\n $0\nend" "describe" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/describe" nil nil)
("pseed" "Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210')\nProduct.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258')\nProduct.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300')\nProduct.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340')\n" "ProductSeedWithHWGroup" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHWGroup" nil nil)
("pseed" "Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')" "ProductSeedWithHW" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/ProductSeedHW" nil nil)
("pseed" "Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')" "ProductSeed" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/ruby-mode/ProductSeed" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ProductSeed
# key: pseed
# --
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4')

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ProductSeedWithHW
# key: pseed
# --
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: '$3', price: '$4', width_in_cm: '$5', height_in_cm: '$6', width_in_mm: '${5:$(round (* 10 (string-to-int yas-text)))}', height_in_mm: '${6:$(round (* 10 (string-to-int yas-text)))}')

View file

@ -0,0 +1,8 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: ProductSeedWithHWGroup
# key: pseed
# --
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Small', price: '20.00', width_in_cm: '25.00', height_in_cm: '21.00', width_in_mm: '250', height_in_mm: '210')
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Medium', price: '20.00', width_in_cm: '30.00', height_in_cm: '25.80', width_in_mm: '300', height_in_mm: '258')
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Large', price: '20.00', width_in_cm: '35.00', height_in_cm: '30.00', width_in_mm: '350', height_in_mm: '300')
Product.find_or_create_by_name(parent_id: $1, name: '$2', description: 'Extra large', price: '20.00', width_in_cm: '40.00', height_in_cm: '34.00', width_in_mm: '400', height_in_mm: '340')

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: describe
# key: desc
# --
describe '$1' do
$0
end

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# name: do
# key: do
# --
do$0
end

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# name: factory
# key: factory
# --
FactoryGirl.define do
factory :${1:`(file-name-sans-extension (file-name-nondirectory buffer-file-name))`} do
$0
end
end

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: fill_in
# key: fin
# --
fill_in '$1', with: $2

View file

@ -0,0 +1,11 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: module ... end
# key: mod
# group: definitions
# --
module ${1:`(let ((fn (capitalize (file-name-nondirectory
(directory-file-name
default-directory)))))
(replace-regexp-in-string "_" "" fn t t))`}
$0
end

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: reduce
# key: reduce
# --
reduce { |a, e| $0 }

View file

@ -0,0 +1,18 @@
;;; Compiled snippets and support files for `twig-mode'
;;; Snippet definitions:
;;;
(yas-define-snippets 'twig-mode
'(("set" "{% set $1 = $2 %}" "set" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/set" nil nil)
("mac" "{% macro ${1:name}(${2:args}) %}\n $0\n{% endmacro %}" "macro" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/mac" nil nil)
("imp" "{% import \"${1:module}\" as ${1:$(if (string-match \"/\\\\\\\\([^/]*\\\\\\\\)$\" yas-text)\n (match-string 1 yas-text)\n yas-text)} %}" "import" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/imp" nil nil)
("iif" "{% if $1 %}$0{% endif %}" "Inline if" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/iif" nil nil)
("ife" "{% if $1 %}\n $0\n{% else %}\n\n{% endif %}" "if...else" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/ife" nil nil)
("if" "{% if $1 %}\n $0\n{% endif %}" "if" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/if" nil nil)
("for" "{% for $1 in $2 %}\n `yas-selected-text`$0\n{% endfor %}" "for" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/for" nil nil)
("ext" "{% extends \"$1\" %}" "extends" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/ext" nil nil)
("def" "{% if $1 is not defined %}\n {% set $1 = $2 %}\n{% endif %}" "default value" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/def" nil nil)
("blk" "{% block $1 %}\n $0\n{% endblock %}" "block" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/blk" nil nil)
("_self" "{% import _self as ${1:`(file-name-nondirectory (file-name-sans-extension buffer-file-name))`} %}" "_self" nil nil nil "/home/chelys/projects/dotfiles/emacs/.emacs.d/snippets/twig-mode/_self" nil nil)))
;;; Do not edit! File generated at Tue Nov 22 15:37:52 2016

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: _self
# key: _self
# --
{% import _self as ${1:`(file-name-nondirectory (file-name-sans-extension buffer-file-name))`} %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: block
# key: blk
# --
{% block $1 %}
$0
{% endblock %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: default value
# key: def
# --
{% if $1 is not defined %}
{% set $1 = $2 %}
{% endif %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: extends
# key: ext
# --
{% extends "$1" %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: for
# key: for
# --
{% for $1 in $2 %}
`yas-selected-text`$0
{% endfor %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: if
# key: if
# --
{% if $1 %}
$0
{% endif %}

View file

@ -0,0 +1,9 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: if...else
# key: ife
# --
{% if $1 %}
$0
{% else %}
{% endif %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: Inline if
# key: iif
# --
{% if $1 %}$0{% endif %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: import
# key: imp
# --
{% import "${1:module}" as ${1:$(if (string-match "/\\\\([^/]*\\\\)$" yas-text)
(match-string 1 yas-text)
yas-text)} %}

View file

@ -0,0 +1,7 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: macro
# key: mac
# --
{% macro ${1:name}(${2:args}) %}
$0
{% endmacro %}

View file

@ -0,0 +1,5 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: set
# key: set
# --
{% set $1 = $2 %}