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
| require 'childprocess' | |
| Before do | |
| @process = ChildProcess.build "bundle exec shotgun -p 9394" | |
| @process.environment['RACK_ENV'] = "test" | |
| @process.start | |
| sleep 3 | |
| end | |
| After do |
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
| FIXTURES = {} | |
| FIXTURES.someXml = | |
| """ | |
| <xml> | |
| ... | |
| </xml> | |
| """ |
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
| #to use JST's as rails gives them to you | |
| Backbone.LayoutManager.configure | |
| fetch: (name) -> window.JST[name] | |
| render: (template, context) -> template(context) | |
| Backbone.LayoutManager.configure | |
| fetch: (name) -> OE.template[name] | |
| render: (template, context) -> template(context) |
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
| class App.SerializableView extends Backbone.View | |
| render: (layout) -> | |
| if layout | |
| layout(@).render(@serialize?() or @serialize).then => | |
| _.defer => @trigger('rendered') | |
| else | |
| $(@el).html(JST[@template](@serialize?() or @serialize)) | |
| @trigger('rendered') | |
| @ |
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
| class App.CollectionView extends App.SerializableView | |
| constructor: (options) -> | |
| @bind('rendered', => @__renderItems() unless @__itemsHaveBeenInitiallyRendered) | |
| super(options) | |
| @collection.bind('add',@__renderAddedItem) | |
| ensureAtLeastOneItem: => | |
| if @collection.size() == 0 | |
| @collection.add({}) |
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
| class App.SomeCollectionView extends App.CollectionView | |
| template: "templates/some_collection" | |
| itemContainerSelector: '.some-stuff' | |
| wrapItemsIn: $('<li></li>') | |
| initialize: -> | |
| @itemViewType = App.SomeView | |
| serialize: -> some: @collection |
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
| #Boring Models | |
| class Fruit extends Backbone.Model | |
| class AppleTree extends Backbone.Model | |
| defaults: | |
| pantothenicAcid: 0.061 | |
| fruitName: "apple" | |
| class OrangeTree extends Backbone.Model | |
| defaults: |
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
| src_files: | |
| - "application.js" | |
| stylesheets: | |
| helpers: | |
| - "helpers/**/*.{js,coffee}" | |
| spec_files: | |
| - "**/*[Ss]pec.{js,coffee}" |
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
| POST /inquiries HTTP/1.1 | |
| Host: localhost:3000 | |
| Connection: keep-alive | |
| Content-Length: 714 | |
| Origin: http://localhost:3000 | |
| X-CSRF-Token: hyxAFmqN6aK4KwwnMHDzL8gmnwhJ0a3L0rHlQUrdpHE= | |
| X-Requested-With: XMLHttpRequest | |
| User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11 | |
| Content-Type: application/json | |
| Accept: application/json, text/javascript, */*; q=0.01 |
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
| door.open "A", (room) -> | |
| room.explore() | |
| door.open("B", (room) -> | |
| room.explore() | |
| ) |