Skip to content

Instantly share code, notes, and snippets.

View eccegordo's full-sized avatar

Gordon Potter eccegordo

View GitHub Profile
@eccegordo
eccegordo / make-tag-string-test.js
Last active May 26, 2019 03:12
Convert tag json to XML string
import makeTagString from 'my-app/utils/make-tag-string';
import { module, test } from 'qunit';
module('Unit | Utility | make tag string');
test('it works with single tag object', function(assert) {
let tag = { type: 'tag', name: 'root', value: "The Root" };
let result = makeTagString(tag);
let expected = '<root>The Root</root>';
@eccegordo
eccegordo / my-redux-store-instance.js
Created May 11, 2019 21:30
Redux like store as ember data model instance
/*
my-redux-store-instance
A model to give us some redux store like behavior
Note that typically the state object comes from a reducer
The responsibility of this model is to give us something we can
store our state history when using the redux pattern
Also this model contains some helper functions to build stuff like redux actions
*/
@eccegordo
eccegordo / route.js
Last active June 12, 2018 18:50
group and sub group promises Ember routes
import Ember from 'ember';
import RSVP from 'rsvp';
const { set, get } = Ember;
export default Ember.Route.extend({
model(params) {
let store = get(this, 'store');
let groupCollection = store.query('groupCollection', {
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button'
});
/Applications/Atom.app/Contents/MacOS/Atom -n $@
@eccegordo
eccegordo / application.controller.js
Last active September 18, 2015 06:51
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle 2'
});
@eccegordo
eccegordo / my-service-initializer.js
Created July 12, 2015 04:50
Service Initializer
import MyService from 'app-name/services/my-service';
export default {
name: 'MyServiceInitializer',
initialize: function(container, application) {
container.register('my-service:service', MyServiceInitializer, { singleton: true });
// inject onto routes, controllers, etc
}
};
// A service object for managing access to static data.
// How to inject this service
// staticData: Ember.inject.service('static-data'),
import Ember from 'ember';
export default Ember.Service.extend({
// Setup the service with some data the first time it loads
@eccegordo
eccegordo / component-layout.js
Created June 23, 2015 23:29
Component Layout
// my-addon/addon/components/foo-base.js
import Ember from 'ember';
import layout from '../templates/components/foo-base';
export default Ember.Component.extend({
layout: layout
});
// my-addon/addon/templates/components/foo-base.hbs
<div class="well well-sm">