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("sproutcore") | |
| Tictactoe = SC.Application.create() | |
| window.Tictactoe = Tictactoe | |
| require("tictactoe/model/cell") | |
| require("tictactoe/model/game") | |
| require("tictactoe/view/cell_view") | |
| require("tictactoe/view/board_view") |
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
| var pdf:PDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.A4); | |
| pdf.setDisplayMode(Display.FULL_PAGE, Layout.SINGLE_PAGE); | |
| var defaultFont:IFont = new CoreFont(FontFamily.HELVETICA); | |
| pdf.setFont(defaultFont, 11); | |
| var imageHeader:ByteArray = new imageHeaderStream() as ByteArray; | |
| pdf.addImageStream(imageHeader, ColorSpace.DEVICE_RGB, new org.alivepdf.layout.Resize(Mode.NONE, Position.LEFT), -10, -10, 210); | |
| pdf.addImage(dynamicView); |
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
| CliffDetector.stateManager = Ember.StateManager.create | |
| rootElement: $("div[data-role=content]") | |
| map: Ember.ViewState.create | |
| view: CliffDetector.MapView.create() | |
| enter: (stateManager) -> | |
| @_super(stateManager) | |
| console.log "hello" |
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 ListView | |
| constructor: -> console.log "Hello" | |
| $ -> new ListView() |
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 Players extends Meteor.Collection | |
| count: -> | |
| @find().count() | |
| get_idle: -> | |
| @find({ idle: true }) | |
| Players = new Players "players" |
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
| _.extend Template.lobby, | |
| show: true | |
| players: -> | |
| Players.find() | |
| players_count: (-> | |
| @.players().count() | |
| ).bind(Template.lobby) |
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
| View = require './view' | |
| template = require './templates/nav' | |
| application = require 'application' | |
| module.exports = class NavView extends View | |
| tagName: 'nav' | |
| template: template | |
| initialize: -> | |
| console.log 'initializing nav view' |
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
| existingRecords = [ { _id: 1 }, { _id: 2 } ] | |
| requiredRecords = [ { _id: 2 }, { _id: 3 } ] | |
| # I want to find out all the elements of requiredRecords that aren't in existingRecords (there will actually be other properties apart from _id, but I test equality on _id). | |
| => [ { _id: 3 } ] |
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
| // NOT WORKING VERSION | |
| var populateUsers, deferreds, dfd, torch, _i, _len; | |
| deferreds = []; | |
| for (_i = 0, _len = results.length; _i < _len; _i++) { | |
| torch = results[_i]; | |
| dfd = new $.Deferred(); | |
| torch.populateUsers(function(populatedTorch) { |
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
| deferreds = [] | |
| for torch in results | |
| dfd = new $.Deferred() | |
| do (dfd) -> | |
| torch.populateUsers (populatedTorch) -> | |
| dfd.resolve() | |
| deferreds.push dfd.promise() |