previousAttributes internally uses _.clone(). Previous attributes are only shallow copies so nested objects will be references. This means nested objects will show the current state of the object not the previous!
This file contains 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
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
This file contains 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
openItem: function(item, e){...} |
This file contains 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 | |
Myview = Backbone.View.extend({ | |
events: { | |
"click .item": "openItem" | |
} | |
… | |
openItem: function(e) { | |
var item = this.collection.get($(e.eventTarget).attr("data-cid")); | |
... | |
} |
This file contains 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 Usage | |
// events: { | |
// "click .message": withModel("messageOverlay") | |
// }, | |
function withModel(callback) { | |
return function(e) { | |
var model = this.collection.getByCid($(e.currentTarget).attr("data-cid")); | |
this[callback](model, e); | |
}; |
This file contains 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
# CoffeeScript version | |
params[@options.param] = if model[@options.untilAttr]?() then model[@options.untilAttr]() else model.get(@options.untilAttr) | |
# Compiled version | |
params[_this.options.param] = (typeof model[_name = _this.options.untilAttr] === "function" ? model[_name]() : void 0) ? model[_this.options.untilAttr]() : model.get(_this.options.untilAttr); | |
# Original JS version | |
params[self.options.param] = typeof(model[self.options.untilAttr]) === "function" ? model[self.options.untilAttr]() : model.get(self.options.untilAttr); |
This file contains 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
@destroy = => | |
$target.off("scroll", @watchScroll) | |
return | |
@enableFetch = -> | |
fetchOn = true | |
return | |
@disableFetch = -> | |
fetchOn = false |
This file contains 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
this.destroy = function() { | |
return $target.off("scroll", _this.watchScroll); | |
}; | |
this.enableFetch = function() { | |
return fetchOn = true; | |
}; | |
this.disableFetch = function() { | |
return fetchOn = false; | |
}; |
This file contains 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
[ | |
{ "keys": ["super+shift+y"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["super+shift+n"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, | |
{ "keys": ["super+y"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, | |
{ "keys": ["super+d"], "command": "duplicate_line" }, | |
{ "keys": ["super+shift+v"], "command": "paste" }, | |
{ "keys": ["super+v"], "command": "paste_and_indent" } | |
] |
This file contains 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
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"ensure_newline_at_eof_on_save": true, | |
"font_size": 16.0, | |
"save_on_focus_lost": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"spell_check": true, | |
"fade_fold_buttons": true, | |
"highlight_line": false, |
NewerOlder