Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@lolmaus
lolmaus / LICENCE.md
Last active March 30, 2021 16:10
EmberConf 2021 companion app timezone converter. Open the Schedule page in the companion app, paste this code snippet into the Dev Tools console., change your time zone (first line) and run

BSD Zero Clause License (public-domain-equivalent)

Copyright (C) 2021 by Andrey Mikhaylov (lolmaus) lolmaus@gmail.com

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

I maked these

@vasind
vasind / ember-cli-build.js
Last active June 8, 2023 04:33
Ember CLI performance improvements and tips
// Credits to the following posts that helps me to reduce build times drastically
// https://discuss.emberjs.com/t/tips-for-improving-build-time-of-large-apps/15008/12
// https://www.gokatz.me/blog/how-we-cut-down-our-ember-build-time/
//ember-cli-build.js
let EmberApp = require('ember-cli/lib/broccoli/ember-app');
let env = EmberApp.env(),
@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".

@hacknightly
hacknightly / random-walk.html
Created April 5, 2019 04:24
A Random Walk in JavaScript
<html>
<head>
<style>
body {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
@Lego2012
Lego2012 / CSS: Get rid of focus outline.md
Created October 1, 2018 07:26
CSS: Get rid of focus outline

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.

return await RSVP.hash({
x: this.store.findAll('thing'),
u: this.store.queryRecord('user', { me: true })
});
// or
let [x, u] = await Promise.all([this.store.findAll('thing'), this.store.queryRecord('user', { me: true })]);
return { x, u };
@nightire
nightire / debug_ember_app_in_vscode.md
Created May 17, 2018 11:21
How to debug an ember application with VS Code

Step 1: Launch Google Chrome with Remote Debugging support

  • windows: <path to chrome>/chrome.exe --remote-debugging-port=9222
  • macOS: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  • linux: google-chrome --remote-debugging-port=9222

Step 2: Install "Debugger for Chrome" extension

Step 3: Setup your application

@runspired
runspired / push-deletion.js
Last active September 20, 2022 18:44
Useful Ember Data helpers
/*
notifying the store that a record has been remotely deleted and should be fully removed.
*/
function pushDeletion(store, type, id) {
let record = store.peekRecord(type, id);
if (record !== null) {
let relationships = {};
let hasRelationships = false;
// tests/helpers/push-mirage-db-into-store.js
import { registerAsyncHelper } from '@ember/test';
import { run } from '@ember/runloop';
let pushMirageDbIntoStore = function(server, store) {
let tables = Object.keys(server.schema);
tables.forEach(table => {
if (server.schema[table].all) {
let all = server.schema[table].all();