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
<template name="headingWrapper"> | |
<h1>{{> UI.contentBlock}}</h1> | |
<h4>{{this.subheading}}</h4> | |
</template> | |
<template name="main"> | |
{{#headingWrapper subheading="My Subheading"}} | |
My Heading | |
{{/headingWrapper}} | |
</template> |
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 createHooks; | |
createHooks = function(options) { | |
options = _.defaults(options, { | |
alwaysClass: '', | |
onscreenClass: '', | |
offscreenClass: '', | |
removeClass: '', | |
removeTimeout: 500, | |
insertTimeout: 500 |
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 mod = new Modifier({ | |
origin: [0.5, 0], | |
align: [0.5, 0], | |
opacity: 0.3, | |
transform: Transform.translate(0, 10, 1) // can be a function that runs every tick | |
}) | |
mod.transformFrom(transform); // evaluated every tick | |
mod.opacityFrom(0.3); | |
mod.originFrom(0.5); |
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 Engine = famous.core.Engine; | |
var Surface = famous.core.Surface; | |
var View = famous.core.View; | |
var Modifier = famous.core.Modifier; | |
var MyView = function(){ | |
// Run View as constructor first | |
View.call(this, arguments); | |
this.rootMod = new Modifier({ |
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
// if we keep using Object.create(parent), we might want the parent to | |
// have a constructor function so all children turn out the same | |
parent = { | |
constructor: function(name) { | |
this._name = name; | |
} | |
} | |
child1 = Object.create(parent); |
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
function MyClass(){ | |
} | |
MyClass.prototype.method = function(){} | |
function MySubClass(){ | |
// use MyClass as the constructor | |
MyClass.call(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
# client/views/game.coffee | |
Template.game.events | |
"click .finish-game": (e, tpl) -> | |
e.preventDefault() | |
Games.update({_id: @_id}, {$set: {completed: true}}) | |
"click .delete-game": (e, tpl) -> | |
Games.remove(@_id) |
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
# client/views/games.coffee | |
Template.games.helpers | |
teams: Teams.find() | |
games: Games.find() | |
creating: -> Session.get 'creating-game' | |
Template.games.events | |
"click .create": (e, tpl) -> | |
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
# client/views/games.coffee | |
Template.games.helpers | |
teams: -> Teams.find() | |
games: -> Games.find() | |
creating: -> Session.get 'creating-game' | |
Template.games.events | |
"click .create": (e, tpl) -> | |
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
<!-- client/views/games.html --> | |
<template name="games"> | |
<h3>Games</h3> | |
{{#if creating}} | |
<form class="form-create"> | |
<select name="teamOne"> | |
{{#each teams}} | |
<option value="{{_id}}">{{name}}</option> | |
{{/each}} |