Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@alexdiliberto
alexdiliberto / adapters.application.js
Created May 7, 2020 14:45
REST Adapter With Sideloading
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
});

I’m gonna start blanket adding the following rule to all my stylesheets:

:focus:not(:focus-visible) { outline: none }

Gets rid of the annoying outline for mouse users but preserves it for keyboard users, and is ignored by browsers that don’t support :focus-visible.

@alexdiliberto
alexdiliberto / aspect-ratio.hbs
Created April 3, 2020 17:05
image aspect ratio component
<div class="relative" style={{this.style}}>
<div class="absolute object-cover w-full h-full overflow-hidden">
{{yield}}
</div>
</div>
@alexdiliberto
alexdiliberto / perf_profiling_tips.md
Last active March 25, 2020 11:14
Ember performance profiling tips in Chrome
{"requestedUrl":"https://alexdiliberto.com/","finalUrl":"https://alexdiliberto.com/","lighthouseVersion":"5.6.0","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/78.0.3904.74 Safari/537.36","fetchTime":"2019-12-23T21:20:34.599Z","environment":{"networkUserAgent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse","hostUserAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/78.0.3904.74 Safari/537.36","benchmarkIndex":624},"runWarnings":[],"configSettings":{"emulatedFormFactor":"mobile","locale":"en-US","onlyCategories":["pwa","performance","accessibility","best-practices","seo"]},"audits":{"audio-caption":{"id":"audio-caption","title":"`<audio>` elements contain a `<track>` element with `[kind=\"captions\"]`","description":"Captions make audio elements usable for deaf or hearing-impaired users, providing critical inf
@alexdiliberto
alexdiliberto / prefers-reduced-motion.css
Created October 29, 2019 01:34
The prefers-reduced-motion CSS media feature is used to detect if the user has requested that the system minimize the amount of animation or motion it uses.
@media (prefers-reduced-motion: reduce) {
* {
animation: none !important;
transition: none !important;
}
}
import Ember from 'ember';
import Component from '@ember/component';
export default Component.extend({
numberOfSaves: 0,
message: '',
helloMessage: Ember.computed('username', function() {
return `Hello, ${this.get('username')}. Welcome!`;
}),
import { Promise, defer, resolve } from 'rsvp';
export default class AppAdapter {
constructor(options) {
Object.assign(this, options);
}
static create(options) {
return new this(options);
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@alexdiliberto
alexdiliberto / ember-data-type-pluralization-and-relationships.md
Last active April 25, 2019 17:20
Ember Data, Type Pluralization, and Relationships

A huge "Thank You" to @runspired for all the help in the #ember-data Ember Community Discord!

// models/foo-bar.js
export default class FooBar extends Model {}

JSON API "type" === "modelName" === "foo-bar".