Skip to content

Instantly share code, notes, and snippets.

Avatar

Makala Noble mnoble01

View GitHub Profile
View components.yields-block-slots.js
import Ember from 'ember';
import SlotsMixin from 'ember-block-slots';
export default Ember.Component.extend(SlotsMixin, {
});
@mnoble01
mnoble01 / controllers.application.js
Last active Sep 6, 2018 — forked from samselikoff/mirage.config.js
Save Model with 'data' model key
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
saveModel() {
},
});
@mnoble01
mnoble01 / Tech Workshop Demo Flow
Last active Jan 30, 2018
Enhanced Workflow Technical Workshop
View Tech Workshop Demo Flow
{
"data": {
"import_json": {
"flow_template": {
"enabled": true,
"template_name": "Product Onboarding",
"description": "Facilitate the smooth onboarding of products",
"entity_type": "product"
},
"triggers": [
@mnoble01
mnoble01 / ember-milestones-examples.js
Last active Jan 5, 2018
Exploring async testing examples with ember-milestones (https://github.com/salsify/ember-milestones)
View ember-milestones-examples.js
/**********************************************************************************
** Basic timeout example
**/
// component
export default Component.extend({
pollStatus: task(function*() {
yield milestone('poll-status-timeout', () => timeout(1000));
this.get('statusModel').reload();
}),
@mnoble01
mnoble01 / controllers.application.js
Last active Jul 26, 2017
Task Facet data munging
View controllers.application.js
import Ember from 'ember';
const { A, get, String: { pluralize } } = Ember;
export default Ember.Controller.extend({
facetsForChecklist: Ember.computed('taskFacets', 'selectedFacets', function() {
// Merged facets is an array of objects of the form { facetAttribute: {}, taskFacets: [] }
const mergedFacets = this.get('taskFacets').reduce(function(mergedFacets, taskFacet) {
const facetAttribute = get(taskFacet, 'facetAttribute');
const facetAttributeId = get(taskFacet, 'facetAttributeId');
const mergedFacet = mergedFacets.findBy('facetAttribute.id', facetAttributeId)
@mnoble01
mnoble01 / international phone number mask
Last active Jun 15, 2020
i18n libphonenumber mask (with in-hand country code)
View international phone number mask
/*
This is using the JS port of Google's libphonenumber.
As far as I know, though, all of the APIs are the same or similar
*/
// I just hardcoded "US" as the country, but of course you can use any country iso code
var ctry = 'US';
var exampleNumber = i18n.phonenumbers.PhoneNumberUtil.getInstance()
.getExampleNumberForType(ctry, i18n.phonenumbers.PhoneNumberType.MOBILE); // returns PhoneNumber instance
You can’t perform that action at this time.