Skip to content

Instantly share code, notes, and snippets.

View alexdiliberto's full-sized avatar

Alex DiLiberto alexdiliberto

View GitHub Profile
@alexdiliberto
alexdiliberto / components.my-link-component.js
Last active September 7, 2017 16:47
ember-toggle not working inside LinkComponent
@alexdiliberto
alexdiliberto / ember-cli-build.js
Created August 28, 2017 14:47
Strip all console/debugging/log statements from an Ember prod build
defeatureify: {
'enableStripDebug': true,
'debugStatements': [
'Ember.default.warn',
'Ember.default.assert',
'Ember.default.deprecate',
'Ember.default.debug',
'Ember.default.Logger.assert',
'Ember.default.Logger.debug',
'Ember.default.Logger.error',
@alexdiliberto
alexdiliberto / match_last_item_n_list.scss
Created August 26, 2017 05:10
matches the last item only if the list has exactly N items
/*
matches the last item only if the list has exactly N items
e.g. for N = 3:
*/
$N: 3;
:nth-last-child(-n+#{$N}):first-child ~ li:nth-child(#{$N}) {
color: red;
}
@alexdiliberto
alexdiliberto / components.super-card-body-component.js
Created August 24, 2017 02:08
Contextual Components `super-card-component` demo
import Ember from 'ember';
export default Ember.Component.extend({
});
@alexdiliberto
alexdiliberto / gist:5be3e6cc6e0d8d0e57118bcab962165a
Created August 24, 2017 01:51 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@alexdiliberto
alexdiliberto / ASYNC-AWAIT-EMBER-TESTS.md
Last active August 19, 2017 23:53 — forked from caseywatts/0 README.md
How to add async/await in Ember tests

You can use async/await in your Ember testing suite, today! This blog post explains the situation pretty thoroughly.

There are three ways we can get it to work. If you try it without any changes, you will get the error regeneratorRuntime is not defined.

Largest

One way to get around this is to enable every polyfill - but that's pretty big to include in your production application code unnecessarily (30kb minified & gzipped).

This also lets you use async/await in your app code.

Medium

@alexdiliberto
alexdiliberto / README.md
Created August 9, 2017 02:25 — forked from boennemann/README.md
Pushing new releases of a legacy version with semantic-release

If you have a package where a lot of people are still using a legacy version of it you might want to keep pushing (security-)fixes to that "branch".

Let's say the "latest" version of your package is "5.4.0", but there is as significant amount of people still using "4.7.4" – the last version you released before doing "5.0.0".

You found a critical bug in "5.4.0" and push it as out as "5.4.1", but it applies to "4.7.4" as well and so you want to do "4.7.5".

Assuming you have semantic-release already set up, you can follow these steps to get that "4.7.5" legacy support release out.

  1. Go to the relevant commit: git checkout v4.7.4
  2. Create a new branch from it: git checkout -b 4.x (You can choose any branch name, just make sure to use the same in step 3)
@alexdiliberto
alexdiliberto / components.edit-user.js
Last active October 2, 2017 04:23 — forked from poteto/controllers.application.js
debounced ember-changeset-validations demo
import Ember from 'ember';
import Changeset from 'ember-changeset';
import lookupValidator from 'ember-changeset-validations';
export default Ember.Component.extend({
init() {
this._super(...arguments);
let user = Ember.get(this, 'user');
let validations = Ember.get(this, 'validations');
@alexdiliberto
alexdiliberto / ember-cli-build.js
Last active November 7, 2017 08:34
Strip all console statements from a production ember application
/* eslint-env node */
'use strict';
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
module.exports = function(defaults) {
let env = EmberApp.env();
let plugins = [];
if (env === 'production') {
@alexdiliberto
alexdiliberto / package.json
Created July 25, 2017 22:42
Lerna package.json scripts
{
"name": "my-lerna-project",
"private": true,
"devDependencies": {
"bower": "^1.8.0",
"lerna": "^2.0.0",
"lerna-wizard": "^1.0.9",
"rimraf": "^2.6.1"
},
"scripts": {