An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars
.
<header>
<img src="masthead">
</header>
<footer>
App.Router.map(function(match) { | |
match("/posts/:post_id").to("post"); | |
}); | |
App.PostRoute = Ember.Route.extend({ | |
// default implementation | |
deserialize: function(router, params) { | |
return App.Post.find(params.post_id); | |
}, |
// var: poor stylistic form, but no leakage | |
function foo() { | |
bar = 3; | |
if (true) { | |
var bar = 5; | |
} | |
} | |
// let: will leak an auto-global | |
function foo() { |
An important feature for Ember Data is providing helpful error messages when your application tries to do something that is forbidden by the data model.
To that end, we would like for the data model to be able to mark certain records, attributes, and relationships as read-only. This ensures that we can provide errors immediately, and not have to wait for a return trip from the adapter.
This also means that the adapter does not need to handle the case where an application developer inadvertently makes changes to a record that it does not conceptually make sense to modify on the client.
App.AccountEditRoute = Ember.Route.extend({ | |
setupController: function(controller) { | |
controller.set('content', this.get('currentUser')); | |
} | |
}); |
React = require 'react/addons' | |
module.exports = React.createClass | |
displayName: 'Icon' | |
propTypes: | |
className: React.PropTypes.string | |
icon: React.PropTypes.string.isRequired | |
render: -> | |
React.createElement 'span', | |
dangerouslySetInnerHTML: |
#!/bin/tcsh | |
# Grab user information. | |
echo "PrivateInternetAccess OpenVPN Setup:" | |
echo " https://www.privateinternetaccess.com/pages/client-control-panel" | |
echo " -> PPTP/L2TP/SOCKS Username and Password" | |
echo -n "User: " | |
set user = $< | |
echo -n "Pass: " | |
set pass = $< |
The idea is to combine the best bit of global styling (reuse, small payload) and local styling (total isolation, first-class React syntax)
This is combined with the concept of traits: you can think of them as permitted property/value pairs. Instead of every component being able to have every CSS property available to it, you can reduce your permitted set to X font families, Y font-size + line-height pairs, Z foreground/background colour pairs, W padding amounts. This is based off my work using amcss on real projects — traits were the single key feature that kept me using AM.
The one-sentence explanation: A site defines a set of permitted visual features, all components are simply a combination of those features
It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.