Skip to content

Instantly share code, notes, and snippets.

View betocantu93's full-sized avatar
🏠
Working from home

Alberto Cantú Gómez betocantu93

🏠
Working from home
View GitHub Profile
@pzuraq
pzuraq / autotracking.js
Last active December 13, 2023 22:57
Autotracking Simplified
// The global revision clock. Every time state changes, the clock increments.
let $REVISION = 0;
// The current dependency tracker. Whenever we compute a cache, we create a Set
// to track any dependencies that are used while computing. If no cache is
// computing, then the tracker is null.
let CURRENT_TRACKER = null;
// Storage represents a root value in the system - the actual state of our app.
class Storage {
@maxfierke
maxfierke / cancelable-fetch.js
Last active April 21, 2022 18:15
cancelableFetch Yieldable ember-concurrency
import { Yieldable } from 'ember-concurrency';
import fetch from 'fetch'; // i.e. ember-fetch. could also use native fetch too.
class FetchYieldable extends Yieldable {
constructor(url, opts = {}) {
super(...arguments);
this.url = url;
this.opts = opts;
}
@bendemboski
bendemboski / addon-a__ember-cli-build.js
Last active November 16, 2021 21:52
An illustration of our modular webpack configuration setup under embroider
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const { Webpack } = require('@embroider/webpack');
module.exports = function (defaults) {
let app = new EmberAddon(defaults, {});
return require('@embroider/compat').compatBuild(app, Webpack, {
packagerOptions: {
webpackConfig: require('./webpack.config'),
},
import { TrackedWeakMap } from 'tracked-built-ins';
function localCopy(target, key) {
let values = new TrackedWeakMap();
let lastValues = new WeakMap();
return {
get() {
let incoming = this.args[key];
let lastValue = lastValues.get(this);
// app/adapters/application.js
import DS from 'ember-data';
import { inject as service } from '@ember-decorators/service';
const { RESTAdapter } = DS;
export default class ApplicationAdapter extends RESTAdapter {
@service fastboot;
@service shoebox;
@alexdiliberto
alexdiliberto / .eslintrc.js
Last active August 31, 2022 23:20
Integrate Prettier with Ember
/*
'plugin:prettier/recommended' does the following:
extends: ['prettier'],
plugins: ['prettier'],
rules: {
'prettier/prettier': 'error'
}
*/
module.exports = {
@sarupbanskota
sarupbanskota / README.md
Last active June 9, 2020 21:28
Ember + ESLint + Prettier + Ember Suave
  • new ember app & yarn install
  • ember install ember-cli-eslint@4
// ember-cli-build.js
let app = new EmberApp(defaults, {
  eslint: {
    testGenerator: 'qunit',
    group: true,
    rulesDir: 'eslint-rules',
 extensions: ['js'],
@timmyomahony
timmyomahony / readme.md
Last active November 23, 2018 17:49
Making Ember addons FastBoot 1.0 compatible

Converting addons to Fastboot v1.0

Fastboot is currently transitioning to version 1.0 which introduces some breaking changes. The most pressing issue is that the approach previously suggested for handling dependencies in addons has changed.

This post has a bit of background of how Ember CLI and addons work followed by some details on how to migrate addons to the new Fastboot v1.0 structure.

How dependencies are manager for Ember projects (not addons)

TODO: basic package.json, bower.json, ember install and ember-cli-build.js/app.import

@runspired
runspired / touchZone.styl
Last active March 7, 2018 07:19
On mobile, sometimes it's necessary to provide an invisible larger area to recognize touch inputs on a crucial or otherwise difficult to activate button. This is an example of one way of doing so using pseudo elements. In this particular implementation, the buttons this was being added to would shrink while active, so a countering scaling effect…
.touchZone::after
content ' '
display block
width 100%
height 100%
z-index 100
top 0
position absolute