This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Test.registerAsyncHelper('waitForYoutube', function(app){ | |
return new Ember.Test.promise(function(resolve) { | |
// inform the test framework that there is an async operation in progress, | |
// so it shouldn't consider the test complete | |
Ember.Test.adapter.asyncStart(); | |
var player = app.__container__.lookup('component:youtube-player').createPlayer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
var Promise = Ember.RSVP.Promise; | |
export default function preloadImages(...urls) { | |
let promises = urls.map(url => { | |
return new Promise((resolve, reject) => { | |
let image = new Image(); | |
image.onload = resolve; | |
image.onerror = reject; | |
image.src = url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in *.wma; do ffmpeg -i "$f" -ab 128k "${f%.wma}.mp3" -ab 128K; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
init() { | |
this._super(...arguments); | |
$.mockjax({ | |
url: '/api/mock', | |
responseText: { | |
text: "someText" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filteredOwners: Ember.computed('petName', '[email protected].{id, name}', function() { | |
var petName = this.get('petName'); | |
return DS.PromiseArray.create({ | |
promise: Ember.RSVP.filter(this.get('model').toArray(), owner => { | |
return owner.get('pets').then(pets => { | |
return pets.isAny('name', petName); | |
}); | |
}) | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import DS from 'ember-data'; | |
export default DS.RESTAdapter.extend({ | |
namespace: 'api', | |
//coalesceFindRequests: true | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
queryParams: ['petName'], | |
petName: null, | |
filteredOwners: Ember.computed('petName', '[email protected].[]', function() { | |
let petName = this.get('petName'); | |
return DS.PromiseArray.create({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// models/parent.js | |
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
name: DS.attr('string'), | |
children: DS.hasMany('child') | |
}); | |
// this was possible |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// models/parent.js | |
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
name: DS.attr('string'), | |
children: DS.hasMany('child') | |
}); | |
// now we need to use this approach |