Skip to content

Instantly share code, notes, and snippets.

@saevarom
Created November 26, 2015 13:27
Show Gist options
  • Save saevarom/633ad44832d9dfff5a82 to your computer and use it in GitHub Desktop.
Save saevarom/633ad44832d9dfff5a82 to your computer and use it in GitHub Desktop.
Sublime snippets
<snippet>
<content><![CDATA[var $1 = (function() {
// $1 model
var self = null;
// ------------------------------------------------------------
// constructor
function $1(initial_data){
this.raw_data = initial_data;
this.json = null;
// needed for private methods
self = this;
}
// ------------------------------------------------------------
// public methods
$1.prototype.get_json = function() {
return this.json;
}
// ------------------------------------------------------------
// private methods
function parse_raw_data(){
self.json = \$.parseJSON(self.raw_data);
}
// ------------------------------------------------------------
// return constructor
return $1;
})();]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>jsmodel</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
<snippet>
<content><![CDATA[_('${1:string}')]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>tran</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.ruby</scope> -->
</snippet>
<snippet>
<content><![CDATA[<%= _('${1:string}') %>]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>trans</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.ruby</scope> -->
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment