Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@samselikoff
samselikoff / README.md
Last active June 24, 2020 19:56
How to use an `asyncThrows` custom helper.

This assert.asyncThrows custom assertion allows us to write tests against failing async code, usually as a result of a server error (4xx/5xx response).

test('If the index route errors, I see a message', async function(assert) {
  server.create('post');
  server.get('/posts/:id', { errors: ['The site is down'] }, 500); // force Mirage to error

  await assert.asyncThrows(() => {
    return visit('/posts/1');
 }, 'GET /posts/1 returned a 500');
@caseywatts
caseywatts / 0 README.md
Last active May 2, 2024 06:06
d3 & c3 npm shim to es6 module for Ember
@caseywatts
caseywatts / 0 README.md
Last active August 8, 2018 22:48
async/await in ember tests
/* the page should not change width as content is loaded */
body {
overflow-y: scroll;
}
/* block scrolling without losing the scroll bar and shifting the page */
/* add this class when a modal is open */
body.block-scroll {
overflow: hidden;
overflow-y: scroll !important;
// The home page needs to load a lot of data for a feed of events.
// This would block initial rendering of the application, so what
// we do is make a pathless child route called feed that loads the
// data.
// Since our home route doesn't load data anymore it renders
// immediately. It has an {{outlet}}, and while 'home.feed' is
// fetching data 'home.loading' will be rendered into the
// outlet. Once feed's model hook fulfills the feed template
// is rendered to the outlet.
@maxrimue
maxrimue / readme.md
Last active March 13, 2021 12:21
Use yarn with Greenkeeper

Use yarn with Greenkeeper

When using yarn, it will create a yarn.lock lockfile which holds data on your used dependencies. This file also includes hard-typed versions, so should you update your dependencies, the yarn.lock file is basically outdated and needs to be regenerated. While yarn does this automatically, Greenkeeper pull requests that update dependencies as of right now do not do this regeneration, which means you would have to do it manually.

This gist shows you a way how to automatise this step using a Travis CI script.

Prerequisites

  • You use Travis CI and have it build Pull Requests (default behaviour)
  • You have a yarn.lock file in your repository for Travis CI to automatically install yarn (yarn will be added to their default images soon)

Getting started

@oskarrough
oskarrough / ember-critical-css.md
Last active May 29, 2017 07:20
Add this to any ember-cli project and run `npm run build` to get a production build with critical path, inlined CSS.

Here's how to (hopefully) improve the initial load performance of your ember-cli project.

  1. Add this gulpfile.js to any ember-cli project
  2. Run yarn add critical gulp --dev
  3. Change the build script in package.json to ember build -prod; gulp critical
  4. Run yarn build

Now, gulp will run the critical task once after each build. The critical task checks what CSS your app needs to render the initial route and puts it inline in your dist/index.html.

@mike-north
mike-north / enemy_of_the_state.md
Last active January 11, 2017 04:29
EmberFest 2016 - Enemy of the state
@rohmann
rohmann / app-view.js
Created September 14, 2016 18:50
Add class to Ember Application (after 2.7.0)
// instance-initializers/app-view.js
// With an instance initializer, we can register a component for Ember to use at the top level.
// Not ideal, but it works in the meantime until routable components drop.
import Ember from 'ember';
const AppView = Ember.Component.extend({
classNames: ['my-app'],
});