This file contains 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
App.Router = Em.Router.extend({ | |
root: Em.Route.extend({ | |
route: '/', | |
user: Em.Route.extend({ | |
route: '/:user_id/', | |
connectOutlets: function (router, context) { | |
//What is context here? | |
// it's simple in the one segment case where | |
// its the return value of find on the model. | |
}, |
This file contains 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
App.Forms.ImageUploader = Ember.View.extend | |
classNames: ['ember-image-uploader'] | |
controller: null | |
didInsertElement: -> | |
controller = @get('controller') | |
if controller.get('imageUploadUrl') | |
@initUploader() | |
else | |
@get('controller').addObserver 'imageUploadUrl', => | |
if @get('controller.imageUploadUrl') |
This file contains 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
<script type="text/x-handlebars"> | |
<button {{action loadBooks target="Welcome.booksController"}}>Load Books</button> | |
{{#collection contentBinding="Welcome.booksController" tagName="ul"}} | |
<b>{{view.content.title}}</b> - {{view.content.author}}, <i>{{view.content.genre}}</i> | |
{{/collection}} | |
</script> |
This file contains 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
#!/usr/bin/env ruby | |
VERSION_REGEX = /\((\d.+)\)/ | |
require 'net/http' | |
require 'json' | |
lines = `git diff Gemfile.lock`.split("\n") | |
# Line is a diffed line | |
lines.select!{ |line| ['+ ', '- '].include?(line.strip[0..1])} | |
# Line has a version | |
lines.select!{ |line| line.match(VERSION_REGEX) } |
This file contains 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
(function() { | |
window.DS = Ember.Namespace.create({ | |
// this one goes to 11 | |
CURRENT_API_REVISION: 11 | |
}); | |
})(); | |
This file contains 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
// ========================================================================== | |
// Project: Ember Data | |
// Copyright: ©2011-2012 Tilde Inc. and contributors. | |
// Portions ©2011 Living Social Inc. and contributors. | |
// License: Licensed under MIT license (see license.js) | |
// ========================================================================== | |
// Last commit: eaffebc (2013-02-10 08:36:19 -0800) |
This file contains 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
#= require spec_helper | |
#= require models/user | |
describe "User", -> | |
beforeEach -> | |
@user = App.User.createRecord | |
firstName: 'Bart' | |
lastName: 'Simpson' | |
roles: 'user,admin' | |
describe "name", -> |
This file contains 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
// https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/components/development.js | |
// Updated for Ember 1.0-rc3 | |
Ember.reloadTemplate = function(templateName) { | |
Ember.TEMPLATES.empty = Handlebars.compile("<div></div>"); | |
$.getScript("/assets/templates/" + templateName, function(data, textStatus, jqXhr) { | |
delete Ember.Container.defaultContainer._container.cache.dict["template:" + templateName] | |
$.each(Ember.View.views, function() { | |
var _this = this; | |
if (this.get('templateName') === templateName) { | |
this.set('templateName', 'empty'); |
This file contains 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
Ember.KonamiCode = Ember.Mixin.create({ | |
konami: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13], | |
currentIndex: 0, | |
keyPress: function(event) { | |
this._super(event); | |
var index = this.get('currentIndex'); | |
if (event.keyCode === this.konami[index]) { | |
if (index === 10) { | |
this.success(); | |
} else { |