- Apresentacao da gente
- Gileno: Segue com os slides
-
Gileno: Insere angularjs, ng-app, app, data, homecontroller.
-
Ramon:
| // [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); | |
| }); |
| // Reducer (pure function) | |
| function updatePlayer(player, action) { | |
| switch (action.type) { | |
| case 'PICK_SIDE': | |
| return action.side; | |
| default: | |
| return player || ''; | |
| } | |
| } |
| 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) | |
| }); | |
| }); |
| 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 }, |
| var wait = function(ms) { | |
| ms = ms || 500; | |
| return new Promise(function(resolve, reject){ | |
| window.setTimeout(function() { | |
| resolve(); | |
| }, ms); | |
| }); | |
| }; | |
| // USAGE |
| (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; |
| 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); | |
| }); | |
| }; |
| var getYoutubeIdByUrl = function( url ){ | |
| var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; | |
| var match = url.match(regExp); | |
| if(match&&match[7].length==11){ | |
| return match[7]; | |
| } | |
| return false; | |
| }; |
| // 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'; |