/elisp/personal/yasnippet-perso.el
Emacs Lisp | 162 lines | 151 code | 11 blank | 0 comment | 2 complexity | 098f79785a77354de141ae15922ac3f9 MD5 | raw file
- (yas/define-snippets 'apache-mode
- '(("vh" "<VirtualHost *:80>
- ServerName $1
- ServerAdmin webmaster@$1
- $0
- DocumentRoot \"$2\"
- <Directory \"$2\">
- Order allow,deny
- Allow from all
- </Directory>
-
- ErrorLog logs/$1-error_log
- CustomLog logs/$1_log common
- </VirtualHost>
- "
- "default virtual host" nil nil)
-
- ("vh.1" "<VirtualHost *:80>
- ServerName $1
- ServerAdmin webmaster@$1
- $0
- WSGIScriptAlias / \"$2/apache/django.wsgi\"
- <Directory \"$2/apache\">
- Order allow,deny
- Allow from all
- </Directory>
-
- Alias /static \"$3\"
- <Directory \"$3\">
- Order allow,deny
- Allow from all
- </Directory>
-
- ErrorLog logs/$1-error_log
- CustomLog logs/$1_log common
- </VirtualHost>
- "
- "wsgi virtual host" nil nil)
- ("directory" " <DirectoryMatch \.(svn|git|hg)>
- Order allow,deny
- Deny from all
- </DirectoryMatch>"))
- 'text-mode)
-
- (yas/define-snippets 'php-mode
- '(("public" "public function execute$1(sfWebRequest $request) {
- $0;
- }" "public function" nil nil )
- ("function" "function $1($2) {
- $0;
- }" "function" nil nil)
- ("this" "$this->$0" "access this" nil nil)
- ("array" "array('$1' => $0)" "create array" nil nil)
- ("req" "$request" "request" nil nil)
- ("__" "<?php echo __(\"$0\") ?>" "translate" nil nil)))
-
- (yas/define-snippets 'espresso-mode
- '(("tim" "setTimeout(function($1) {
- return $0;
- }, $2);" "setTimeout" nil nil)
- ("tim.1" "setInterval(function($1) {
- return $0;
- }, $2);" "setInterval" nil nil)
- ("fun" "function $1($2) {
- return $0;
- }" "function" nil nil)
- ("fun.1" "function($1) {
- return $0;
- }" "anonymous function" nil nil)
- ("und" "\"undefined\"$0" "undefined" nil nil)
- ("$" "$(\"$1\").$2($0)" "jquery call"))
- 'cc-mode)
-
- (yas/define-snippets 'css-mode
- '(("class" ".$1 {
- $2: $3;$0
- }" "create class" nil nil)
- ("prop" " $1: $2;$0" "add property" nil nil)))
-
- (yas/define-snippets 'html-mode
- '(("button" "<button class=\"$1\">$0</button>" "button" nil nil)
- ("this" "$this->$0" "access this" nil nil)
- ("tra" "{% trans \"$0\" %}" "django trans" nil nil)
- ("array" "array('$1' => $0)" "create array" nil nil)
- ("__" "<?php echo __(\"$0\") ?>" "translate" nil nil)
- ("slot" "<?php slot(\"$1\", \"$0\") ?>" "insert slot" nil nil)
- ("auto" "${1:FIELDNAME} = models.AutoField()" "auto" nil nil nil nil nil)
- ("autoescape" "{% autoescape ${1:off} %}\n $2\n{% endautoescape %}" "autoescape" nil nil nil nil nil)
- ("block" "{% block $1 %}\n $2\n{% endblock $1 %}" "block" nil nil nil nil nil)
- ("blocktrans" "{% blocktrans ${1:with ${2:var1} as ${3:var2}} %}\n $4{{ $3 }}\n{% endblocktrans %}" "blocktrans" nil nil nil nil nil)
- ("boolean" "${1:FIELDNAME} = models.BooleanField(${2:default=True})" "boolean" nil nil nil nil nil)
- ("char" "${1:FIELDNAME} = models.CharField(${2:blank=True, }max_length=${3:255})" "char" nil nil nil nil nil)
- ("commaseparatedinteger" "${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=$2)" "commaseparatedinteger" nil nil nil nil nil)
- ("comment" "{% comment %}\n $1\n{% endcomment %}" "comment" nil nil nil nil nil)
- ("cycle" "{% cycle $1 as $2 %}" "cycle" nil nil nil nil nil)
- ("date" "${1:FIELDNAME} = models.DateField(2:blank=True, null=True, }${3:auto_now_add=True})" "date" nil nil nil nil nil)
- ("datetime" "${1:FIELDNAME} = models.DateTimeField(${2:blank=True, null=True, }${3:auto_now_add=True})" "datetime" nil nil nil nil nil)
- ("debug" "<pre>\n{% debug %}\n</pre>" "debug" nil nil nil nil nil)
- ("decimal" "${1:FIELDNAME} = models.DecimalField(max_digits=$2, decimal_places=$3)" "decimal" nil nil nil nil nil)
- ("email" "${1:FIELDNAME} = models.EmailField()" "email" nil nil nil nil nil)
- ("extends" "{% extends '${1:base.html}' %}" "extends" nil nil nil nil nil)
- ("file" "${1:FIELDNAME} = models.FileField(upload_to=${1:/path/for/upload})" "file" nil nil nil nil nil)
- ("filepath" "${1:FIELDNAME} = models.FilePathField(path=\"${1:/location/of/choices}\"${2:, match=\"${3:regex}\"}${4:, recursive=True})" "filepath" nil nil nil nil nil)
- ("filter" "{% filter $1 %}\n $2\n{% endfilter %}" "filter" nil nil nil nil nil)
- ("firstof" "{% firstof $1 %}" "firstof" nil nil nil nil nil)
- ("fk" "${1:FIELDNAME} = models.ForeignKey(${2:RELATED_MODEL})" "fk" nil nil nil nil nil)
- ("float" "${1:FIELDNAME} = models.FloatField()" "float" nil nil nil nil nil)
- ("for" "{% for $1 in $2 %}\n $3\n{% endfor %}" "for" nil nil nil nil nil)
- ("form" "class ${1:Formname}(forms.Form):\n \"\"\"${2:($1 description)}\"\"\"\n ${3:def __init__(self, *args, **kwargs):\n ${4:}\n super($1, self).__init__(*args, **kwargs)}\n\n $0\n\n ${5:def clean_${6:fieldname}(self):\n $7\n return self.cleaned_data['$6']}\n\n ${8:def clean(self):\n $9\n return self.cleaned_data}\n" "form" nil nil nil nil nil)
- ("if" "{% else %}" "if" nil nil nil nil nil)
- ("ifchanged" "{% ifchanged $1%}$2{% endifchanged %}" "ifchanged" nil nil nil nil nil)
- ("ifequal" "{% ifequal $1 $2 %}\n $3\n{% endifequal %}" "ifequal" nil nil nil nil nil)
- ("ifnotequal" "{% ifnotequal $1 $2 %}\n $3\n{% endifnotequal %}" "ifnotequal" nil nil nil nil nil)
- ("image" "${1:FIELDNAME} = models.ImageField(upload_to=\"${2:/dir/path}\"${3:, height_field=$4}${5:, width_field=$6})" "image" nil nil nil nil nil)
- ("include" "{% include ${1:\"$2\"} %}" "include" nil nil nil nil nil)
- ("integer" "${1:FIELDNAME} = models.IntegerField(${2:blank=True, null=True})" "integer" nil nil nil nil nil)
- ("intermediate" "class ${1:Modelname}(models.Model):\n \"\"\"${2:($1 description)}\"\"\"\n ${3:target_field_name} = models.ForeignKey(${4:TargetModel})\n ${5:source_field_name} = models.ForeignKey(${6:SourceModel})\n $0\n" "intermediate" nil nil nil nil nil)
- ("ip" "${1:FIELDNAME} = models.IPAddressField(${2:blank=True})" "ip" nil nil nil nil nil)
- ("load" "{% load $1 %}" "load" nil nil nil nil nil)
- ("model" "class ${1:Modelname}(models.Model):\n \"\"\"${2:($1 description)}\"\"\"\n $0\n\n ${3:class Meta:\n ordering = [${4:}]\n verbose_name, verbose_name_plural = \"${5:}\", \"${6:$5s}\"}\n\n def __unicode__(self):\n return ${7:u\"$1\"}\n\n ${8:@models.permalink\n def get_absolute_url(self):\n return ('${9:$1}', [${10:self.id}])}" "model" nil nil nil nil nil)
- ("modeladmin" "class ${1:ModelName}Admin(admin.ModelAdmin):\n ${2:date_hierarchy = '${3:}'}\n ${4:list_display = (${5:})}\n ${6:list_filter = (${7:})}\n ${8:search_fields = [${9:}]}\n\n ${10:fieldsets = (${11:})}\n \n ${12:save_as = True}\n ${13:save_on_top = True}\n ${14:inlines = [${15:}]}\n\nadmin.site.register($1, $1Admin)" "modeladmin" nil nil nil nil nil)
- ("modelform" "class ${1:ModelnameForm}(forms.ModelForm):\n $0\n\n ${3:def clean_${4:fieldname}(self):\n $5\n return self.cleaned_data['$4']}\n\n ${6:def clean(self):\n ${7:}\n return self.cleaned_data}\n\n ${8:def save(self):\n super($1, self).save()\n ${9:}}" "modelform" nil nil nil nil nil)
- ("mtm" "${1:FIELDNAME} = models.ManyToManyField(${2:RELATED_MODEL})" "mtm" nil nil nil nil nil)
- ("now" "{% now \"$1\" %}" "now" nil nil nil nil nil)
- ("nullboolean" "${1:FIELDNAME} = models.NullBooleanField(${2:default=True})" "nullboolean" nil nil nil nil nil)
- ("positiveinteger" "${1:FIELDNAME} = models.PositiveIntegerField(${2:blank=True, null=True})" "positiveinteger" nil nil nil nil nil)
- ("positivesmallinteger" "${1:FIELDNAME} = models.PositiveSmallIntegerField(${2:blank=True, null=True})" "positivesmallinteger" nil nil nil nil nil)
- ("regroup" "{% regroup $1 by $2 as $3 %}" "regroup" nil nil nil nil nil)
- ("sendmail" "mail.send_mail(\"${1:Subject}\", \"${2:Message}\", \"${3:from@example.com}\", ${4:[\"to@example.com\"]}${5:, fail_silently=True})\n" "sendmail" nil nil nil nil nil)
- ("slug" "${1:slug} = models.SlugField()" "slug" nil nil nil nil nil)
- ("smallinteger" "${1:FIELDNAME} = models.SmallIntegerField(${2:blank=True, null=True})" "smallinteger" nil nil nil nil nil)
- ("spaceless" "{% spaceless %}\n $1\n{% endspaceless %}" "spaceless" nil nil nil nil nil)
- ("ssi" "{% ssi $1 ${2:parsed} %}" "ssi" nil nil nil nil nil)
- ("stackedinline" "class ${1:ModelName}Inline(admin.StackedInline):\n model = ${2:$1}\n ${3:extra = ${4:}}\n ${5:max_num = ${6:}}\n $0\n" "stackedinline" nil nil nil nil nil)
- ("super" "{{ block.super }}" "super" nil nil nil nil nil)
- ("tabinline" "class ${1:ModelName}Inline(admin.TabularInline):\n model = ${2:$1}\n ${3:extra = ${4:}}\n ${5:max_num = ${6:}}\n $0\n" "tabinline" nil nil nil nil nil)
- ("text" "${1:FIELDNAME} = models.TextField(${2:blank=True})" "text" nil nil nil nil nil)
- ("time" "${1:FIELDNAME} = models.TimeField(${2:blank=True})" "time" nil nil nil nil nil)
- ("trans" "{% trans \"${1:string to translate}\" %}" "trans" nil nil nil nil nil)
- ("url" "{% url $1 as $2 %}" "url" nil nil nil nil nil)
- ("widthratio" "{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}" "widthratio" nil nil nil nil nil)
- ("with" "{% with $1 as $2 %}\n $3\n{% endwith %}" "with" nil nil nil nil nil)
- ("xml" "${1:FIELDNAME} = models.XMLField(schema_path=${2:/path/to/RelaxNG}${3:, blank=True})" "xml" nil nil nil nil nil)))
-
- (yas/define-snippets 'python-mode
- '(("wsgi" "import os, sys
- sys.path.append('$1')
- os.environ['DJANGO_SETTINGS_MODULE'] = '$2.settings'
- import django.core.handlers.wsgi
-
- application = django.core.handlers.wsgi.WSGIHandler()
- $0
- from werkzeug.debug import DebuggedApplication
- application = DebuggedApplication(application, evalex=True)" "django wsgi")
- ("settings" "ROOTDIR = os.path.dirname(__file__)
- DEBUG_PROPAGATE_EXCEPTIONS = True
- AUTH_PROFILE_MODULE = 'main.profile'
-
- MEDIA_ROOT = ROOTDIR+'/static/'
- MEDIA_URL = '/static'
- ADMIN_MEDIA_PREFIX = MEDIA_URL+'/adminmedia/'")
- ("pwd" "os.path.dirname(__file__)$0" "directory of the file")) nil)