Updated for Rails 4.0.0+
-
Set up the
bower
gem. -
Follow the Bower instructions and list your dependencies in your
bower.json
, e.g.// bower.json
{
Updated for Rails 4.0.0+
Set up the bower
gem.
Follow the Bower instructions and list your dependencies in your bower.json
, e.g.
// bower.json
{
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
#connect resque web to different redis server | |
`resque-web ./resque-conn.rb` | |
#cat ./resque-conn.rb => | |
Resque.redis = Redis.new(:host => “127.0.0.1”, :port => 6379, :db => 1) |
DS.RESTSerializer.extend({ | |
extractArray: function(store, type, payload) { | |
var inflector = Ember.Inflector.inflector, | |
data = payload || [], | |
modifiedPayload = {}; | |
modifiedPayload[inflector.pluralize(type.typeKey)] = data; | |
return this._super(store, type, modifiedPayload); | |
} |
/* | |
* This decorates Handlebars.js with the ability to load | |
* templates from an external source, with light caching. | |
* | |
* To render a template, pass a closure that will receive the | |
* template as a function parameter, eg, | |
* T.render('templateName', function(t) { | |
* $('#somediv').html( t() ); | |
* }); | |
* Source: https://github.com/wycats/handlebars.js/issues/82 |
### | |
# Namespace | |
### | |
Semantic = window.Semantic = Ember.Namespace.create | |
UI_DEBUG: false | |
UI_PERFORMANCE: false | |
UI_VERBOSE: false | |
### | |
# Mixin |
var nodify = require('nodify'); | |
// Prints build time | |
console.log(nodify(function() { | |
return new Date(); | |
})); | |
// Prints current time | |
console.log(new Date()); |
var cluster = require('cluster'); | |
if (cluster.isMaster) { | |
// Fork workers. | |
for (var i = 0; i < 20; i++) { | |
cluster.fork(); | |
} | |
return ; |
Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:
Use Ember CLI
In general, replace views + controllers with components
Only use controllers at the top-level for receiving data from the route, and use Ember.Controller
instead of Ember.ArrayController
or Ember.ObjectController
Fetch data in your route, and set it on attrs
on your top-level controller:
```js
//controllers/index.js
import Ember from 'ember';