Some thoughts and ideas on best practices building Ember apps after 2 years building and maintaining 6+ apps. This is less about the obvious best practices, like use ember-cli, and more along the lines of when to use what technique. As with every best practice there are exceptions to every rule.
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
Capybara.register_driver :chrome do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end | |
Capybara.default_driver = :chrome |
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
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
/** | |
* Returns true iff the number passed in is even | |
* @param {Number} x | |
* @return {Boolean} | |
*/ | |
function isEven(x) { | |
return x % 2 == 0; |
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
machine: | |
node: | |
version: 0.12.0 | |
dependencies: | |
pre: | |
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH | |
- npm config set spin false | |
- npm install -g npm@^2 | |
- npm install -g bower |
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://ember-cli.com/user-guide/#standard-non-amd-asset | |
First, generate the shim: | |
ember generate vendor-shim moment | |
Next, provide the vendor asset path: | |
app.import('vendor/shims/moment.js'); | |
Finally, use the package by adding the appropriate import statement: |
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
{{my-component click=(action "foo")}} |
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/ember-cli/ember-addon-output/compare/v2.3.0...v2.5.0 | |
https://github.com/ember-cli/ember-new-output/compare/v2.3.0...v2.5.0 |
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
http://miguelcamba.com/blog/2016/01/24/ember-closure-actions-in-depth/ | |
http://miguelcamba.com/blog/2016/04/13/tricks-for-build-composable-components-part-1/ | |
https://dockyard.com/blog/categories/ember | |
http://frontside.io/blog/ |
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
// Array literal (= []) is faster than Array constructor (new Array()) | |
// http://jsperf.com/new-array-vs-literal/15 | |
var array = []; | |
// Object literal (={}) is faster than Object constructor (new Object()) | |
// http://jsperf.com/new-array-vs-literal/26 | |
var obj = {}; | |
// property === undefined is faster than hasOwnProperty(property) | |
// http://jsperf.com/hasownproperty-vs-in-vs-undefined/17 |
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
for simple charts https://github.com/aomran/ember-cli-chart | |
for more complex charts https://github.com/ahmadsoe/ember-highcharts | |
for custom charts simply d3 |