Skip to content

Instantly share code, notes, and snippets.

@jjgonecrypto
Created February 12, 2020 00:11
Show Gist options
  • Save jjgonecrypto/fe6f0c4a430ced9859fc9721c04a7a4d to your computer and use it in GitHub Desktop.
Save jjgonecrypto/fe6f0c4a430ced9859fc9721c04a7a4d to your computer and use it in GitHub Desktop.
JS snippets
{
/*
// Place your snippets for JavaScript React 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:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"use strict": {
"prefix": "us",
"body": ["'use strict';", "\n"]
},
"test deps": {
"prefix": "testdeps",
"body": [
"// testdeps",
"const chai = require('chai');",
"const expect = chai.expect;",
"const sinon = require('sinon');",
"chai.use(require('sinon-chai'));",
"\n"
]
},
"react test deps": {
"prefix": "rtestdeps",
"body": [
"const React = require('react');\n",
"// testdeps",
"const enzyme = require('enzyme');",
"const chai = require('chai');",
"chai.use(require('chai-enzyme')());",
"const expect = chai.expect;",
"const sinon = require('sinon');",
"chai.use(require('sinon-chai'));",
"\n"
]
},
"mocha describe": {
"prefix": "md",
"body": ["describe('$1', () => {", "\t$2", "});"]
},
"mocha before": {
"prefix": "mb",
"body": ["beforeEach(() => {", "\t$1", "});"]
},
"mocha before async": {
"prefix": "mba",
"body": ["beforeEach(async () => {", "\t$1", "});"]
},
"mocha after": {
"prefix": "ma",
"body": ["afterEach(() => {", "\t$1", "});"]
},
"mocha it": {
"prefix": "mi",
"body": ["it('$1', () => {", "\t$2", "});"]
},
"mocha it async": {
"prefix": "mia",
"body": ["it('$1', async () => {", "\t$2", "});"]
},
"mocha test": {
"prefix": "mt",
"body": ["test('$1', () => {", "\t$2", "});"]
},
"expext": {
"prefix": "e",
"body": ["expect($1).$2"]
},
"require": {
"prefix": "req",
"body": ["const $1 = require('js/bundles/$2');\n"]
},
"react": {
"prefix": "react",
"body": [
"const React = require('react');",
"const { Component, PropTypes } = React;\n"
]
},
"module.exports": {
"prefix": "me",
"body": ["module.exports = "]
},
"require backbone": {
"prefix": "rb",
"body": ["const Backbone = require('backbone');\n"]
},
"require deferred": {
"prefix": "rd",
"body": ["const Deferred = require('js/common/utils/Deferred');\n"]
},
"require benc": {
"prefix": "rbe",
"body": [
"const beforeEachNextCallstack = require('test/utils/beforeEachNextCallstack');\n"
]
},
"console.log object": {
"prefix": "cl",
"body": [
"console.log(JSON.stringify($1, null, '\\t'));\n"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment