Skip to content

Instantly share code, notes, and snippets.

View pixelhandler's full-sized avatar
🍊
Working remotely

Bill Heaton pixelhandler

🍊
Working remotely
View GitHub Profile
@pixelhandler
pixelhandler / Gemfile
Created September 23, 2013 22:18
Source to complete tutorial at http://hashrocket.com/blog/posts/setting-up-an-ember-app-with-a-rails-backend I used ember-data-canary and ember-canary versions to get the data to work
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'pg'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
group :doc do
@pixelhandler
pixelhandler / ember-rails-scaffold.md
Last active August 20, 2021 23:06
Scaffold for a browser app build with Ember.js, Rails, Ember.Data

Scaffold for a browser app build with Ember.js, Rails, Ember.Data

Journal App

This is a scaffold for setting up: an API with Rails and the ember-rails gem, persistence with Ember.Data, and a browser app using Ember.js

See source code on GitHub: pixelhandler/journal.

@pixelhandler
pixelhandler / application.html
Created September 25, 2013 06:11
application handlebars template, w/ outlet
<script type="text/x-handlebars">{{ outlet }}</script>
@pixelhandler
pixelhandler / entries.handlebars
Created September 25, 2013 06:16
entries.handlebars template
<h1>Entries...</h1>
{{#each entry in controller}}
{{render "entry" entry}}
{{/each}}
@pixelhandler
pixelhandler / entry.handlebars
Created September 25, 2013 06:17
entry.handlebars template
<h2>{{name}}</h2>
@pixelhandler
pixelhandler / resolveComponent.js.coffee
Created October 8, 2013 19:24
resolveComponent method for Ember.js added via DefaultResolver. We use a `Core` namespace as default, so keep common components on `Core.`
Ember.DefaultResolver.reopen
resolveComponent: (parsedName) ->
get = Ember.get
classify = Ember.String.classify
className = classify(parsedName.name) + classify(parsedName.type)
factory = get(parsedName.root, className) || get(Core, className)
return factory || @resolveOther parsedName
@pixelhandler
pixelhandler / jsbin.iCIXuzI.css
Created October 19, 2013 16:47 — forked from anonymous/jsbin.iCIXuzI.css
Ember Data (Canary) record w/ hasMany and belongsTo - jsbin link: http://emberjs.jsbin.com/iCIXuzI/1/
/* Put your CSS here */
html, body { margin: 20px; }
h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
dl { padding: 15px; font-size: 1.4em; color: blue; }
@pixelhandler
pixelhandler / app.js
Created February 5, 2014 19:43
Routing with a rootUrl, attempting to reproduce bug in double rootUrl. To use place the files in a folder named 'blog' then start a server in the parent (of blog) directory. `python -m SimpleHTTPServer` [ see http://pixelhandler.github.io/ember-data-extensions/blog/ ]
App = Ember.Application.create();
App.Router.reopen({
location: 'history',
rootURL: '/blog/'
});
App.Router.map(function() {
this.resource('posts', function () {
this.route('archive');
@pixelhandler
pixelhandler / application_adapter.js
Last active September 15, 2015 02:37
Handle 404 with Ember Data, pseudo code: see route.js, application_adapter.js, router.js (given a response.status = 404) the router would redirect to a 404 route.
App.ApplicationAdapter = DS.RESTAdapter.extend({
ajaxError: function(jqXHR) {
var error = this._super(jqXHR),
errors = {};
if (jqXHR && jqXHR.status === 422) {
var jsonErrors = Ember.$.parseJSON(jqXHR.responseText)["errors"];
forEach(Ember.keys(jsonErrors), function (key) {
errors[Ember.String.camelize(key)] = jsonErrors[key];
/* Put your CSS here */
html, body { margin: 20px; }
h1 { font-size: 1.6em; padding-bottom: 10px; }
h2 { font-size: 1.4em; }
dl { padding: 15px; font-size: 1.4em; color: blue; }