Skip to content

Instantly share code, notes, and snippets.

View djhojd's full-sized avatar

Claudiu Hojda djhojd

View GitHub Profile
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) {
@djhojd
djhojd / get-or-create.js
Last active August 29, 2015 14:27 — forked from tbranyen/get-or-create.js
Backbone.Collection.prototype.getOrCreate
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;
}
@djhojd
djhojd / .gitconfig
Last active August 29, 2015 14:20 — forked from gotar/.gitconfig
[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
MedicationView = Backbone.View.extend({
events: {
"click #edit": "editMedication"
},
editMedication: function(){
var editView = new AddEditView({model: this.model});
editView.render();
}
});
@djhojd
djhojd / 1.js
Created September 26, 2013 12:05 — forked from mxriverlynn/1.js
MyApp = {};
MyApp.vent = _.extend({}, Backbone.Events);
MyApp.vent.on("some:event", function(){
alert("some event was fired!");
});
MyApp.vent.trigger("some:event");