Skip to content

Instantly share code, notes, and snippets.

Amiel Martin amiel

Block or report user

Report or block amiel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

urlTemplate Proposal


urlTemplate improves the extesibility of API endpoint urls in RESTAdapter.


I think that Ember Data has a reputation for being hard to configure. I've often heard it recommended to design the server API around what Ember Data expects.

View in-some-controller.js
var controller = this;
var success = function(model) {
var failure = function(xhr) {
if (xhr.status == 400) {
amiel /
Created Aug 6, 2014
Example serializer for supporting the lack of a root key
ApplicationSerializer = DS.RESTSerializer.extend
extract: (store, type, payload, id, requestType) ->
newPayload = {}
newPayload[type.typeKey] = payload
@_super store, type, newPayload, id, requestType
serializeIntoHash: (hash, type, record, options) ->
Ember.merge hash, @serialize record, options
amiel / 1-other-versions.txt
Last active Aug 29, 2015
Npm list in ember.js -- tests in browser are failing because {{FEATURES}} is not getting replaced in tests/ember_configuration.js
View 1-other-versions.txt
$ npm --version
$ ember --version
version: 0.0.37

This works with Ember Data 1.0.0-beta.7+canary.b45e23ba, but not Ember Data 1.0.0-beta.8.2a68c63a.

normalizePayload now takes just a payload.

What is the new way to do this?

amiel / admin_user_spec.rb
Created May 20, 2014
View admin_user_spec.rb
require 'spec_helper'
describe 'Users' do
fixtures :all
let(:user) { admin_users(:amiel) }
before { login_to_admin }
describe '#index' do
it 'renders without fail' do
visit '/admin/users'
amiel / example.js
Created May 14, 2014
Example gist cursor misalignment.
View example.js
Object.create({ braces: { make: { it: { slightly: { worse: { each: { time: {} } } } } } } });
return { cursor: "is basically one character off here" };
amiel /
Created May 13, 2014
nested urls ideas
amiel / my-controller.js
Created May 8, 2014
ember-validators with server validation errors
View my-controller.js
MyController = Ember.Controller.extend({
actions: {
save: function() {
this.get('model').save().then(function() {
// Success, maybe transitionToRoute or whatever
}, function(xhr) {
// Oh noes, we had an error, maybe it's a validation error
if (xhr.status == 400) {
$.parseJSON(xhr.responseText).each(function(attribute, errors) {
this.get('errors').set(attribute, errors);
View digicolor.rb
#!/usr/bin/env ruby -rubygems
# :P
# exit
require 'digiusb/digiblink'
'success' => 'green',
You can’t perform that action at this time.