Skip to content

Instantly share code, notes, and snippets.

View mnoble01's full-sized avatar

Makala Noble mnoble01

View GitHub Profile
@mnoble01
mnoble01 / components.yields-block-slots.js
Last active November 19, 2018 19:32
ember-tooltips-error
import Ember from 'ember';
import SlotsMixin from 'ember-block-slots';
export default Ember.Component.extend(SlotsMixin, {
});
@mnoble01
mnoble01 / controllers.application.js
Last active September 6, 2018 18:32 — forked from samselikoff/mirage.config.js
Save Model with 'data' model key
import Ember from 'ember';
export default Ember.Controller.extend({
saveModel() {
},
});
@mnoble01
mnoble01 / Tech Workshop Demo Flow
Last active January 30, 2018 18:13
Enhanced Workflow Technical Workshop
{
"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 January 5, 2018 19:03
Exploring async testing examples with ember-milestones (https://github.com/salsify/ember-milestones)
/**********************************************************************************
** 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 July 26, 2017 20:22
Task Facet data munging
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 March 2, 2023 14:03
i18n libphonenumber mask (with in-hand country code)
/*
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