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 function(error) { | |
| error = new Error(error); | |
| if (error.message) { console.log('\n' + error.message + '\n'); } | |
| if (error.stack) { console.log('\n' + error.stack + '\n'); } | |
| } |
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
| Ember.transitionEventName = function() { | |
| var t; | |
| var el = document.createElement('fakeelement'); | |
| var transitions = { | |
| 'transition':'transitionend', | |
| 'OTransition':'oTransitionEnd', | |
| 'MozTransition':'transitionend', | |
| 'WebkitTransition':'webkitTransitionEnd' | |
| }; |
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'; | |
| import OverlayComponent from 'tahi/pods/components/overlay/component'; | |
| export default OverlayComponent.extend({ | |
| fileUploadURL: '/files/important/', | |
| importantFileIsUploaded: Ember.computed.notEmpty('model.file.src'), | |
| actions: { | |
| importantFileDidUpload: function(data) { | |
| this.store.pushPayload('importantFile', data); |
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'; | |
| var cancelDragEvent = function(e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| return false; | |
| }; | |
| export default { | |
| dragItem: null, |
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
| // app/pods/components/flash-message/component.js | |
| import Ember from 'ember'; | |
| export default Ember.Component.extend({ | |
| classNames: ['flash-message'], | |
| classNameBindings: ['type'], | |
| layoutName: 'flash-message', | |
| type: function() { |
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
| # modified from: https://github.com/KasperTidemann/ember-contenteditable-view | |
| App.ContentEditableComponent = Em.Component.extend | |
| attributeBindings: ['contenteditable', 'placeholder'] | |
| editable: true | |
| placeholder: null | |
| plaintext: false | |
| preventEnterKey: false |
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
| //So you use [rails.vim](https://github.com/tpope/vim-rails) and you're angry that you can't use it because you're not in a rails project and you're in Ember-land. Well do the following and get back to coding: | |
| //1. `touch config/environment.rb` Don't worry, it's in the `.gitignore` | |
| //2. Copy this configuration into `config/projections.json` (also in `.gitignore`) | |
| ```javascript | |
| { | |
| "app/js/models/*.js": { | |
| "command": "model", | |
| "alternate": "spec/models/%s_spec.js", |
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
| App.OldAndBustedRoute = App.Route.extend({ | |
| /* | |
| Calling find from the model hook will block page rendering until (I think) the promise is fulfilled. | |
| */ | |
| model: function(params) { | |
| return this.store.find('collection', params.collection_id); | |
| }, | |
| setupController: function(controller, model) { | |
| controller.set('isLoading', true); |
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
| App.Order = DS.Model.extend({ | |
| items: DS.hasMany('App.OrderItems'), | |
| orderTotal: function() { | |
| return this.get('items') | |
| .reduce(function(previousValue, item, index) { | |
| return item.get('price') + previousValue; | |
| }, 0); | |
| }.property('items', 'items.@each', 'items.@each.cost') | |
| }) |
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
| =respond-to($device) | |
| @if $device == handheld | |
| @media only screen and (min-width : 320px) | |
| @content | |
| @if $device == tablet | |
| @media only screen and (min-width : 600px) | |
| @content | |
| @if $device == tablet-landscape |