Skip to content

Instantly share code, notes, and snippets.

@EtienneDuv
Created December 20, 2021 11:05
Show Gist options
  • Save EtienneDuv/28f2b8c1ae4f4c8bcba33caa953f0e27 to your computer and use it in GitHub Desktop.
Save EtienneDuv/28f2b8c1ae4f4c8bcba33caa953f0e27 to your computer and use it in GitHub Desktop.
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"console.log()": {
"prefix": "cl",
"body": [
"console.log($1)"
],
"description": "console.log()"
},
"Object.keys()": {
"prefix": "ok",
"body": [
"Object.keys($1)"
],
"description": "Object.keys()"
},
"Logger": {
"prefix": "cll",
"body": [
"// ------------------------------------------------------------------------------------------",
";[('\\n'+'====='.repeat(15)).repeat(2) + ' ${RELATIVE_FILEPATH/[\\\\]/\\//g}:$TM_LINE_NUMBER',",
"$1",
"].forEach(el => console.log(el));",
"// ------------------------------------------------------------------------------------------",
],
"description": "Gros bloc en console"
},
"Now date": {
"prefix": "now",
"body": [
"new Date().toISOString().substr(11, 8)",
],
"description": "Today's date"
},
"Divider": {
"prefix": "---",
"body": [
"// ----------------------------------",
"// $1",
"// ----------------------------------",
],
"description": "Divider"
},
"Test template": {
"prefix": "initest",
"body": [
"describe('${TM_FILENAME_BASE}', function () {",
"\tbefore(async function () {}); ",
"\n",
"\tafter(async function () {",
"\t\tawait this.data.cleanModels(this);",
"});",
"\n",
"\tit('should ______________', async function () {});",
"});"
],
"description": "Test template"
},
//
// CUSTOM SHORTCUTS
//
"Selection to Object": {
"body": [
"{\n'${TM_SELECTED_TEXT}': ${TM_SELECTED_TEXT},\n}",
],
"description": "Divider"
},
"\\n Before After": {
"body": [
"\n${TM_SELECTED_TEXT}\n",
],
"description": "Divider"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment