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
// With reference to http://stackoverflow.com/a/20951085/605840 | |
// Directives are just factories, so just override your directive | |
// with "Directive" suffix. | |
beforeEach(function () { | |
module(function ($provide) { | |
$provide.factory('starBoxDirective', function () { | |
// Make sure to return an array of objects | |
return [{ | |
// Directive Definition Object |
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
// Dependency: underscore.js or lodash | |
angular.module('ps.modalOpen') | |
.config(function ($provide) { | |
'use strict'; | |
// Use decorator to add new functionality | |
$provide.decorator('$modal', function ($controller, $delegate, $injector, $q, $rootScope) { | |
// Add new open() method |
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
angular.module('ps.modalOpen') | |
.config(function ($provide) { | |
'use strict'; | |
// Use decorator to add new functionality | |
$provide.decorator('$modal', function ($controller, $delegate, $injector, $q, $rootScope) { | |
// Add new open() method | |
$delegate.open = open; |
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
#!/usr/bin/env bash | |
git config --global alias.co checkout | |
git config --global alias.br branch | |
git config --global alias.ci commit | |
git config --global alias.st "status -sb" | |
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
git config --global alias.lol "log --graph --decorate --oneline" | |
git config --global alias.lola "log --graph --decorate --oneline --all" |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
normal: Ember.String.htmlSafe('awesome!'), | |
copied: Ember.copy(Ember.String.htmlSafe('awesome!')), | |
deeply: Ember.copy(Ember.String.htmlSafe('awesome!'), true) | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
init() { | |
const foo = this.get('store').createRecord('foo', { | |
text: '<b>foo</b>' | |
}); | |
this.set('foo', foo); | |
}, |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
items: Ember.computed(() => []), | |
actions: { | |
addItem() { | |
const items = this.get('items'); | |
items.pushObject(`Item ${items.length}`); | |
} |
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
import Ember from 'ember'; | |
import Changeset from 'ember-changeset'; | |
import { validatePresence } from 'ember-changeset-validations/validators'; | |
import lookupValidator from 'ember-changeset-validations'; | |
export default Ember.Controller.extend({ | |
init() { | |
this._super(...arguments); | |
const model = Ember.get(this, 'user'); | |
const validation = Ember.get(this, 'validation'); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
unknownProperty(key) { | |
if (key === 'foo') { | |
return 'i am foo'; | |
} | |
return undefined; | |
} |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
// Change this to view the effect | |
isDisabled: false | |
}); |
OlderNewer