This gist shows how we can run one of ember's qunit tests from jsbin. Should be possible to fork this and use as starting point for testing example code or components.
To open this gist in jsbin, visit: http://jsbin.com/gist/4991413
This gist shows how we can run one of ember's qunit tests from jsbin. Should be possible to fork this and use as starting point for testing example code or components.
To open this gist in jsbin, visit: http://jsbin.com/gist/4991413
| # copied and modified from a working app, but there maybe typos in adaptation | |
| # untested in this form | |
| # router | |
| App.Router.map (match) -> | |
| @resource 'posts', -> | |
| @route 'new' | |
| @resource 'post', path: '/:post_id' | |
| App.PickADate = Ember.View.extend | |
| attributes: ['monthsFull', 'monthsShort', 'weekdaysFull', 'weekdaysShort', | |
| 'monthPrev', 'monthNext', 'showMonthsFull', 'showWeekdaysShort', 'today', | |
| 'clear', 'format', 'formatSubmit', 'hiddenSuffix', 'firstDay', 'monthSelector', | |
| 'yearSelector', 'dateMin', 'dateMax', 'datesDisabled', 'disablePicker'] | |
| events: ['onOpen', 'onClose', 'onSelect', 'onStart'] | |
| attributeBindings: ['type', 'value', 'placeholder'] | |
| type: 'text' | |
| tagName: 'input' |
| UI.DatePicker = Ember.View.extend UI.Widget, | |
| uiType: 'datepicker' | |
| uiOptions: ['disabled', 'contrainInput', 'dateFormat', 'defaultDate', 'maxDate', 'minDate', ] | |
| uiEvents: ['create', 'beforeShow', 'beforeShowDay', 'onChangeMonthYear' | |
| 'onClose', 'onSelect'] | |
| attributeBindings: ['type', 'value', 'placeholder'] | |
| type: 'text' | |
| tagName: 'input' |
| State = (hash) -> Em.State.extend hash | |
| TransitionTo = Em.State.transitionTo | |
| C = null | |
| Receivers.WithdrawController = Em.ObjectController.extend | |
| receiverController: null | |
| router: null | |
| init: -> | |
| @_super() |
| // activeModelValidations | |
| // | |
| // This code is responsible for doing live validations in a form based on a | |
| // JSON object serialized from the Rails' ActiveModel::Validations. This | |
| // prototype interprets this JSON to do the validations. | |
| // | |
| // The entry point is: | |
| // | |
| // activeModelValidations.observe(JSON) | |
| // |
Many existing JSON APIs are not consistent between types. As JSON endpoints grew organically and were built by different engineers at different times, the style in which records are represented can vary wildly.
Historically, we have asked adapter authors to rely on the fact that the type of record is
provided to all adapter hooks (either by passing a type argument, or by passing a record
WARNING
This gist is outdated! For the most up-to-date information, please see http://emberjs.com/guides/routing/!
An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.
<header>
| :set -Wall -fno-warn-type-defaults | |
| :set -fdefer-type-errors | |
| -- :set prompt "λ> " | |
| :set prompt "H̢̞̘̻̲̩̑̊ͣ̏ͪ̋ͨͮ͋̆͐ͣ̈̒͛̚͡A̴̡̬̼̳͈̮̞̬̞̯͓̤͎̳̫̘̥͈͕̓̍͂͌̓̄͒̿͌̚͟͠S͊̾̃̎͏̷̧̠̤͎̱̱͖͍̖̯̘͘K̶̸̲̳̗̭̹͔͖͇̩̳̦̫̲̩̫̪̠̜̅̌̈́̃̊̚͢ͅE̡̩͕̣̳͓͈͙̪̰ͤ̊͂ͩL̬̙͖̣̱͎͓̘͉̖̭͇͚̲͖̩̞͖̂͛̉ͬ̓͐ͯ͌͘͠͠L̢̧̤̺̩͚͚̩̬̳͉͍̩̆̍ͮ̐̽̌̌ͪ̓ͥͫ̓͑̃ͥ͊͟͢͡ ̩̯̺̖̳̟͖͓͇̗͇̘̬͕̑ͩ̄ͧͧ̀́͆͊̈́̋ͫͥ̓͒̂̓́Ḥ̵̫̮̟̠͖̝̜̬͔̻͓͋͊́ͫ̓̍̆̇͐ͥ̓͆́̚Ȩ̸̨̢͕͚̻͍̯̪̩̯̲͛̓ͥ̄͊̀̽ͯ͊̄̔̈ ̱͖̫̱̺̲̥̦̯̞̘͖̳̝̰͉̮̖ͧ̋͊̓ͪ́̏͑ͬ̈́ͣ̍͑̐͂̄ͦ̃̀͢͡ͅC̷̙̟̫̘̞̦̅̄̂͒̉̈́͌̂ͫ́̐̃̎̎ͬͯ͞O̢͛̂͒ͪ͐̓̎̊͊̋̚͏̢̤̺̱̯͇͓̤͍̼̪́M̨̠̝̻͇̘̣̫͕̗̎̾̄̽͊ͣ́͋̎̆ͧ̅͗̚Ẽ̜̠̦̺͇̠̭̣͓͎́̈̉̕͞S̛̩͔̥̼̰̯͖͉̭̺̦͔̞̹̼̻̻̈́͋͋ͬͤ̿͒͘͘͘>̨̧͖͖̱̟̩͕͇͇ͨ͛̔̉́ͤ́͗͗̂͜͞ " | |
| :set -XBangPatterns | |
| :set -XDataKinds | |
| :set -XDeriveDataTypeable | |
| :set -XDeriveFoldable |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.