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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style type="text/css"> | |
| body | |
| { | |
| margin: 0; | |
| padding: 0; | |
| background: #fff; |
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
| public function sync() | |
| { | |
| $models = array( | |
| "issue" => new Issue(), | |
| "layout" => new Layout(), | |
| "template" => new Template(), | |
| "page" => new Page(), | |
| "element" => new Element(), | |
| "style" => new Style(), | |
| "event" => new Event(), |
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
| do -> | |
| walk = (parts, value) -> | |
| stack = {} | |
| part = parts.shift() | |
| if parts.length | |
| stack[part] = walk(parts, value) | |
| else | |
| stack[part] = value |
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
| do -> | |
| animate = (property, value, options) -> | |
| moo = moofx(this) | |
| moo and moo.animate(property, value, options) | |
| return this | |
| design = (property, value) -> | |
| moo = moofx(this) | |
| moo and moo.style(property, value) | |
| return this |
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
| do -> | |
| splitter = ":" # e.g. foo:click | |
| key = "events.namespace." # e.g. events.namespace.foo | |
| # do not edit below this line unless you know what you are doing! | |
| addNamespaceEvent = (name, callback, s) -> | |
| [namespace, type] = name.split(s or splitter) | |
| cache = @retrieve(key + namespace) or {} |
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
| Element.implement({ | |
| "call": (name, parameters...) -> | |
| if callback = @retrieve(name) | |
| callback.apply(this, parameters) | |
| }) |
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
| do -> | |
| namespace = "behaviors.tabs" | |
| fm.behaviors.add("tabs", { | |
| "onAdd": (scope, parameters) -> | |
| _tab = parameters?.selector?.tab or ".tab" | |
| _subtabs = parameters?.selector?.subtabs or ".subtabs" | |
| _text = parameters?.selector?.text or ".text" |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>Invaders</title> | |
| <style type="text/css"> | |
| body, html { | |
| width: 100%; | |
| height: 100%; | |
| overflow: hidden; | |
| } |
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
| $up = $container.getElement(".up") | |
| $down = $container.getElement(".down") | |
| $grains = $container.getElement(".grains") | |
| animator = moofx((value) -> | |
| $grains.scrollTop = value | |
| ) | |
| $up.addEvent("click", (e) -> | |
| e and e.preventDefault() |
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
| $callbacks = array( | |
| "cb" => function($value) { | |
| return $value; | |
| } | |
| ); | |
| echo $callbacks["cb"]("hello world"); | |
| // This works in PHP 5.4.4 (not sure when it started working really...) |