Skip to content

Instantly share code, notes, and snippets.

@cyhalothrin
Last active April 7, 2018 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cyhalothrin/b46838042cc180da5235d95dc502fb66 to your computer and use it in GitHub Desktop.
Save cyhalothrin/b46838042cc180da5235d95dc502fb66 to your computer and use it in GitHub Desktop.
VS code snippets
"require module": {
"prefix": "reqm",
"body": [
"const $1 = require('$1');"
]
},
"for array": {
"prefix": "fora",
"body": [
"for (let ${i} = 0; ${i} < ${array}.length; ${i}++) {",
" const element = ${array}[${i}];",
"}"
]
},
"for i": {
"prefix": "forx",
"body": [
"for (let ${i} = 0; ${i} < ${max}; ${i}++) {",
" ",
"}"
]
},
"console.log()": {
"prefix": "clg",
"body": "console.log($1);"
},
"if .. else": {
"prefix": "ife",
"body": [
"if ($1) {",
" ",
"} else {",
" ",
"}"
]
},
"else if": {
"prefix": "elif",
"body": [
"else if ($1) {",
" ",
"}"
]
},
"for .. in": {
"prefix": "forin",
"body": [
"for (const ${key} in ${object}) {",
" if (${object}.hasOwnProperty(${key})) {",
" const ${value} = ${object}[${key}];",
" }",
"}"
]
},
"Arrow function": {
"prefix": "arfn",
"body": [
"($1) => {",
" $2",
"}"
]
},
"Promise.all()": {
"prefix": "promall",
"body": [
"Promise.all([",
" $1",
"]);"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment