diff --git a/snippets/computed.cson b/snippets/computed.cson new file mode 100644 index 0000000..9525556 --- /dev/null +++ b/snippets/computed.cson @@ -0,0 +1,117 @@ +'.source.coffee': + + + + + 'Ember Snippets: computed properties': + 'prefix': 'computed--help' + 'body': + """ + ${1: + # snippets to generate computed properties : + # example: com.lt + # ____________________________________________________________________ + # | type shorthand -> or long version -> press tab to genetate: | + # | ------------ -> ------------ -> ------------------------- | + # | com.lt -> computed.lt -> Ember.computed.lt(... | + # | com.or -> computed.or -> Ember.computed.or(... | + # | com.gt -> computed.gt -> Ember.computed.gt(... | + # | com.and -> computed.and -> Ember.computed.and(... | + # | com.max -> computed.max -> Ember.computed.max(... | + # | com.min -> computed.min -> Ember.computed.min(... | + # | com.map -> computed.map -> Ember.computed.map(... | + # | com.mapB -> computed.mapB -> Ember.computed.mapBy(... | + # | com.fil -> computed.fil -> Ember.computed.filter(... | + # | com.filB -> computed.filB -> Ember.computed.filterBy(...| + # | com.emp -> computed.emp -> Ember.computed.empty(... | + # |____________________________________________________________________| + # + # *press to remove this quick guide. + + } + """ + + 'Ember computed greater than': + 'prefix': 'computed.gt' + 'body': "Ember.computed.gt('${1:property}', ${2:0}) ${3:# (returns a boolean)}" + + + + + 'Ember computed less than': + 'prefix': 'computed.lt' + 'body': "Ember.computed.lt('${1:property}', ${2:0}) ${3:# (returns a boolean)}" + + + + + 'Ember computed alias or ': + 'prefix': 'computed.or' + 'body': "Ember.computed.or('${1:property_1}', '${2:property_2}') ${3:# (returns a boolean)}" + + + + + 'Ember computed alias and': + 'prefix': 'computed.and' + 'body': "Ember.computed.and('${1:property_1}', '${2:property_2}') ${3:# (returns a boolean)}" + + + + + 'Ember computed alias Max': + 'prefix': 'computed.max' + 'body': "Ember.computed.max('${1:property_1}') ${2:# (returns a number)}" + + + + + 'Ember computed alias Min': + 'prefix': 'computed.min' + 'body': "Ember.computed.min('${1:property_1}') ${2:# (returns a number)}" + + + + + 'Ember computed alias map': + 'prefix': 'computed.map' + 'body': " Ember.computed.map('${1:array_property}', (item, index) -> + ${2:#example logic + altered_item = item + "some_string" + return altered_item } + + ${3:# outputs a new array} + " + + + + + 'Ember computed alias mapBy': + 'prefix': 'computed.mapBy' + 'body': " Ember.computed.mapBy('${1:array_of_objs}','${2:obj_key}') ${3:# outputs a simple array[] of items} " + + + + + 'Ember computed alias filter': + 'prefix': 'computed.filter' + 'body': + """ + Ember.computed.filter('${1:array_property}', ( item, index, array ) -> + ${2:#logic... + # return true (or false) } + """ + + + + + 'Ember computed alias filterBy': + 'prefix': 'computed.filterBy' + 'body': "Ember.computed.filterBy('${1:array_of_objs}','${2:obj_key}', ${3:value}) ${4:#returns filtered array[]}" + + + + + 'Ember computed alias empty': + 'prefix': 'computed.empty' + 'body': "Ember.computed.empty('${1:propery}') ${2:#returns boolean}" diff --git a/snippets/controller.cson b/snippets/controller.cson new file mode 100644 index 0000000..7181f10 --- /dev/null +++ b/snippets/controller.cson @@ -0,0 +1,62 @@ +'.source.coffee': + + + 'available in model': + 'prefix': 'arrayController--help' + 'body': + """ + ${1: + # you can use these snippets in a arrayController function. + # + # DS.arrayController.extend( + # example : iC + # _______________________________________________________________ + # | type shorthand -> or long version -> press tab to see: | + # | ----------- -> ------------- -> ------------------ | + # | iC -> itemController -> itemController... | + # | sP -> sortProperties -> sortProperties... | + # | sA -> sortAscending -> sortAscending... | + # |_______________________________________________________________| + # ) + # *press to remove this quick guide. + + } + """ + + + 'Ember Object Controller': + 'prefix': 'objectController' + 'body': + """ + _export = Ember.ObjectController.extend( + ${1:#body} + ) + """ + + + + + 'Ember Array Controller': + 'prefix': 'arrayController' + 'body': + """ + _export = Ember.ArrayController.extend( + ${4:actions: + ${5:name_1}: -> + ${6:#logic...} + } + ) + + """ + + 'itemController': + 'prefix': 'itemController' + 'body': "itemController : '${1:an_objController}'}" + + 'sortProperties': + 'prefix': 'sortProperties' + 'body': "sortProperties : ['${1:property}']}" + + 'sortAscending': + 'prefix': 'sortAscending' + 'body': "sortAscending : ['${1:false}']}" diff --git a/snippets/es6.cson b/snippets/es6.cson new file mode 100644 index 0000000..25860c4 --- /dev/null +++ b/snippets/es6.cson @@ -0,0 +1,74 @@ +'.source.coffee': + + 'Ember Snippets for es6 syntax': + 'prefix': 'es6--help' + 'body': + """ + ${1: + # snippets to generate --ES6 syntax-- + # example: imp-ds + # ___________________________________________________________ + # | type short (or) long version -> then press | + # | ---------- -> --------------- -> ----------------------| + # | imp-ds -> import-ds -> `import DS... ` | + # | imp-emb -> import-ember -> `import Ember... ` | + # | exp-def -> export-default -> `export default... ` | + # | es6 -> es6 -> - full set - | + # |___________________________________________________________| + } + """ + + 'ES6 import Ember': + 'prefix': 'import-ember' + 'body': + """ + `import Ember from "ember";` + ${1} + """ + + + + + 'ES6 import DS': + 'prefix': 'import-ds' + 'body': + """ + `import DS from 'ember-data';` + ${1} + """ + + + + + 'ES6 export syntax': + 'prefix': 'export-default' + 'body': + """ + + + ${2} + + + + `export default ${1:_export};` + """ + + + + + 'ES6 import and export': + 'prefix': 'es6' + 'body': + """ + ${1:`import Ember from 'ember';`} + ${2:`import DS from 'ember-data';`} + + + + ${3} + + + + `export default _export;` + + """ diff --git a/snippets/logger.cson b/snippets/logger.cson new file mode 100644 index 0000000..e71b251 --- /dev/null +++ b/snippets/logger.cson @@ -0,0 +1,51 @@ +'.source.coffee': + + 'Ember Snippets: logging functions': + 'prefix': 'logger--help' + 'body': + """ + ${1: + # snippets for Ember.Logger class : + # example : log.err + # _______________________________________________________________ + # | type these -> or long version -> press tab to generate: | + # | ----------- -> -------------- -> ------------------------ | + # | log.err -> logger.error -> Ember.Logger.error(... | + # | log.deb -> logger.debug -> Ember.Logger.debug(... | + # | log.log -> logger.log -> Ember.Logger.log(... | + # | log.inf -> logger.info -> Ember.Logger.info(... | + # | log.war -> logger.warn -> Ember.Logger.warn(... | + # |_______________________________________________________________| + # + # *press to remove this quick guide. + + } + """ + + 'Ember Logger Debug': + 'prefix': 'logger.debug' + 'body': "Ember.Logger.debug('${1:message}')" + + + + 'Ember Logger Log': + 'prefix': 'logger.log' + 'body': "Ember.Logger.log('${1:message}')" + + + + 'Ember Logger Info': + 'prefix': 'logger.info' + 'body': "Ember.Logger.info('${1:message}')" + + + + 'Ember Logger Warn': + 'prefix': 'logger.warn' + 'body': "Ember.Logger.warn('${1:message}')" + + + + 'Ember Logger Error': + 'prefix': 'logger.error' + 'body': "Ember.Logger.error('${1:message}')" diff --git a/snippets/model.cson b/snippets/model.cson new file mode 100644 index 0000000..b5cb0b1 --- /dev/null +++ b/snippets/model.cson @@ -0,0 +1,60 @@ +'.source.coffee': + + + 'available in model': + 'prefix': 'model--help' + 'body': + """ + ${1: + # you can use these snippets in a Model function. + # + # DS.Model.extend( + # example : att + # __________________________________________________________ + # | type shorthand -> or long version -> press tab to see: | + # | ----------- -> ------------- -> ------------------ | + # | att -> attr -> DS.attr(... | + # | bel -> belongsTo -> DS.belongsTo(... | + # | has -> hasMany -> DS.hasMany(... | + # |___________________________________________________________| + # ) + # *press to remove this quick guide. + } + """ + + + + + 'Ember Model': + 'prefix': 'model' + 'body': + """ + _export = DS.Model.extend( + ${1:# see more snippets by Expanding : + + # model--help${2} + # or model-h for short. + } + ) + """ + + + + + 'Ember Model attributes': + 'prefix': 'attr' + 'body': "${1}: DS.attr( 'string' ) # or 'number' , 'boolean' , 'date'" + + + + + 'Ember Model Relation: belongsTo ': + 'prefix': 'belongsTo' + 'body': "${1} : DS.belongsTo('${2:other_Model}',async: ${3:false})" + + + + + 'Ember Model Relation: hasMany': + 'prefix': 'hasMany' + 'body': "${1} : DS.hasMany('${2:other_Model}',async: ${3:false})" diff --git a/snippets/other.cson b/snippets/other.cson new file mode 100644 index 0000000..f1d4804 --- /dev/null +++ b/snippets/other.cson @@ -0,0 +1,70 @@ +'.source.coffee': + + + 'then': + 'prefix': 'then' + 'body': + """.then( (data) -> + ${1:#logic} + ) + """ + + + + 'set': + 'prefix': 'set' + 'body': "set('${1:key}','${2:val}')" + + + + + 'get': + 'prefix': 'get' + 'body':"get('${1:key}').${2}" + + + + + 'save': + 'prefix': 'save' + 'body': + """save() + ${1} """ + + + + 'create a Record()': + 'prefix': 'creatRecord' + 'body':"""creatRecord() + ${1} + """ + + + + + 'delete a Record': + 'prefix': 'deleteRecord' + 'body': "deleteRecord()${1}" + + + + + + 'controllerFor': + 'prefix': 'controllerFor' + 'body': "controllerFor( '${1}' )${2}" + + + + + + 'modelFor': + 'prefix': 'modelFor' + 'body': "modelFor( '${1}' )${2}" + + + + + 'transitionTo': + 'prefix': 'transitionTo' + 'body': "transitionTo('${1:route_name}')${2}" diff --git a/snippets/route.cson b/snippets/route.cson new file mode 100644 index 0000000..f219149 --- /dev/null +++ b/snippets/route.cson @@ -0,0 +1,61 @@ +'.source.coffee': + + + 'available in route': + 'prefix': 'route--help' + 'body': + """ + ${1: + # you can use these snippets within a + # Em.view.extend( + # example : aM + # ________________________________________________________ + # | type or long version -> press tab to see: | + # | ---- -> ---------------- -> --------------------- | + # | aM -> afterModel -> afterModel : ... | + # | bM -> beforeModel -> beforeModel : ... | + # | cN -> setupController -> setupController : ... | + # |________________________________________________________| + # + # *press to remove this quick guide. + } + """ + + + 'Ember Route': + 'prefix': 'route' + 'body': + """ + _export = Ember.Route.extend( + ${1:# see more snippets by Expanding : + # model--help (or model-h) + } + + model: -> + ${2} + ) + """ + + 'Route afterModel': + 'prefix': 'afterModel' + 'body': + """ + afterModel: (${1:model}, transition) -> + ${2:#logic...} + """ + + 'Route beforeModel': + 'prefix': 'beforeModel' + 'body': + """ + beforeModel: (transition) -> + ${1:#logic...} + """ + + 'Route setupController': + 'prefix': 'setupController' + 'body': + """ + setupController: (transition) -> + ${1:#logic...} + """ diff --git a/snippets/store.cson b/snippets/store.cson new file mode 100644 index 0000000..4c9a117 --- /dev/null +++ b/snippets/store.cson @@ -0,0 +1,124 @@ +'.source.coffee': + + + + + + 'Ember Snippets: store': + 'prefix': 'store--help' + 'body': + """ + ${1: + # ____________________________________________________________________ + # | use shorthand -> or long version -> to generate these | + # | ----------- -> ---------------- -> ------------------ | + # | sto.cre -> store.createRecord -> store.createRecord(... | + # | sto.del -> store.deleteRecord -> store.deleteRecord(... | + # | sto.fet -> store.fetch -> store.fetch(... | + # | sto.fil -> store.filter -> store.filter(... | + # | sto.pus -> store.push -> store.push(... | + # | sto.pusM -> store.pushMany -> store.pushMany(... | + # | sto.all -> store.all -> store.all(... | + # | sto.get -> store.getById -> store.getById(... | + # | sto.fin -> store.find -> store.find(... | + # |____________________________________________________________________| + } + """ + + + + + '1 Create Record in Store': + 'prefix': 'store.createRecord' + 'body': + """ + store.createRecord('${1:property}', + + ${1:key} : ${2:value} + ) + + ${3} + """ + + + + + '2 Delete Record in Store': + 'prefix': 'store.deleteRecord' + 'body': + """ + store.deleteRecord(${1:data}, + ${2} + """ + + + + + '3 Fetch Record in Store': + 'prefix': 'store.fetch' + 'body': + """ + store.fetch('${1:model_name}',${2:params.id},false) + """ + + + + + '4 Fetch Record in Store': + 'prefix': 'store.filter' + 'body': + """ + store.filter('${1:model_name}', (item) -> + #logic... + #return boolean + ) + """ + + + + + '5 Push One Record to Store': + 'prefix': 'store.push' + 'body': + """ + store.push('${1:model_name}', ${2:arr_of_objs}) + """ + + + + + '6 Push Many Records to Store': + 'prefix': 'store.pushMany' + 'body': + """ + store.pushMany('${1:model_name}', ${2:arr_of_objs}) + """ + + + + + '7 all Records from Store': + 'prefix': 'store.all' + 'body': + """ + store.all('${1:model_name}') # (only local) + """ + + + + + '8 find Records from Store': + 'prefix': 'store.getById' + 'body': + """ + store.getById('${1:model_name}', ${2:id} ) ${3:# only local} + """ + + + + '9 find Records from Store': + 'prefix': 'store.find' + 'body': + """ + store.find('${1:model_name}'${2:, id}) ${3:#find records (local & remote)} + """ diff --git a/snippets/underliners.cson b/snippets/underliners.cson new file mode 100644 index 0000000..c61a2ec --- /dev/null +++ b/snippets/underliners.cson @@ -0,0 +1,56 @@ +### + underlines are a little bit hard to type. + use can ignore tnem and instead of for example typing: + em_view_ just type emview then press tab + and underscores magically appear!!! +### + + + +'.source.coffee': + + 'em_route_': + 'prefix': 'emroute' + 'body': "em_route_" + + 'em_view_': + 'prefix': 'emview' + 'body': "em_view_" + + 'em_computed_': + 'prefix': 'emcomputed' + 'body': "em_computed_" + + + 'em_component_': + 'prefix': 'emcomponent' + 'body': "em_component_" + + + 'em_arrayController_': + 'prefix': 'emarraycontroller' + 'body': "em_arrayController_" + + 'ember_objectController_': + 'prefix': 'emobjectcontroller' + 'body': "em_objectController_" + + 'ds_model_': + 'prefix': 'dsmodel' + 'body': "ds_model_" + + 'em_logger_': + 'prefix': 'emlogger' + 'body': "em_logger_" + + 'em_es6_': + 'prefix': 'emes6' + 'body': "em_es6_" + + 'em_serializer_': + 'prefix': 'emserializer' + 'body': "em_serializer_" + + 'em_adapter_': + 'prefix': 'emadapter' + 'body': "em_adapter_" diff --git a/snippets/view.cson b/snippets/view.cson new file mode 100644 index 0000000..961532a --- /dev/null +++ b/snippets/view.cson @@ -0,0 +1,102 @@ +'.source.coffee': + + + 'available in view': + 'prefix': 'view--help' + 'body': + """ + ${1: + # you can use these snippets within a + # Em.view.extend( + # example : tN + # _____________________________________________ + # | type or long version -> press tab to see: | + # |----- -> ----------- -> ------------------ | + # | tN -> tagN -> tagNames: | + # | aB -> attributeB -> attributeBindings: | + # | cN -> classN -> classNames: | + # | cNB -> classNB -> classNameBindings: | + # | eM -> eventM -> eventManager: | + # |_____________________________________________| + # + # *press to remove this quick guide. + + } + """ + + '0 Ember View': + 'prefix': 'view' + 'body': + """ + _export = Ember.View.extend( + ${1:# to see more available snippets by Expanding : + + # view-help${2} (or view-h) + } + ) + """ + + '1 Ember event Manager': + 'prefix': 'eventManager' + 'body': + """ + eventManager: Ember.Object.create( + ${1:event} : + ${2:#logic...} + ) + """ + + + + + '2 Ember tag Names': + 'prefix': 'tagNames' + 'body': + """ + tagNames: '${1:div}' + ${2} + """ + + + + + '3 view attribute Bindings': + 'prefix': 'attributeB' + 'body': + """ + attributeBindings: ['${1}'] + ${2} + """ + + + + + '4 Ember class Names': + 'prefix': 'classN' + 'body': + """ + classNames: ['${1:class-1}','${2:class-2}'] + ${2} + """ + + + + + '5 view class Name Bindings': + 'prefix': 'classNB' + 'body': + """ + classNameBindings: ['${1}','${2}'] + ${1} : + ${2} : + """ + + + + + '6 isVisible': + 'prefix': 'isVisible' + 'body': + """ + isVisible: ${1:null} + """ diff --git a/snippets/wrappers-help.cson b/snippets/wrappers-help.cson new file mode 100644 index 0000000..bc1bd26 --- /dev/null +++ b/snippets/wrappers-help.cson @@ -0,0 +1,42 @@ +'.source.coffee': + + '1 es6': + 'prefix': 'es6-h' + 'body' : "es6--help" + + '2 view-h': + 'prefix': 'view-h' + 'body' : "view--help" + + + '3 route-h': + 'prefix': 'route-h' + 'body' : "route--help" + + + '4 model-h': + 'prefix': 'model-h' + 'body' : "model--help" + + + '5 logger-h': + 'prefix': 'logger-h' + 'body' : "logger--help" + + + '6 computed-h': + 'prefix': 'computed-h' + 'body' : "computed--help" + + + '7 store-h': + 'prefix': 'store-h' + 'body' : "store--help" + + '8 arr-h': + 'prefix': 'arr-h' + 'body' : "arrayControll--help" + + '9 obj-h': + 'prefix': 'obj-h' + 'body' : "objectControll--help" diff --git a/snippets/wrappers.cson b/snippets/wrappers.cson new file mode 100644 index 0000000..42d1ce7 --- /dev/null +++ b/snippets/wrappers.cson @@ -0,0 +1,125 @@ +'.source.coffee': + + + + + 'vie.ext wrapper with view': + 'prefix': 'vie' + 'body':"view${1}" + + 'rou.ext wrapper with route': + 'prefix': 'rou' + 'body':"route${1}" + + 'mod.ext wrapper with model': + 'prefix': 'mod' + 'body':"model${1}" + + 'arr wrapper with arrayController': + 'prefix': 'arr' + 'body':"arrayController${1}" + + 'obj wrapper with objectController': + 'prefix': 'obj' + 'body': "objectController${1}" + + + + + + + 'imp-emb wrapper with import-ember': + 'prefix': 'imp-emb' + 'body':"import-ember${1}" + + 'imp-ds wrapper with import-ds': + 'prefix': 'imp-ds' + 'body':"import-ds${1}" + + 'exp-def wrapper with export': + 'prefix': 'exp-def' + 'body' :"export-default${1}" + + + + + + 'logger.err': + 'prefix': 'log.err' + 'body' : "logger.error" + + 'logger.deb': + 'prefix': 'log.deb' + 'body' : "logger.debug" + + 'logger.log': + 'prefix': 'log.log' + 'body' : "logger.log" + + 'logger.inf': + 'prefix': 'log.inf' + 'body' : "logger.info" + + 'logger.war': + 'prefix': 'log.war' + 'body' : "logger.warn" + + + + + + + + + 'ds.attr': + 'prefix': 'att' + 'body' : "ds.attr" + + + 'ds.belongsTo': + 'prefix': 'bel' + 'body' : "ds.belongsTo" + + + 'ds.hasMany': + 'prefix': 'has' + 'body' : "ds.hasMany" + + + + + + + + 'afterModel': + 'prefix': 'aM' + 'body' : "afterModel" + + + 'beforeModel': + 'prefix': 'bM' + 'body' : "beforeModel" + + + 'setupController': + 'prefix': 'sC' + 'body' : "setupController" + + + + + + + + 'itemController': + 'prefix': 'iC' + 'body' : "sortProperties" + + + 'sortProperties': + 'prefix': 'sP' + 'body' : "sortProperties" + + 'sortAscending': + 'prefix': 'sA' + 'body' : "sortAscending"