Skip to content

Instantly share code, notes, and snippets.

View kenelliott's full-sized avatar

Ken Elliott kenelliott

  • Jupiter
View GitHub Profile
// don't make functions within a loop
model.get('things').then(things => {
things.forEach(thing => {
thing.get('attachment').then(attachment => {
thing.set('foo', true);
attachment.set('bar', true);
});
})
});
@kenelliott
kenelliott / application.route.js
Last active February 29, 2016 21:39 — forked from Gaurav0/application.route.js
AutoFocus Component
import Ember from 'ember';
export default Ember.Route.extend({
init() {
this._super(...arguments);
$.mockjax({
url: '/api/mock',
type: "POST",
status: 422,
import DS from 'ember-data';
export default DS.ActiveModelAdapter;
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
Google JSON StyleGuide
link: https://google-styleguide.googlecode.com/svn/trunk/jsoncstyleguide.xml?showone=error.code#error.code
{
"apiVersion": "2.0",
"error": {
"code": 404,
"message": "File Not Found",
"errors": [{
"domain": "Calendar",
"reason": "ResourceNotFoundException",
@kenelliott
kenelliott / gist:1f02c46b8a312b8ced8f
Last active August 29, 2015 14:16
API Error Responses
// Object Error(s): Current/Proposed
{
“errors”: {
“base”: [
“you can not do that”,
“nice try fool”
],
“first_name”: [
“can not be blank”,
“must include a capital letter”
App.LocationEditController = Em.ObjectController.extend({
productList: [],
unassignedProducts: (function() {
var res;
res = this.store.find('product').then((function(_this) {
return function(products) {
return _this.store.find('locationProduct', {
by_location_id: 1
}).then(function(locationProducts) {
var productIds;
self.encryptForm = function (form) {
var element, encryptedValue,
fieldName, hiddenField,
i, inputs;
form = extractForm(form);
inputs = findInputs(form);
while (hiddenFields.length > 0) {
try {
foo = []
foo["bar"] = "bat"
{
"folder_exclude_patterns":
[
"production",
".svn",
".git",
".hg",
"CVS",
"node_modules",
"tmp"