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 29, 2020 14:32
EC lastSuccessful Test
import Controller from '@ember/controller';
import { timeout } from "ember-concurrency";
import { task, lastValue } from "ember-concurrency-decorators";
export default class ApplicationController extends Controller {
wasCalled = false;
@lastValue('myTask') value = "Not Yet Started";
@task myTask = function* () {
@alexlafroscia
alexlafroscia / controllers.application\.js
Created April 17, 2020 19:47
ember-changeset changes CP bug
import Controller from '@ember/controller';
import { action, computed } from '@ember/object';
import { Changeset } from 'ember-changeset';
class User {
name = '';
}
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
@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 / README.md
Last active August 6, 2018 19:13
Skate.js ShadyCSS Mixin

ShadyCSS Skate.js Mixin

Out of the box, Skate.js doesn't work that well with ShadyCSS. This is a mixin that helps bridge the gap.

Usage

The usage example below assumes you're using a build tool like Webpack to transform a CSS file into a string when loaded.

import Component from 'skatejs';
@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",
{