Skip to content

Latest commit

 

History

History
548 lines (437 loc) · 8.92 KB

snippets.org

File metadata and controls

548 lines (437 loc) · 8.92 KB

Snippets Collection

emacs-lisp-mode

data argument

# -*- mode: snippet -*-
# name: data argument
# key: arg
# --
("$1" . "$2")

message

# -*- mode: snippet -*-
# name: message
# key: msg
# --
(message "%s" $1)

package

# -*- mode: snippet -*-
# name: package
# key: pack
# --
;;; package --- Summary

;;; Commentary:

;;; Code:

$0

(provide '`(file-name-sans-extension (f-filename (buffer-file-name)))`)
;;; `(f-filename (buffer-file-name))` ends here

request

# -*- mode: snippet -*-
# name: request
# key: req
# --
(request
 "$1"
 :type "$2"
 :headers '(("Authorization" . "Bearer $3"))
 :parser 'buffer-string
 :complete (cl-function
            (lambda (&key data &allow-other-keys)
              (with-output-to-temp-buffer "*request*"
                (princ data)
                (switch-to-buffer "*request*")
                (json-pretty-print-buffer)))))

go-mode

assert

# -*- mode: snippet -*-
# name: assert
# key: assert
# --
"github.com/stretchr/testify/assert"

comment

# -*- mode: snippet -*-
# name: comment
# key: TODO
# --
// TODO (`(format-time-string "%Y/%m/%d")`) [abrochard] $0

equal

# key: eq
# name: equal
# --
assert.Equal(t, $1, $2)$0

fmt

# -*- mode: snippet -*-
# name: fmt
# key: fmt
# --
fmt.Printf("\n\n[ADRIEN] $1 %+v\n\n", $1)$0

func

# -*- mode: snippet -*-
# name: func
# key: f
# --
func $1($2) $3 {
     $0
}

http

# -*- mode: snippet -*-
# name: http
# key: http
# --
w http.ResponseWriter, req *http.Request

iferr

# -*- mode: snippet -*-
# name: iferr
# key: iferr
# --
if err != nil {
   $1
}

method

# -*- mode: snippet -*-
# name: method
# key: f*
# --
func ($1) $2($3) $4 {
     $0
}

package

# -*- mode: snippet -*-
# name: package
# key: pack
# --
package `(f-base (f-dirname (buffer-file-name)))`

require

# -*- mode: snippet -*-
# name: require
# key: req
# --
require.$1(t, $0)

return

# -*- mode: snippet -*-
# name: return
# key: r
# --
return $0

tRun

# -*- mode: snippet -*-
# name: tRun
# key: trun
# --
t.Run("$1", func(t *testing.T) {
   $0
})

test

# -*- mode: snippet -*-
# name: test
# key: test
# --
func Test$1(t *testing.T) {
	$0
}

js2-mode

console

# -*- mode: snippet -*-
# name: console.log
# key: log
# --
console.log($1);

fct

# -*- mode: snippet -*-
# name: fct
# key: f
# --
($1) => {$0}

jsonnet-mode

test

# -*- mode: snippet -*-
# name: test
# key: test
# --
local Test$1() =
  assert $0;
  true;

markdown-mode

spec

# -*- mode: snippet -*-
# name: spec
# key: spec
# --
<details><summary><code>$1</code></summary>

#### Parameters

1. $0

#### Return

</details>

org-mode

collapsible-markdown-section

# -*- mode: snippet -*-
# name: collapsible-markdown-section
# key: coll
# --
#+HTML: <details> <summary> $1 </summary>
$0
#+HTML: </details>

src

# -*- mode: snippet -*-
# name: src
# key: src
# --
$0

title

# -*- mode: snippet -*-
# name: title
# key: :t
# --
#+TITLE: $0

use-package

# -*- mode: snippet -*-
# name: use-package
# key: use
# --
** Enable =$1=
  (use-package $1)

php-mode

dictionary entry

# -*- mode: snippet -*-
# name: dictionary entry
# key: dic
# --
'$1' => '$2',

do while

# -*- mode: snippet -*-
# name: do while
# key: do
# --
do {
   $1
} while ($2);

export

# -*- mode: snippet -*-
# name: export
# key: export
# --
echo '<pre>' . var_export($1, true) . '</pre>';

for loop

# -*- mode: snippet -*-
# name: for loop
# key: for
# --
for ($1 = 0; $1 < $2; $1++) {
    $3
}

foreach

# -*- mode: snippet -*-
# name: foreach
# key: foreach
# --
foreach ($1 as $2 => $3) {
        $4
}

function

# -*- mode: snippet -*-
# name: function
# key: fct
# --
/**
 * $1
 *
 * @param $2 $3
 * @return $4
 */
$5 function $1($3)
{
    $6
}

header

# -*- mode: snippet -*-
# name: header
# key: header
# --
/**
* $1
* $0
* @return $2
*/

implode

# -*- mode: snippet -*-
# name: implode
# key: implode
# --
implode($1, $2)

namespace

# key: namespace
# name: namespace
# --
namespace `(replace-regexp-in-string ".$" ";" (replace-regexp-in-string "^." "" (replace-regexp-in-string "/" "\\" (file-name-directory (buffer-file-name)) t t)))`

return

# -*- mode: snippet -*-
# name: return
# key: ret
# --
return $1;

try catch

# -*- mode: snippet -*-
# name: try catch
# key: try
# --
try {
    $1
} catch ($2 $e) {
    $3
}

var dump

# -*- mode: snippet -*-
# name: var dump
# key: dump
# --
var_dump($1); exit;

while

# -*- mode: snippet -*-
# name: while
# key: w
# --
while ($1) {
      $2
}

python-mode

class

# -*- mode: snippet -*-
# name: class
# key: class
# --
class `(s-upper-camel-case (f-no-ext (f-filename (buffer-file-name))))`:
    def __init__(self, $2):
        self.$2 = $2

    $0

def

# -*- mode: snippet -*-
# name: def
# key: def
# --
def $1($2):
    $0

dic

# -*- mode: snippet -*-
# name: dic
# key: dic
# --
'$1': '$2',

for

# -*- mode: snippet -*-
# name: for
# key: for
# --
for $1 in $2:
    $0

if

# -*- mode: snippet -*-
# name: if
# key: if
# --
if $1:
    $0

main

# -*- mode: snippet -*-
# name: main
# key: main
# --
if __name__ == "__main__":
    main()

p

# -*- mode: snippet -*-
# name: p
# key: p
# --
print('Value of $1 is "{}"'.format($1))