- Apresentacao da gente
- Gileno: Segue com os slides
-
Gileno: Insere angularjs, ng-app, app, data, homecontroller.
-
Ramon:
var glob = require("glob"); | |
var fs = require("fs"); | |
// async map file contents | |
var async = function async(arg, callback) { | |
fs.readFile(arg, 'utf8', function (err, data) { | |
if (err) throw err; | |
callback(arg, data); | |
}); | |
}; |
<!doctype html> | |
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="pt-br"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="pt-br"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="pt-br"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js" lang="pt-br"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<title>Title of your website</title> | |
<!-- SEO meta tags --> |
// this file would be under "sass" directory | |
@mixin new-icon( $name, $is-sprite: false ){ | |
$icon-path: 'icons/' + $name + '-icon.png'; | |
display: inline-block; | |
width: image-width($icon-path); | |
height: image-height($icon-path); | |
@if $is-sprite { | |
$sprite-name: $name + '-icon'; |
(function() { | |
function getTreeWalker(root, onlyComponents) { | |
return document.createTreeWalker( | |
root, | |
NodeFilter.SHOW_ELEMENT, | |
{ | |
acceptNode: function(node) { | |
if (onlyComponents) { | |
if (node && node.nodeType === 1 && node.dataset.component) { | |
return NodeFilter.FILTER_ACCEPT; |
this.$table.addEventListener('click', function(event) { | |
var state = store.getState(); | |
// [Prevent dispatch under certain conditions] | |
// Otherwise, trigger `SET_X` or `SET_O` | |
store.dispatch({ | |
type: state.turn === 'x' ? 'SET_X' : 'SET_O', | |
index: parseInt(index, 10) | |
}); | |
}); |
// [require modules and do some express setup] | |
// ...and here is where the magic happens: | |
io.on('connection', function(socket) { | |
socket.on('room', function(room) { | |
socket.join(room); | |
}); | |
socket.on('dispatch', function(data) { | |
socket.broadcast.to(data.room).emit('dispatch', data); | |
}); |
function Store() { | |
this.state = {}; | |
this.state = this.update(this.state, {}); | |
// `this.update()` will return the initial state: | |
// ---------------------------------------------- | |
// { | |
// grid: ['', '', '', '', '', '', '', '', ''], | |
// turn: 'x', | |
// score: { x: 0, o: 0 }, |
// `config.room` is a random ID generated on page load. | |
var socket = io(); | |
TicTacToe.prototype.init = function(config) { | |
this.room = config.room; | |
}; | |
TicTacToe.prototype.eventListeners = function() { | |
socket.on('connect', this.onSocketConnect.bind(this)); | |
socket.on('dispatch', this.onSocketDispatch.bind(this)); |
// Reducer (pure function) | |
function updatePlayer(player, action) { | |
switch (action.type) { | |
case 'PICK_SIDE': | |
return action.side; | |
default: | |
return player || ''; | |
} | |
} |