This file contains 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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
This file contains 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
createAttributeMonitor = -> | |
monitored = Object.create null | |
(parentModel, name) -> | |
bubbleEvent = (event, args...) -> | |
return unless event.startsWith 'change:' | |
parentModel.trigger "change:#{name}.#{event[7..]}", args... | |
value = parentModel.get name | |
oldValue = monitored[name] |
This file contains 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
createAttributeMonitor = -> | |
monitored = Object.create null | |
(parentModel, name) -> | |
bubbleEvent = (event, args...) -> | |
return unless event.startsWith 'change:' | |
parentModel.trigger "change:#{name}.#{event[7..]}", args... | |
value = parentModel.get name | |
oldValue = monitored[name] |
This file contains 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 Model extends Backbone.Model | |
initialize: -> | |
super | |
monitor = createAttributeMonitor() | |
# Bind to initial attributes. | |
monitor @, name for name of @attributes | |
# Watch for changes to attributes and rebind as necessary. | |
@on 'change', => |
This file contains 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
app.track.config.on 'change', -> updateView() |
This file contains 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
app.track.on 'change:config', -> | |
app.track.config.on 'change', -> updateView() |
This file contains 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
app.track.on 'change:config', -> | |
app.track.config.on 'change', -> updateView() |
This file contains 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
# This code... | |
app.track.config.on 'change', -> updateView() | |
# ...becomes this: | |
app.on 'change:track.config', -> updateView() |
This file contains 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
Process: Grandroids [11089] | |
Path: /Users/USER/Downloads/*/GrandroidsMac.app/Contents/MacOS/Grandroids | |
Identifier: unity.Steve Grand.Grandroids | |
Version: Unity Player version 4.3.4f1 (4.3.4f1) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [253] | |
Responsible: Grandroids [11089] | |
User ID: 501 | |
Date/Time: 2014-04-25 14:17:17.574 +0200 |
This file contains 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 ReactiveValue = function(value) { | |
var dep = new Deps.Dependency(); | |
var state = value; | |
this.get = function() { | |
dep.depend(); | |
return state; | |
} | |
this.set = function(newValue) { | |
if (state === newValue) return; | |
state = newValue; |
OlderNewer