Skip to content

Instantly share code, notes, and snippets.

@jeansordes
Created August 21, 2022 17:17
Show Gist options
  • Save jeansordes/83939d3c9fb92a42fc3fe35aa7cacb5f to your computer and use it in GitHub Desktop.
Save jeansordes/83939d3c9fb92a42fc3fe35aa7cacb5f to your computer and use it in GitHub Desktop.
{
// Place your GLOBAL snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. 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.
"bootstrap input": {
"scope": "html",
"prefix": "bootstrap_input",
"body": [
"<div class=\"mb-2\">",
" <label class=\"form-label\" for=\"$2\">$1</label>",
" <input name=\"$2\" id=\"$2\" type=\"$3\" class=\"form-control\" />",
"</div>",
],
},
"bootstrap selection option": {
"scope": "html",
"prefix": "bootstrap_select_option",
"body": [
"<div class=\"col\">",
" <label class=\"form-label\" for=\"${2:field_name}\">${1:Input description}</label>",
" <select id=\"${2:field_name}\" name=\"${2:field_name}\" class=\"form-control form-select\">",
" <option value=\"\" <?= empty(\\$var['${2:field_name}']) ? 'selected' : '' ?>></option>",
" <option value=\"${3:value_option_1}\" <?= \\$var['${2:field_name}'] == '${3:value_option_1}' ? 'selected' : '' ?>>${3:value_option_1}</option>",
" </select>",
"</div>",
],
},
"material icons": {
"scope": "html",
"prefix": "i.material-icons",
"body": [
"<i class=\"material-icons\">${0:nom de l'icone}</i>",
],
},
"php tag": {
"scope": "html",
"prefix": "pp",
"body": [
"<?php $0 ?>"
],
},
"php echo tag": {
"scope": "html",
"prefix": "ppp",
"body": [
"<?= $0 ?>"
],
},
"php if block": {
"scope": "html",
"prefix": "if",
"body": [
"<?php if ($1) { ?>",
" $0",
"<?php } ?>",
]
},
"php else tag": {
"scope": "html",
"prefix": "else",
"body": [
"<?php } else { ?>",
]
},
"php foreach block": {
"scope": "html",
"prefix": "foreach",
"body": [
"<?php foreach (\\$${1:rows} as \\$${2:row}) { ?>",
" $0",
"<?php } ?>",
]
},
"php var_dump": {
"scope": "html",
"prefix": "vardump",
"body": [
"<code><pre><?php var_dump(\\$${0:var}); ?></pre></code>",
]
},
"php CUSTOM CODE comment": {
"scope": "php",
"prefix": "custom",
"body": [
"// SECTION CUSTOM CODE",
"// !SECTION CUSTOM CODE"
]
},
"sql separator": {
"scope": "sql",
"prefix": "***",
"body": [
"/**************************************************/",
],
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment