Skip to content

Instantly share code, notes, and snippets.

View k-fish's full-sized avatar
🐟

Kev k-fish

🐟
  • Toronto, Canada
View GitHub Profile
@k-fish
k-fish / controllers.application.js
Created May 7, 2019 19:45
CreateRecord + belongsTo
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
const book = this.store.createRecord('book', {});
const author = this.store.createRecord('author', {});
import Ember from 'ember';
export default Ember.Component.extend({
classNames: "fancy-border"
});
import Ember from 'ember';
class TestClass {
someFunction() {
return 'abc';
}
}
export default Ember.Controller.extend({
init() {
@k-fish
k-fish / controllers.application.js
Last active April 18, 2019 15:04
Safestring vs. inside template vs js
import Ember from 'ember';
import { htmlSafe } from '@ember/template';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
wordFromAbove: 'Bird is the word',
safeWord: htmlSafe('Roger that')
});
@k-fish
k-fish / components.my-component.js
Created April 17, 2019 20:42
Passing back helper
import Ember from 'ember';
export default Ember.Component.extend({
});
@k-fish
k-fish / components.example-component.js
Last active April 8, 2019 18:25
Example of initialization of value on component render
import Ember from 'ember';
export default Ember.Component.extend({
classNames: "component",
countWas7: false,
init() {
this._super(...arguments);
if (this.count == 7) {
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
const author = this.store.createRecord('author', { isRelevant: null });
const serialized = author.serialize();
this.set('author', author);
this.set('serialized', JSON.stringify(serialized));
@k-fish
k-fish / components.api-component.js
Created March 29, 2019 15:48
Example mut and api consumption
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this.get('registerAPI')({
open() {
window.alert('Action from component');
}
})
}
@k-fish
k-fish / templates.application.hbs
Created March 26, 2019 14:56
z-index dom order
<h1>Z-index Dom Order Example</h1>
<br>
<br>
<Card as |card|>
<h2>Both 'z-index=100'</h2>
<div style="height: 100px"></div>
<Circle style="position:absolute; z-index: 100"/>
<Square style="position:absolute; z-index: 100"/>
<h3>Second Component on top</h3>
</Card>
@k-fish
k-fish / controllers.application.js
Created February 21, 2019 18:05
Example that setting string values doesnt transform
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
const model = this.store.createRecord('my-model', {
foo: '123',
bar: '123'
});