Skip to content

Instantly share code, notes, and snippets.

Gabor Babicz zeppelin

Block or report user

Report or block zeppelin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View conventional-test-selectors.ts
test('createTestSelector', function(assert) {
// Base namespace could be, for example, the component's name
let base = createTestSelector('namespace');
// Element that appears only once on the screen at a time
assert.equal(base('single'), '[data-test-namespace="single"]');
// List of elements, targeting all items
assert.equal(base('multiple', null), '[data-test-namespace^="multiple:"]');
View ember-property-initializers.js
import EmberObject from '@ember/object';
class SubclassWithEmberInit extends EmberObject {
someProp = 'value';
init() {
super.init(...arguments);
console.log(this.someProp); // undefined
// `this.someProp` will be available after initialization,
// just not from the `init` method...
@zeppelin
zeppelin / controllers.application.js
Created Mar 20, 2018
cp-validations-default-value
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
m: ['a', 'b', 'c', 'd', 'e', 'f']
});
@zeppelin
zeppelin / controllers.application.js
Created Aug 22, 2017
Pickle Rick preventDefault demo
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
handleClick(name, e) {
alert(name);
e.preventDefault();
}
}
});
View default-button.scss
.defaultButton {
@extend .btn;
@extend .btn-default;
}
View kuku-kube.js
new MutationObserver(function() {
var slotA = {
count: 0,
color: null,
element: null
};
var slotB = {
count: 0,
color: null,
@zeppelin
zeppelin / 1-readme.md
Last active Aug 29, 2015
Ember ES2015 Modules
View 1-readme.md

Ember ES2015 Modules

The purpose of this document is to demonstrate how methods and classes could be imported inside an Ember CLI project, instead of accessing them on the Ember namespace.

For example, instead of doing this:

import Ember from 'ember';

export default Ember.Component.extend({
@zeppelin
zeppelin / index-route.js
Created Dec 16, 2014
Replace root URL with the localized root
View index-route.js
import Ember from 'ember';
var Route = Ember.Route;
export default Route.extend({
redirect() {
this.replaceWith('root'); // Replace URL: / -> /en-US
}
});
@zeppelin
zeppelin / router.js
Created Oct 4, 2014
Including locale in the URL in Ember.js
View router.js
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
Router.map(function() {
this.resource('select-country');
this.resource('root', { path: config.locale }, function() {
You can’t perform that action at this time.