Can't have empty files!
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
# Fork this gist, then fill in the code with your answers. | |
# you teach an advanced mathematics class at the local university. | |
# Your class is very difficult, so all but three students have quit. | |
# The three students who remain are: | |
# jim, 22 years old | |
# caroline, age 21 years old | |
# jasmine, the 17 year old young genius | |
# to keep track of your students, you create a Student class: |
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', | |
}); |
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
transitioning with query params |
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({ | |
appName:'Kori Test' | |
}); |
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.FixtureAdapter.extend({ | |
queryFixtures: function(fixtures, query, type) { | |
console.log(query); | |
console.log(type); | |
if (!query) { | |
return fixtures; | |
} | |
return fixtures.filter(function(item) { |
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
This is a demonstration of how to create a search field in Ember. | |
Results update 400ms after the user stops typing (for a nicer search experience). That's what the debounce does. |
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
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
queryParams: ['query'], | |
query: null, | |
queryField: Ember.computed.oneWay('query'), | |
actions: { | |
search: function() { | |
this.set('query', this.get('queryField')); | |
} |
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
// routes/books.js | |
export default Ember.Route.extend({ | |
model: function() { | |
var route = this; | |
return new Ember.RSVP.Promise(function(resolve) { | |
Ember.run.later(function() { | |
var model = route.store.find('book'); | |
resolve(model); | |
}, 3000); // 3 second delay | |
}); |
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
export default Ember.Controller.extend({ | |
actions: { | |
leave: function() { | |
var controller = this; | |
var requestOptions = { | |
url: "/groups/" + controller.get('group.id') + "/users/" + (controller.get("user.id")), | |
type: 'DELETE', | |
dataType: 'json', | |
// data not needed for a delete, but here's how you'd add it | |
// data: { email: controller.get('email') } |