Skip to content

Instantly share code, notes, and snippets.

@tzechienchu
Last active October 27, 2016 01:48
Show Gist options
  • Save tzechienchu/b4e84092e2c466943b1a9eedc5c30db5 to your computer and use it in GitHub Desktop.
Save tzechienchu/b4e84092e2c466943b1a9eedc5c30db5 to your computer and use it in GitHub Desktop.
VSC Javascript snippet
{
"coRoutine": {
"prefix": "coBody",
"body": [
"co(function*() {",
" cb(null,'ToDo');",
"})",
".catch(function(err){",
" cb(null,{err:err});",
"})"
],
"description": "co body"
},
"remoteMethod":{
"prefix": "remoteBody",
"body": [
"user.remoteMethod(",
" 'getUsersData',",
" {",
" http: {verb: 'get'},",
" accepts: [",
" {arg: 'ownerId', type: 'string', required: true, description:'onwerId'}",
" ],",
" returns: {arg: 'response', type: 'object'},",
" description:'Get userData from userId in an Array'",
" }",
")"
],
"description": "remoteMethod body"
},
"singleton":{
"prefix":"singleton",
"body":[
"var DataGenerator = (function () {",
" var instance;",
" function init() {",
" return {",
" }",
" }",
" return {",
" getInstance: function () {",
" if ( !instance ) {",
" instance = init();",
" }",
" return instance;",
" }",
" };",
"})();",
"module.exports = DataGenerator;"
],
"description": "singleton body"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment