Sublime Text 3 documentation
◳
= Right Mouse Button
◰
= Left Mouse Button
⇧
= Shift
⌫
= Delete
↩
= Enter
←↑→↓
= Arrow keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* View mixin to properly cleanup dom, backbone, and custom event listeners. | |
* A view zombie killer. | |
* e.g. myView.destroy(); OR destroyable.destroy.call(myView); | |
* | |
* CAVEAT: | |
* Although custom events will stop triggering, custom event listeners | |
* are not automatically removed since the binding context is unknown. e.g. | |
* otherView.on('foo', thisView.doSomething, thisView); | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"maxcomplexity": 5, | |
"asi": true, | |
"strict": false, | |
"maxstatements": 15, | |
"maxlen": 120, | |
"maxdepth": 4, | |
"maxparams": 4, | |
"indent": 2, | |
"smarttabs": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
/** | |
* ${1:name} model | |
*/ | |
define(function(require, exports, module){ | |
var Backbone = require('backbone'); | |
return Backbone.Model.extend({ | |
defaults: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
/** | |
* ${1:name} collection | |
*/ | |
define(function(require, exports, module){ | |
var Backbone = require('backbone'), | |
${1:name} = require('models/${1:name}'), | |
Globals = require('app/globals'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
/** | |
* ${1:name} module | |
*/ | |
define(function(require, exports, module){ | |
return { | |
${0} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Mixer of mixins. | |
* A utility to copy functionality from mixins to objects. | |
*/ | |
define(['underscore'], function(lodash){ | |
// Monkey patch a destination object (i.e. Model.prototype, View.prototype, etc.) | |
// by combining member values that are object literals (e.g. events, defaults), | |
// functions (e.g. initialize), or arrays (e.g.relations). | |
// Heavily inspired by: https://github.com/onsi/cocktail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ## Merging mixin views in backbone.js ## | |
* | |
* really just more a test for tumblr gistr | |
*/ | |
/** | |
* Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. | |
**/ | |
function mergeMixin(view, mixin) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
'mocha', | |
'chai', | |
'sinon', | |
'mixer', | |
'backbone', | |
'models/mixins/weight-watcher' | |
], function(mocha, chai, sinon, mixer, Backbone, weightWatcher){ | |
// setup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* View.ready indicates when a view has rendered, returning a promise. | |
* | |
* Needs to be patched into a view's prototype due to the initialize and render methods. | |
* e.g. mixer.patch(View2.prototype, ready); | |
**/ | |
define(function(require){ | |
var jQuery = require('jquery'); | |
return { |