Skip to content

Instantly share code, notes, and snippets.

View SaladFork's full-sized avatar

Elad SaladFork

  • Wiser Solutions, Inc.
  • Boston, MA
  • 13:56 (UTC -04:00)
View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
colors: [
'red',
'green',
'blue'
],
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@SaladFork
SaladFork / components.my-component.js
Last active September 7, 2016 20:21
hasBlock property
import Ember from 'ember';
export default Ember.Component.extend({
click() {
window.alert(this.get('hasBlock'));
}
});
@SaladFork
SaladFork / _LICENSE.md
Last active February 2, 2017 14:48
ember-computed-template-string with RegExp

Copyright (c) 2016-2017 Elad Shahar and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SO

@SaladFork
SaladFork / aioli.adapter.js
Created October 13, 2016 23:49
Solution for Nested API Resources
/*
Here's a technique I've used for telling my adapter to deal with a nested API
resource when there is an ember-data relationship set up from the child to the
parent. The below *does* use the private `_buildURL` and is specific to
RESTAdapter, but hopefully it might be helpful to you?
*/
import DS from 'ember-data';
const {
@SaladFork
SaladFork / controllers.application.js
Created October 24, 2016 20:29
init on createRecord
import Ember from 'ember';
export default Ember.Controller.extend({
store: Ember.inject.service(),
actions: {
create() {
this.get('store').createRecord('my-model');
}
}
});
@SaladFork
SaladFork / components.my-component.js
Last active November 30, 2016 22:37
Ember 2.10.0 rerender regression
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.data = {
version: Ember.VERSION
};
},
@SaladFork
SaladFork / components.my-component.js
Created December 20, 2016 19:29 — forked from rwjblue/components.my-component.js
Ember 2.10.0 rerender regression
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
this.data = {
version: Ember.VERSION
};
},
@SaladFork
SaladFork / components.my-component.js
Last active December 20, 2016 19:38
Updating object keys for each-in
import Ember from 'ember';
export default Ember.Component.extend({
willRender() {
// Set the "categories" property to a JavaScript object
// with the category name as the key and the value a list
// of products.
this.set('categories', {
'Bourbons': ['Bulleit', 'Four Roses', 'Woodford Reserve'],
'Ryes': ['WhistlePig', 'High West']