Skip to content

Instantly share code, notes, and snippets.

@developer-anuragsingh
Last active October 17, 2022 08:16
Show Gist options
  • Save developer-anuragsingh/a5f748dc4d24c3d77c52a02117a6dc26 to your computer and use it in GitHub Desktop.
Save developer-anuragsingh/a5f748dc4d24c3d77c52a02117a6dc26 to your computer and use it in GitHub Desktop.
VS Code - PHP snippets to add conditions for environment variable and developer variable
{
// HOW TO ADD COOKIE - add following code in browser's console - document.cookie = 'env=dev'
// HOW TO DELETE COOKIE - Open 'Applications' tab in browser console, then 'Cookies' tab in 'Storage' section. Find the cookie name under 'url'. Then right click on cookie name and click 'delete'
"Setup development environment": {
"prefix": "dev_env",
"body": [
"if(isset($$_COOKIE['env']) && $$_COOKIE['env'] === 'dev') {",
"$1",
"}"
],
"description": "Setup env as dev"
},
// HOW TO USE - add following code in browser's console - document.cookie = 'env=dev' & document.cookie = 'dev=anurag'
// HOW TO DELETE COOKIE - Open 'Applications' tab in browser console, then 'Cookies' tab in 'Storage' section. Find the cookie name under 'url'. Then right click on cookie name and click 'delete'
"Setup development environment & developer as anurag": {
"prefix": "dev_anurag_env",
"body": [
"if(isset($$_COOKIE['env']) && $$_COOKIE['env'] === 'dev' && isset($$_COOKIE['dev']) && $$_COOKIE['dev'] === 'anurag') {",
"$1",
"}"
],
"description": "Setup env as dev & dev as anurag",
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment