Skip to content

Instantly share code, notes, and snippets.

Avatar

Eli Dupuis elidupuis

View GitHub Profile
@elidupuis
elidupuis / README.md
Last active Oct 23, 2020
Service worker `getNotifications()` test snippet
View README.md

tl;dr

The service worker registration method getNotifications() never fulfills (neither resolves nor rejects) in MS Edge on macOS if notification permissions have been granted by the user.

Details

The bug appears to only exist if Notification.permission === 'granted', meaning that the user has granted permissions for notifications at the browser level. This bug has been experienced in Microsoft Edge on macOS, versions 86, 87 (beta), and 88 (dev). It does not appear to be present on Windows.

You can easily test this on any PWA application. First, you'll need to manually toggle notification permissions (granted is the only state where the bug exists) and then simply run the test snippet into your browser console.

@elidupuis
elidupuis / handlebars-helpers.js
Last active Jul 7, 2020
Simple Handlebars.js helpers
View handlebars-helpers.js
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
View controllers.application.js
import Ember from 'ember';
import { A } from '@ember/array';
import { parallel } from 'ember-animated';
import move from 'ember-animated/motions/move';
import scale from 'ember-animated/motions/scale';
import { fadeIn, fadeOut } from 'ember-animated/motions/opacity';
import adjustCSS from 'ember-animated/motions/adjust-css';
import { easeIn, easeOut, easeInAndOut } from 'ember-animated/easings/cosine';
export default Ember.Controller.extend({
@elidupuis
elidupuis / application.adapter.js
Last active Dec 25, 2019
Extended Models with custom adapter and serializer
View application.adapter.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api',
pathForType(modelName) {
let dasherized = Ember.String.dasherize(modelName);
if (/^job-/.test(modelName)) {
dasherized = 'job';
@elidupuis
elidupuis / controllers.application.js
Last active Jul 10, 2019
Parent animator offset x & y
View controllers.application.js
import Ember from 'ember';
import move from 'ember-animated/motions/move';
import { fadeIn, fadeOut } from 'ember-animated/motions/opacity';
import adjustCSS from 'ember-animated/motions/adjust-css';
import { easeIn, easeOut, easeInAndOut } from 'ember-animated/easings/cosine';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isThingActive: false,
@elidupuis
elidupuis / controllers.application.js
Last active Jul 9, 2019
Parent animator offset position
View controllers.application.js
import Ember from 'ember';
import move from 'ember-animated/motions/move';
import { fadeIn, fadeOut } from 'ember-animated/motions/opacity';
import { easeIn, easeOut, easeInAndOut } from 'ember-animated/easings/cosine';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isThingActive: false,
@elidupuis
elidupuis / controllers.application.js
Last active Jul 9, 2019
Parent animator offset via private API
View controllers.application.js
import Ember from 'ember';
import move from 'ember-animated/motions/move';
import { fadeIn, fadeOut } from 'ember-animated/motions/opacity';
import { easeIn, easeOut, easeInAndOut } from 'ember-animated/easings/cosine';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isThingActive: false,
@elidupuis
elidupuis / controllers.application.js
Last active Jul 9, 2019
Parent animator changing position V2
View controllers.application.js
import Ember from 'ember';
// import fade from 'ember-animated/transitions/fade';
import move from 'ember-animated/motions/move';
import { fadeIn, fadeOut } from 'ember-animated/motions/opacity';
import { easeIn, easeOut, easeInAndOut } from 'ember-animated/easings/cosine';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isThingActive: false,
@elidupuis
elidupuis / controllers.application.js
Last active Jul 8, 2019
Simply icon slide animation
View controllers.application.js
import Ember from 'ember';
// import fade from 'ember-animated/transitions/fade';
import move from 'ember-animated/motions/move';
import { fadeIn, fadeOut } from 'ember-animated/motions/opacity';
import { easeIn, easeOut, easeInAndOut } from 'ember-animated/easings/cosine';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isThingActive: false,
View controllers.application.js
import Ember from 'ember';
import { adjustCSS } from 'ember-animated/motions/adjust-css';
import move from 'ember-animated/motions/move';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
inset: false,
*transition({ insertedSprites, removedSprites }) {
You can’t perform that action at this time.