Skip to content

Instantly share code, notes, and snippets.


Eli Dupuis elidupuis

View GitHub Profile
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
elidupuis / application.adapter.js
Last active Dec 25, 2019
Extended Models with custom adapter and serializer
View application.adapter.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api',
pathForType(modelName) {
let dasherized = Ember.String.dasherize(modelName);
if (/^job-/.test(modelName)) {
dasherized = 'job';
View ember-set-error.js
Error: Assertion Failed: You must use Ember.set() to set the `currentState` property (of <app@component:ui/cell-assignment::ember1408>) to `[object Object]`.
at new Error (native)
at Error.EmberError (http://localhost:4200/assets/vendor.js:27314:21)
at Object._emberMetalCore.default.assert (http://localhost:4200/assets/vendor.js:16033:13)
at SETTER_FUNCTION [as currentState] (http://localhost:4200/assets/vendor.js:30817:34)
at _emberMetalMixin.Mixin.create._transitionTo (http://localhost:4200/assets/vendor.js:56379:44)
at Renderer.willDestroyElement (http://localhost:4200/assets/vendor.js:23700:12)
at Renderer.remove (http://localhost:4200/assets/vendor.js:23668:10)
at Object._emberMetalMerge.default.destroyElement (http://localhost:4200/assets/vendor.js:59776:21)
at Object._emberMetalMerge.default.cleanup (http://localhost:4200/assets/vendor.js:59768:25)
elidupuis / component.js
Last active Sep 1, 2015
Closure action not bubbling to Route; controller is not define...
View component.js
// components/split-view/component.js
actions: {
showUserPopover() {
// Ember.debug('showUserPopover action from split-view');
// Getting error: `An action named 'showUserPopover' was not found in (generated classes controller).`
// got same result using closure action instead of `sendAction`
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
elidupuis / foo.js
Last active Aug 29, 2015
Ember inject POJO
View foo.js
// app/initializers/foo.js
var POJO = {
bar: 'this is your POJO'
// whatever you need here
// this can also be import from another file...
export function initialize(container, application) {
application.register('pojo:main', POJO, { instantiate: false, singleton: true });
elidupuis / application.js
Created Apr 20, 2015
Inject your Ember Application object into other parts of your app.
View application.js
// app/intializers/application.js
* Expose the Application object to all Routes, Controllers, and Services.
* This is a simple way to gain access to things like `application.verison`...
export function initialize(container, application) {
application.inject('route', 'application', 'application:main');
application.inject('controller', 'application', 'application:main');
application.inject('service', 'application', 'application:main');
elidupuis / reload-hasmany.js
Created Dec 5, 2014
Dynamically reload all hasMany relationships for a model.
View reload-hasmany.js
* You can use this in a model or afterModel hook...
* see
* Not really tested or sure if this is a good idea... just had the thought and wanted to record it.
model.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany' && relationship.options.async) {
elidupuis / web-intent.js
Created May 13, 2014
Simple Cordova WebIntent test function
View web-intent.js
function testIntent () {
if (window.device) {
console.log('DEVICE mode; testing web intent: startActivity');
var address = 'edmonton alberta';
elidupuis /
Last active Jun 22, 2018
Path from mouse or touch input

Simple Drawing Example

Click and drag your mouse (or finger on touch device) to draw a line. A new path is created for each touch or click.

Paths are stored in a nested array; you can inspect the variable in console: session (assuming the example is in it's own window).