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
MyApp = {}; | |
MyApp.vent = _.extend({}, Backbone.Events); | |
MyApp.vent.on("some:event", function(){ | |
alert("some event was fired!"); | |
}); | |
MyApp.vent.trigger("some:event"); |
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
MedicationView = Backbone.View.extend({ | |
events: { | |
"click #edit": "editMedication" | |
}, | |
editMedication: function(){ | |
var editView = new AddEditView({model: this.model}); | |
editView.render(); | |
} | |
}); |
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
[user] | |
name = Oskar Szrajer | |
email = [email protected] | |
[alias] | |
br = branch | |
co = checkout | |
ci = commit | |
df = diff | |
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 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
Backbone.Collection.prototype.getOrCreate = function(model, options) { | |
var _model; | |
// Ensure model has an id property and attempt to get out of the collection | |
if (model.id && _model = this.get(model.id)) { | |
options && options.success(_model); | |
return _model; | |
} |
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
import { Directive, Output, EventEmitter, HostListener } from '@angular/core'; | |
@Directive({ | |
selector: '[click.stop],[clickStop]' | |
}) | |
export class StopPropagationDirective { | |
@Output("click.stop") stopPropEvent = new EventEmitter(); | |
@HostListener('click', ['$event']) | |
onClick(event: Event) { |