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
| { | |
| "code": 400, | |
| "message": "Invalid submitted data", | |
| "errors": [ | |
| { message: ... }, | |
| { message: ... }, | |
| { field: ..., message: ... }, | |
| { field: ..., message: ... } | |
| ] | |
| } |
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
| import Route from './../core/route'; | |
| import Application from '../core/application'; | |
| import Auth from './../services/auth.js'; | |
| import Products from '../models/products'; | |
| import OwnedProducts from '../models/owned_products'; | |
| import ClosetView from '../views/closet.js'; | |
| export default Route.extend({ | |
| ownedProducts: null, | |
| busy: false, |
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
| import Route from './../core/route'; | |
| import Application from '../core/application'; | |
| import Auth from './../services/auth.js'; | |
| import Products from '../models/products'; | |
| import OwnedProducts from '../models/owned_products'; | |
| import ClosetView from '../views/closet.js'; | |
| export default Route.extend({ | |
| ownedProducts: null, | |
| busy: false, |
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
| const STATUS_CREATED = 'created' | |
| , STATUS_PENDING = 'pending' | |
| , STATUS_STARTED = 'started' | |
| , STATUS_FINISHED = 'finished'; | |
| const TYPE_1X1 = '1x1' | |
| , TYPE_2X2 = '2x2'; | |
| var mongoose = require('mongoose'), |
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
| /** | |
| * @param {{ gameId: string, userId: string }} data | |
| * @param {Function} done | |
| * @returns {*} | |
| */ | |
| connectionMessage: function(data, done) { | |
| var that = this; | |
| async.waterfall([ | |
| function(next) { |
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
| /** | |
| * @param {{ gameId: string, userId: string }} data | |
| * @param {Function} done | |
| * @returns {*} | |
| */ | |
| connectionMessage: async.cps(function(data) { | |
| var user = await(ApiUser.findOne.bind(ApiUser, { _id: data.userId })), | |
| apiGame = await(ApiGame.findOne.bind(ApiGame, { _id: data.gameId })); | |
| try { |
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
| { | |
| "env": { | |
| "node": true | |
| }, | |
| "globals": { | |
| "require": true, | |
| "describe": true, | |
| "context": true, | |
| "it": true, | |
| "before": true, |
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
| Game.prototype.hasCombo = function() { | |
| for (var index = 0, l = this.state.length; index < l; index++) { | |
| var combo = [], | |
| skip = [], | |
| current, | |
| next; | |
| current = index; | |
| while (true) { | |
| combo.push(current); |
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 protoify = require('../lib/protoify'), | |
| started; | |
| started = Date.now(); | |
| var m = protoify.encode({ getConnectionMessage: { token: 'qqweqweqweqwe' } }); | |
| console.log(m); | |
| console.log('time taken %s', started - Date.now()); |
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
| player:1 connection +0ms | |
| player:2 connection +2s | |
| game:1 start +1ms | |
| player:1 send: {"type":"state","data":[1,1,1,1,1,1,2,2,1,0,1,1,2,1,2,1,0,1,2,2,2,1,1,2,2,2,1,1,1,2]} +0ms | |
| player:2 send: {"type":"state","data":[1,1,1,1,1,1,2,2,1,0,1,1,2,1,2,1,0,1,2,2,2,1,1,2,2,2,1,1,1,2]} +2ms | |
| player:3 connection +23s | |
| player:1 disconnection +19s | |
| game:1 finish +1ms | |
| player:2 send: {"type":"result","data":1} +0ms | |
| player:4 connection +541ms |