Skip to content

Instantly share code, notes, and snippets.

Michael Munsie mikemunsie

Block or report user

Report or block mikemunsie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vue-setup.md

jsconfig.json

@mikemunsie
mikemunsie / myClass.js
Created Feb 9, 2018
Auto-Bind all methods in an es6 class
View myClass.js
class MyClass {
constructor() {
Object.getOwnPropertyNames(this.constructor.prototype).forEach((m) => {
this[m] = this[m].bind(this)
});
}
}
}
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
const { computed, get, set } = Ember;
/* To replicate issue:
ASDF1
ASDF1__
ASDF1___
@mikemunsie
mikemunsie / secrets.md
Last active Feb 12, 2018
ember-secrets
View secrets.md

Renaming attributes in a serializer:

export default DS.JSONAPISerializer.extend({
 attrs: { results: 'data' }
});

Customizing the key in a list '@identity', '@index', or your own:

<div>
@mikemunsie
mikemunsie / rules.js
Created Jan 4, 2018
Find Stylesheet Classes
View rules.js
// Make one massive array of all the rules from the stylesheets on the page
const styleSheetRules = Object.keys(document.styleSheets).reduce((rules, i) => {
const styleRules = document.styleSheets[i].cssRules || [];
Object.keys(styleRules).forEach((j) => {
rules.push(styleRules[j]);
});
return rules;
}, []);
// Function used to lookup the rules from the stylesheet
@mikemunsie
mikemunsie / components.my-component.js
Created Oct 13, 2017
Can Ember Nested Routes Do This?
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
alert('yep');
}
});
@mikemunsie
mikemunsie / phoneMasks.json
Last active Feb 21, 2018
Phone Masks by Country Code JSON
View phoneMasks.json
{
"AC": "+247-####",
"AD": "+376-###-###",
"AE": "+971-5#-###-####",
"AE": "+971-#-###-####",
"AF": "+93-##-###-####",
"AG": "+1(268)###-####",
"AI": "+1(264)###-####",
"AL": "+355(###)###-###",
"AM": "+374-##-###-###",
View components.test-component.js
import Ember from 'ember';
const {
computed,
get
} = Ember;
export default Ember.Component.extend({
name: computed('name', function() {
console.log('here');
@mikemunsie
mikemunsie / adapters-admin.js
Last active Jul 21, 2017
Creating a Custom Store in Ember
View adapters-admin.js
import ApplicationAdapter from './application';
export default ApplicationAdapter.extend({
namespace: 'api/v1/admin'
});
You can’t perform that action at this time.