PageRenderTime 25ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/elisp/personal/yasnippet-perso.el

https://code.google.com/p/marcshacks/
Emacs Lisp | 162 lines | 151 code | 11 blank | 0 comment | 2 complexity | 098f79785a77354de141ae15922ac3f9 MD5 | raw file
  1. (yas/define-snippets 'apache-mode
  2. '(("vh" "<VirtualHost *:80>
  3. ServerName $1
  4. ServerAdmin webmaster@$1
  5. $0
  6. DocumentRoot \"$2\"
  7. <Directory \"$2\">
  8. Order allow,deny
  9. Allow from all
  10. </Directory>
  11. ErrorLog logs/$1-error_log
  12. CustomLog logs/$1_log common
  13. </VirtualHost>
  14. "
  15. "default virtual host" nil nil)
  16. ("vh.1" "<VirtualHost *:80>
  17. ServerName $1
  18. ServerAdmin webmaster@$1
  19. $0
  20. WSGIScriptAlias / \"$2/apache/django.wsgi\"
  21. <Directory \"$2/apache\">
  22. Order allow,deny
  23. Allow from all
  24. </Directory>
  25. Alias /static \"$3\"
  26. <Directory \"$3\">
  27. Order allow,deny
  28. Allow from all
  29. </Directory>
  30. ErrorLog logs/$1-error_log
  31. CustomLog logs/$1_log common
  32. </VirtualHost>
  33. "
  34. "wsgi virtual host" nil nil)
  35. ("directory" " <DirectoryMatch \.(svn|git|hg)>
  36. Order allow,deny
  37. Deny from all
  38. </DirectoryMatch>"))
  39. 'text-mode)
  40. (yas/define-snippets 'php-mode
  41. '(("public" "public function execute$1(sfWebRequest $request) {
  42. $0;
  43. }" "public function" nil nil )
  44. ("function" "function $1($2) {
  45. $0;
  46. }" "function" nil nil)
  47. ("this" "$this->$0" "access this" nil nil)
  48. ("array" "array('$1' => $0)" "create array" nil nil)
  49. ("req" "$request" "request" nil nil)
  50. ("__" "<?php echo __(\"$0\") ?>" "translate" nil nil)))
  51. (yas/define-snippets 'espresso-mode
  52. '(("tim" "setTimeout(function($1) {
  53. return $0;
  54. }, $2);" "setTimeout" nil nil)
  55. ("tim.1" "setInterval(function($1) {
  56. return $0;
  57. }, $2);" "setInterval" nil nil)
  58. ("fun" "function $1($2) {
  59. return $0;
  60. }" "function" nil nil)
  61. ("fun.1" "function($1) {
  62. return $0;
  63. }" "anonymous function" nil nil)
  64. ("und" "\"undefined\"$0" "undefined" nil nil)
  65. ("$" "$(\"$1\").$2($0)" "jquery call"))
  66. 'cc-mode)
  67. (yas/define-snippets 'css-mode
  68. '(("class" ".$1 {
  69. $2: $3;$0
  70. }" "create class" nil nil)
  71. ("prop" " $1: $2;$0" "add property" nil nil)))
  72. (yas/define-snippets 'html-mode
  73. '(("button" "<button class=\"$1\">$0</button>" "button" nil nil)
  74. ("this" "$this->$0" "access this" nil nil)
  75. ("tra" "{% trans \"$0\" %}" "django trans" nil nil)
  76. ("array" "array('$1' => $0)" "create array" nil nil)
  77. ("__" "<?php echo __(\"$0\") ?>" "translate" nil nil)
  78. ("slot" "<?php slot(\"$1\", \"$0\") ?>" "insert slot" nil nil)
  79. ("auto" "${1:FIELDNAME} = models.AutoField()" "auto" nil nil nil nil nil)
  80. ("autoescape" "{% autoescape ${1:off} %}\n $2\n{% endautoescape %}" "autoescape" nil nil nil nil nil)
  81. ("block" "{% block $1 %}\n $2\n{% endblock $1 %}" "block" nil nil nil nil nil)
  82. ("blocktrans" "{% blocktrans ${1:with ${2:var1} as ${3:var2}} %}\n $4{{ $3 }}\n{% endblocktrans %}" "blocktrans" nil nil nil nil nil)
  83. ("boolean" "${1:FIELDNAME} = models.BooleanField(${2:default=True})" "boolean" nil nil nil nil nil)
  84. ("char" "${1:FIELDNAME} = models.CharField(${2:blank=True, }max_length=${3:255})" "char" nil nil nil nil nil)
  85. ("commaseparatedinteger" "${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=$2)" "commaseparatedinteger" nil nil nil nil nil)
  86. ("comment" "{% comment %}\n $1\n{% endcomment %}" "comment" nil nil nil nil nil)
  87. ("cycle" "{% cycle $1 as $2 %}" "cycle" nil nil nil nil nil)
  88. ("date" "${1:FIELDNAME} = models.DateField(2:blank=True, null=True, }${3:auto_now_add=True})" "date" nil nil nil nil nil)
  89. ("datetime" "${1:FIELDNAME} = models.DateTimeField(${2:blank=True, null=True, }${3:auto_now_add=True})" "datetime" nil nil nil nil nil)
  90. ("debug" "<pre>\n{% debug %}\n</pre>" "debug" nil nil nil nil nil)
  91. ("decimal" "${1:FIELDNAME} = models.DecimalField(max_digits=$2, decimal_places=$3)" "decimal" nil nil nil nil nil)
  92. ("email" "${1:FIELDNAME} = models.EmailField()" "email" nil nil nil nil nil)
  93. ("extends" "{% extends '${1:base.html}' %}" "extends" nil nil nil nil nil)
  94. ("file" "${1:FIELDNAME} = models.FileField(upload_to=${1:/path/for/upload})" "file" nil nil nil nil nil)
  95. ("filepath" "${1:FIELDNAME} = models.FilePathField(path=\"${1:/location/of/choices}\"${2:, match=\"${3:regex}\"}${4:, recursive=True})" "filepath" nil nil nil nil nil)
  96. ("filter" "{% filter $1 %}\n $2\n{% endfilter %}" "filter" nil nil nil nil nil)
  97. ("firstof" "{% firstof $1 %}" "firstof" nil nil nil nil nil)
  98. ("fk" "${1:FIELDNAME} = models.ForeignKey(${2:RELATED_MODEL})" "fk" nil nil nil nil nil)
  99. ("float" "${1:FIELDNAME} = models.FloatField()" "float" nil nil nil nil nil)
  100. ("for" "{% for $1 in $2 %}\n $3\n{% endfor %}" "for" nil nil nil nil nil)
  101. ("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)
  102. ("if" "{% else %}" "if" nil nil nil nil nil)
  103. ("ifchanged" "{% ifchanged $1%}$2{% endifchanged %}" "ifchanged" nil nil nil nil nil)
  104. ("ifequal" "{% ifequal $1 $2 %}\n $3\n{% endifequal %}" "ifequal" nil nil nil nil nil)
  105. ("ifnotequal" "{% ifnotequal $1 $2 %}\n $3\n{% endifnotequal %}" "ifnotequal" nil nil nil nil nil)
  106. ("image" "${1:FIELDNAME} = models.ImageField(upload_to=\"${2:/dir/path}\"${3:, height_field=$4}${5:, width_field=$6})" "image" nil nil nil nil nil)
  107. ("include" "{% include ${1:\"$2\"} %}" "include" nil nil nil nil nil)
  108. ("integer" "${1:FIELDNAME} = models.IntegerField(${2:blank=True, null=True})" "integer" nil nil nil nil nil)
  109. ("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)
  110. ("ip" "${1:FIELDNAME} = models.IPAddressField(${2:blank=True})" "ip" nil nil nil nil nil)
  111. ("load" "{% load $1 %}" "load" nil nil nil nil nil)
  112. ("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)
  113. ("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)
  114. ("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)
  115. ("mtm" "${1:FIELDNAME} = models.ManyToManyField(${2:RELATED_MODEL})" "mtm" nil nil nil nil nil)
  116. ("now" "{% now \"$1\" %}" "now" nil nil nil nil nil)
  117. ("nullboolean" "${1:FIELDNAME} = models.NullBooleanField(${2:default=True})" "nullboolean" nil nil nil nil nil)
  118. ("positiveinteger" "${1:FIELDNAME} = models.PositiveIntegerField(${2:blank=True, null=True})" "positiveinteger" nil nil nil nil nil)
  119. ("positivesmallinteger" "${1:FIELDNAME} = models.PositiveSmallIntegerField(${2:blank=True, null=True})" "positivesmallinteger" nil nil nil nil nil)
  120. ("regroup" "{% regroup $1 by $2 as $3 %}" "regroup" nil nil nil nil nil)
  121. ("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)
  122. ("slug" "${1:slug} = models.SlugField()" "slug" nil nil nil nil nil)
  123. ("smallinteger" "${1:FIELDNAME} = models.SmallIntegerField(${2:blank=True, null=True})" "smallinteger" nil nil nil nil nil)
  124. ("spaceless" "{% spaceless %}\n $1\n{% endspaceless %}" "spaceless" nil nil nil nil nil)
  125. ("ssi" "{% ssi $1 ${2:parsed} %}" "ssi" nil nil nil nil nil)
  126. ("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)
  127. ("super" "{{ block.super }}" "super" nil nil nil nil nil)
  128. ("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)
  129. ("text" "${1:FIELDNAME} = models.TextField(${2:blank=True})" "text" nil nil nil nil nil)
  130. ("time" "${1:FIELDNAME} = models.TimeField(${2:blank=True})" "time" nil nil nil nil nil)
  131. ("trans" "{% trans \"${1:string to translate}\" %}" "trans" nil nil nil nil nil)
  132. ("url" "{% url $1 as $2 %}" "url" nil nil nil nil nil)
  133. ("widthratio" "{% widthratio ${1:this_value} ${2:max_value} ${3:100} %}" "widthratio" nil nil nil nil nil)
  134. ("with" "{% with $1 as $2 %}\n $3\n{% endwith %}" "with" nil nil nil nil nil)
  135. ("xml" "${1:FIELDNAME} = models.XMLField(schema_path=${2:/path/to/RelaxNG}${3:, blank=True})" "xml" nil nil nil nil nil)))
  136. (yas/define-snippets 'python-mode
  137. '(("wsgi" "import os, sys
  138. sys.path.append('$1')
  139. os.environ['DJANGO_SETTINGS_MODULE'] = '$2.settings'
  140. import django.core.handlers.wsgi
  141. application = django.core.handlers.wsgi.WSGIHandler()
  142. $0
  143. from werkzeug.debug import DebuggedApplication
  144. application = DebuggedApplication(application, evalex=True)" "django wsgi")
  145. ("settings" "ROOTDIR = os.path.dirname(__file__)
  146. DEBUG_PROPAGATE_EXCEPTIONS = True
  147. AUTH_PROFILE_MODULE = 'main.profile'
  148. MEDIA_ROOT = ROOTDIR+'/static/'
  149. MEDIA_URL = '/static'
  150. ADMIN_MEDIA_PREFIX = MEDIA_URL+'/adminmedia/'")
  151. ("pwd" "os.path.dirname(__file__)$0" "directory of the file")) nil)