Skip to content

Instantly share code, notes, and snippets.

@hellsan631
Created August 14, 2016 01:52
Show Gist options
  • Save hellsan631/291a226bab3d0e773080cb8e8e40ec75 to your computer and use it in GitHub Desktop.
Save hellsan631/291a226bab3d0e773080cb8e8e40ec75 to your computer and use it in GitHub Desktop.
{
  "Print to console": {
		"prefix": "log",
		"description": "Log output to console",
		"body": [
			"console.log('$1');",
			"$2"
		]
	},
  "Create basic Promise": {
		"prefix": "prom",
		"description": "create new ES6/Bluebird Promise boilerplate",
		"body": [
			"new Promise(function(resolve, reject) {",
      "  $1",
			"});"
		]
	},
  "Promise Then": {
		"prefix": "then",
		"description": "create a then after a promise",
		"body": [
			".then(function($1) {",
      "  $2",
			"})"
		]
	},
  "Promise Catch": {
		"prefix": "catc",
		"description": "create a catch after a promise",
		"body": [
			".catch(function(err) {",
      "  $1",
			"})"
		]
	},
  "Prototype": {
    "prefix": "proto",
		"description": "creates prototype boilerplate",
		"body": [
			"$1.prototype.${2} = function ${2:name}(){",
      "  $3",
			"};"
		]
	},
  "Anonomous function": {
		"prefix": "func",
    "description": "creates prototype boilerplate",
		"body": [
			"function($1) {",
      "  $2",
			"}"
		]
	},
  "Angular 1 Component": {
    "prefix": "ngd",
    "description": "angular 1 directive component boilerplate",
    "body": [
      ";(function () {",
      "  'use strict';",
      "",
      "  angular",
      "   .module('$1')",
      "   .directive('$2', ${2:componentName});",
      "",
      "  /* @ngInject */",
      "  function ${2:componentName}(multiline) {",
      "    var template = multiline(function() {/*",
      "",
      "    */});",
      "",
      "    var directive = {",
      "      restrict: 'E',",
      "      template: template,",
      "      scope: {},",
      "      bindToController: {",
      "      },",
      "      controller: Controller,",
      "      controllerAs: 'sm'",
      "    };",
      "",
      "    return directive;",
      "  }",
      "",
      "  /* @ngInject */",
      "  function Controller($state, Auth) {",
      "    var sm = this;",
      "",
      "  }",
      "})();"
    ]
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment