From 584a961215cd7dbf945a19cb36886ec9688fc866 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 02:57:37 +0330 Subject: [PATCH 1/9] Create coffee-adapters --- snippets/coffee-adapters | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 snippets/coffee-adapters diff --git a/snippets/coffee-adapters b/snippets/coffee-adapters new file mode 100644 index 0000000..c19aba2 --- /dev/null +++ b/snippets/coffee-adapters @@ -0,0 +1,28 @@ +'.source.coffee': + + 'Ember fixtureAdapter': + 'prefix': 'ds.fixA' + 'body': + """ + export = DS.FixtureAdapter.extend() + """ + + + 'Ember REST Adapter': + 'prefix': 'ds.resA' + 'body': + """ + _export = DS.RESTAdapter.extend( + ${1:#body} + ) + """ + + + 'Ember Active Model Adapter': + 'prefix': 'ds.actA' + 'body': + """ + _export = DS.ActiveModelAdapter.extend( + ${1:#body} + ) + """ From fb0c079e68f580a03661df7a78ade2b2ecd7da18 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 03:01:05 +0330 Subject: [PATCH 2/9] Create es6.cson --- snippets/es6.cson | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 snippets/es6.cson diff --git a/snippets/es6.cson b/snippets/es6.cson new file mode 100644 index 0000000..d6cd03f --- /dev/null +++ b/snippets/es6.cson @@ -0,0 +1,17 @@ +'.source.coffee': + + 'ES6 import syntax': + 'prefix': 'es.imp' + 'body': + """ + ${1:`import Ember from "ember";`} + ${2:`import DS from 'ember-data';`} + """ + + + 'ES6 export syntax': + 'prefix': 'es.exp' + 'body': + """ + `export default ${1:_export};` + """ From b465a34574b6f9fbee77494d2eda7041c2a4bc73 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 03:06:14 +0330 Subject: [PATCH 3/9] Rename coffee-adapters to coffee-adapters.cson --- snippets/{coffee-adapters => coffee-adapters.cson} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename snippets/{coffee-adapters => coffee-adapters.cson} (100%) diff --git a/snippets/coffee-adapters b/snippets/coffee-adapters.cson similarity index 100% rename from snippets/coffee-adapters rename to snippets/coffee-adapters.cson From bc648e1505bddbbe1aaa70b655ed594b62994265 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 03:07:27 +0330 Subject: [PATCH 4/9] Create ember-objects --- snippets/ember-objects | 219 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 snippets/ember-objects diff --git a/snippets/ember-objects b/snippets/ember-objects new file mode 100644 index 0000000..827d3fe --- /dev/null +++ b/snippets/ember-objects @@ -0,0 +1,219 @@ + +'.source.coffee': + + 'Ember Route': + 'prefix': 'em.rou' + 'body': + """ + _export = Ember.Route.extend( + model: -> + ${1:#@store.find("name_of_a_model")} + ) + + """ + + + + + 'Ember Object Controller': + 'prefix': 'em.obj' + 'body': + """ + _export = Ember.ObjectController.extend( + ${1:#body} + ) + """ + + + + + 'Ember Array Controller': + 'prefix': 'em.arr' + 'body': + """ + _export = Ember.ArrayController.extend( + ${1:itemController: 'name_of_an_objectController'} + ${2:sortProperties: ['','']} + ${3:sortAscending: false} + ${4:actions: + ${5:name}: -> + ${6:#logic...} + ${7:name2}: -> + ${8:#logic2...} + } + ) + """ + + + + + 'Ember View': + 'prefix': 'em.vie' + 'body': + """ + _export = Ember.View.extend( + tagName: ${1:"div"} + ${2:classNames: ['','']} + ${3:classNameBindings: ['','']} + ${4:eventManager: Ember.Object.create( + mouseEnter: (event, view) -> + #logic... + return + click: (event, view) -> + #logic... + return + } + ) + + """ + + + + + 'Ember Component': + 'prefix': 'em.com' + 'body': + """ + _export = Ember.Component.extend( + ${1:#body} + ) + + """ + + + + + 'Ember Mixin': + 'prefix': 'em.mix' + 'body': + """ + _export = Ember.Mixin.create( + ${1:#body} + ) + + """ + + + + + 'Ember Object': + 'prefix': 'em.obj' + 'body': """ + _export = Ember.Object.extend( + ${1:#body} + ) + + """ + + + + + 'Ember Helper': + 'prefix': 'em.hel' + 'body': """ + _export = Ember.Handlebars.makeBoundHelper(-> + ${1:#body} + ) + + """ + + + + + 'Ember Model': + 'prefix': 'ds.mod' + 'body': + """ + _export = DS.Model.extend( + ${1:title}: DS.attr(${2:"string"}) + ${3:title: DS.attr("boolean")} + ${4:title: DS.attr("number")} + ${5:title: DS.belongsTo('someModel',async: true)} + ${6:title: DS.hasMany('someModel' ,async: true)} + + ) + """ + + + + + 'Ember REST Serializer': + 'prefix': 'ds.resS' + 'body': + """ + _export = DS.RESTSerializer.extend( + ${1:#body} + ) + """ + + + + + 'Ember Active Model Serializer': + 'prefix': 'ds.actS' + 'body': + """ + _export = DS.ActiveModelSerializer.extend( + ${1:#body} + ) + """ + + + + + 'Ember Transform Serializer': + 'prefix': 'ds.tra' + 'body': + """ + _export = DS.Transforms.extend( + deserialize: (jsonFromServer) -> + jsonToApp = ${1:#logic...} + jsonToApp + + serialize: (jsonFromAppToServer) -> + go2server = ${2:#logic...} + go2server + ) + """ + + + + 'Ember Initializer': + 'prefix': 'em.ini' + 'body': + """ + _export = Ember.Application.initializer + name: "put_name_of_this_initializer_here" + ${1:after : [ + "name_of_other_initializers_to_run_first" + "name_of_other_initializers_to_run_first" + ]} + + initialize: (container, application) -> + ${2:#logic...} + return + + ${3:before : [ + "name_of_other_initializers_to_run_later" + "name_of_other_initializers_to_run_later" + ]} + + """ + + + + 'Fixture Reopen': + 'prefix': 're.fix' + 'body': """ + _export.reopenClass FIXTURES: [ + { + id: 1 + title: "learn ember" + isCompleted: true + author: [10,15,20] #hasMany + author: 12 #bolongTo + } + { + + } + ] """ From c5c2f213c619f48080069b8ee1bd38c0fd546521 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 03:09:41 +0330 Subject: [PATCH 5/9] Create coffee-functions.cson --- snippets/coffee-functions.cson | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 snippets/coffee-functions.cson diff --git a/snippets/coffee-functions.cson b/snippets/coffee-functions.cson new file mode 100644 index 0000000..cc8276e --- /dev/null +++ b/snippets/coffee-functions.cson @@ -0,0 +1,67 @@ +# Ember Functions snippets +# +# Examples +# +# `ember` +# + +'.source.coffee': + + + 'Ember Find by id': + 'prefix': 'sto.fin' + 'body': "@store.find('${1:model}', params.${1:model}_id)" + + + 'Create Record in Store': + 'prefix': 'sto.cre' + 'body': + """ + ${1:foo} = @store.createRecord('${2:modelType}', + ${3:property} : ${4:property} + ) + ${1:foo}.save() + """ + + 'delete Record in Store': + 'prefix': 'sto.del' + 'body': + """ + @store.deleteRecord('${1:modelInstance}') + """ + + 'fetch Record to Store': + 'prefix': 'sto.fet' + 'body': + """ + @store.fetch('modelType', params.post_id) + """ + + 'modelFor': + 'prefix': 'modFor' + 'body': + """ + @.modelFor('${1:theNameOfParentRoute}').filterBy(${2:properyName}) + """ + + + + 'Ember Logger Debug': + 'prefix': 'log.deb' + 'body': "Ember.Logger.debug('${1:message}')" + + 'Ember Logger Log': + 'prefix': 'log.log' + 'body': "Ember.Logger.log('${1:message}')" + + 'Ember Logger Info': + 'prefix': 'log.inf' + 'body': "Ember.Logger.info('${1:message}')" + + 'Ember Logger Warn': + 'prefix': 'log.war' + 'body': "Ember.Logger.warn('${1:message}')" + + 'Ember Logger Error': + 'prefix': 'log.err' + 'body': "Ember.Logger.error('${1:message}')" From 0cc861ad741b9b888b2888de24b2da96aeae830c Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 03:10:31 +0330 Subject: [PATCH 6/9] Rename es6.cson to es6-syntax.cson --- snippets/{es6.cson => es6-syntax.cson} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename snippets/{es6.cson => es6-syntax.cson} (100%) diff --git a/snippets/es6.cson b/snippets/es6-syntax.cson similarity index 100% rename from snippets/es6.cson rename to snippets/es6-syntax.cson From 3c97a418941d5cfa2132a2e676a7e06986ccd581 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 03:11:29 +0330 Subject: [PATCH 7/9] Rename ember-objects to coffee-ember-object --- snippets/{ember-objects => coffee-ember-object} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename snippets/{ember-objects => coffee-ember-object} (100%) diff --git a/snippets/ember-objects b/snippets/coffee-ember-object similarity index 100% rename from snippets/ember-objects rename to snippets/coffee-ember-object From f86210763f496458ebdaa7a9945328e880a8f4d9 Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Sun, 15 Feb 2015 23:45:30 +0330 Subject: [PATCH 8/9] Update coffee-ember-object fixing syntax bug --- snippets/coffee-ember-object | 108 +++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 42 deletions(-) diff --git a/snippets/coffee-ember-object b/snippets/coffee-ember-object index 827d3fe..c841a56 100644 --- a/snippets/coffee-ember-object +++ b/snippets/coffee-ember-object @@ -14,7 +14,6 @@ - 'Ember Object Controller': 'prefix': 'em.obj' 'body': @@ -22,10 +21,8 @@ _export = Ember.ObjectController.extend( ${1:#body} ) - """ - - + """ 'Ember Array Controller': 'prefix': 'em.arr' @@ -47,6 +44,8 @@ + + 'Ember View': 'prefix': 'em.vie' 'body': @@ -70,6 +69,8 @@ + + 'Ember Component': 'prefix': 'em.com' 'body': @@ -83,39 +84,49 @@ + + 'Ember Mixin': 'prefix': 'em.mix' 'body': - """ - _export = Ember.Mixin.create( - ${1:#body} - ) + """ + _export = Ember.Mixin.create( + ${1:#body} + ) + + """ + - """ 'Ember Object': 'prefix': 'em.obj' - 'body': """ - _export = Ember.Object.extend( - ${1:#body} - ) + 'body': + """ + _export = Ember.Object.extend( + ${1:#body} + ) + + """ + - """ 'Ember Helper': 'prefix': 'em.hel' - 'body': """ - _export = Ember.Handlebars.makeBoundHelper(-> - ${1:#body} - ) + 'body': + """ + _export = Ember.Handlebars.makeBoundHelper( -> + ${1:#body} + ) + + """ + - """ @@ -123,16 +134,16 @@ 'Ember Model': 'prefix': 'ds.mod' 'body': - """ - _export = DS.Model.extend( - ${1:title}: DS.attr(${2:"string"}) - ${3:title: DS.attr("boolean")} - ${4:title: DS.attr("number")} - ${5:title: DS.belongsTo('someModel',async: true)} - ${6:title: DS.hasMany('someModel' ,async: true)} + """ + _export = DS.Model.extend( + ${1:title}: DS.attr(${2:"string"}) + ${3:title: DS.attr("boolean")} + ${4:title: DS.attr("number")} + ${5:title: DS.belongsTo('someModel',async: true)} + ${6:title: DS.hasMany('someModel' ,async: true)} - ) - """ + ) + """ @@ -149,6 +160,8 @@ + + 'Ember Active Model Serializer': 'prefix': 'ds.actS' 'body': @@ -202,18 +215,29 @@ + 'Ember Utility': + 'prefix': 'utility' + 'body': + """ + _export = ${1:myUtility} -> + ${2:#body} + + """ + 'Fixture Reopen': - 'prefix': 're.fix' - 'body': """ - _export.reopenClass FIXTURES: [ - { - id: 1 - title: "learn ember" - isCompleted: true - author: [10,15,20] #hasMany - author: 12 #bolongTo - } - { - - } - ] """ + 'prefix': 'reo.fix' + 'body': + """ + _export.reopenClass FIXTURES: [ + { + id: 1 + title: "learn ember" + isCompleted: true + author: [10,15,20] #hasMany + author: 12 #bolongTo + } + { + + } + ] + """ From 80101be3b5ad176c330a7225781a3ab68fdb81db Mon Sep 17 00:00:00 2001 From: imanghafoori1 Date: Mon, 16 Feb 2015 15:20:45 +0330 Subject: [PATCH 9/9] imports separated imports separated as well as changing the prefixes. --- snippets/es6-syntax.cson | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/snippets/es6-syntax.cson b/snippets/es6-syntax.cson index d6cd03f..8056b29 100644 --- a/snippets/es6-syntax.cson +++ b/snippets/es6-syntax.cson @@ -1,16 +1,22 @@ '.source.coffee': - 'ES6 import syntax': - 'prefix': 'es.imp' + 'ES6 import Ember': + 'prefix': 'im.emb' 'body': """ ${1:`import Ember from "ember";`} - ${2:`import DS from 'ember-data';`} + """ + + 'ES6 import DS': + 'prefix': 'im.ds' + 'body': + """ + ${1:`import DS from 'ember-data';`} """ 'ES6 export syntax': - 'prefix': 'es.exp' + 'prefix': 'ex.def' 'body': """ `export default ${1:_export};`