Skip to content

Instantly share code, notes, and snippets.

View sly7-7's full-sized avatar

Sylvain Mina sly7-7

  • ERDIL
  • Besançon, France
  • X @sly7_7
View GitHub Profile
@sly7-7
sly7-7 / adapters.author.js
Created May 21, 2021 10:00 — forked from Herriau/adapters.author.js
EmberData: Unnecessary inverse relationship requests
import JSONAPIAdapter from 'ember-data/adapters/json-api';
export default class AuthorAdapter extends JSONAPIAdapter {
async findRecord(store, type, id) {
console.log(`Requesting http://localhost:3000/authors/${id}`);
return {
"data": {
"id": "1",
"type": "authors",
"links": {
"self": "http:\/\/localhost:3000\/authors\/1"
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { later } from '@ember/runloop';
export default Controller.extend({
appName: 'Ember Twiddle',
bar: null,
foo: computed('bar', async function() {
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
data = [
{
firstName: 'Tony',
lastName: 'Stark',
points: 99
import Ember from 'ember';
export default Ember.Controller.extend({
});
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Controller from '@ember/controller';
export default class ApplicationController extends Controller {
appName = 'Ember Twiddle';
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
store: Ember.inject.service(),
get firstThing() {
return this.model.hasMany('things').value().firstObject;
},
@sly7-7
sly7-7 / adapters.application.js
Created November 15, 2019 14:21 — forked from runspired/adapters.application.js
Staggered Record Loading
import Ember from 'ember';
import RSVP from 'rsvp';
export default Ember.Object.extend({
findRecord(_, __, id) {
return new RSVP.Promise(resolve => {
setTimeout(resolve, parseInt(id) * 350);
}).then(() => {
return {
data: {
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend();
@sly7-7
sly7-7 / .block
Last active February 16, 2017 08:53
extended mirror barchart
license: mit