Skip to content

Instantly share code, notes, and snippets.

View alexlafroscia's full-sized avatar
👋
Looking for work! Need experience with Svelte or Ember.js? Get in touch!

Alex LaFroscia alexlafroscia

👋
Looking for work! Need experience with Svelte or Ember.js? Get in touch!
View GitHub Profile
@alexlafroscia
alexlafroscia / controllers.application\.js
Last active April 3, 2020 21:36
Demo: Route Replacement Bug
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@service locationLogger;
}
@alexlafroscia
alexlafroscia / controllers.application.js
Created November 13, 2019 21:40
Returning from a setter
import Ember from 'ember';
export default Ember.Controller.extend({
someText: Ember.computed({
get() {
return 'Initial Value';
},
set(key, value) {
return value;
}
@alexlafroscia
alexlafroscia / components.child-component.js
Last active October 24, 2019 21:40
Cancelling a Task from a Child Component
import Ember from 'ember';
import { task } from 'ember-concurrency';
export default Ember.Component.extend({
childTask: task(function*() {
yield this.performParentTask()
})
});
@alexlafroscia
alexlafroscia / components.child-component.js
Last active November 6, 2018 18:22
Playing with getViewBounds
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
alert(Ember.ViewUtils.getViewBounds(this));
}
});
@alexlafroscia
alexlafroscia / controllers.application.js
Last active September 27, 2018 21:14
WeakMap and the KVO
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this._super(...arguments);
this.objects = [
{ label: 'First' },
@alexlafroscia
alexlafroscia / jsconfig.json
Created August 20, 2018 19:55
Ember App jsconfig.json
{
"compilerOptions": {
"target": "es6",
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
"origin-story-core-ui/*": ["./app/*"]
}
},
"exclude": [
@alexlafroscia
alexlafroscia / components.some-submitting-component.js
Created July 17, 2018 19:04
SO Example: POSTing Data in Ember
import Ember from 'ember';
import fetch from 'fetch';
export default Ember.Component.extend({
actions: {
submit() {
const name = this.get("name");
return fetch('/whatever-endpoint', {
method: 'POST',
@alexlafroscia
alexlafroscia / package.json
Created May 4, 2018 16:50
@semantic-release/git config for Ember CLI Addon Docs
{
"release": {
"verifyConditions": [
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
],
"prepare": [
"@semantic-release/npm",
{
@alexlafroscia
alexlafroscia / component-with-many-properties.hbs
Last active November 22, 2017 19:14
How would you pretty-print an HBS file? Here are some examples of cases that aren't quite cut-and-dry
{{! All on one line? }}
{{#some-component className='foo bar bax' foo='bar' baz='foo bar baz' somethingElse='some other really long thing'}}
{{/some-component}}
{{! One property per line? (One level of indentation) }}
{{#some-component
className='foo bar bax'
foo='bar'
baz='foo bar baz'
@alexlafroscia
alexlafroscia / components.child-component.js
Created November 14, 2017 01:02
Closure Actions w/ Event Listeners
import Ember from 'ember';
export default Ember.Component.extend({
});