This file contains 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
.wrapper { | |
width: 400px; | |
height: 200px; | |
background-color: #eee; | |
position: relative; | |
} | |
.header { | |
height: 50px; | |
background-color: #eba; |
This file contains 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
'use strict'; | |
var http = require('http'); | |
var app = http.createServer(function (req, res) { | |
if ('/foo' === req.url) { | |
setTimeout(function() { | |
res.writeHead(200); | |
res.write('foo'); | |
res.end(); |
This file contains 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
.send({ | |
session_key: session_key, | |
name: 'sup', // не работает еще | |
page: 1, // default value | |
per_page: 40, // default value | |
sort: { | |
create_at: -1, | |
users: 1 // не проверял | |
// Можно указывать и другие поля. Они передаются напрямую драйверу в .sort() | |
}, |
This file contains 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
.post('/room/silence') | |
.send({ | |
session_key: session_key, | |
room_id: room._id, // комната | |
user_id: otherTestUser._id, // кого заткнуть | |
finished: (+new Date() + 1000) // timestamp до какого времени активно | |
}) | |
// socket | |
'service-message': { |
This file contains 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
Room.findOne({'chat._id': messageID, 'users': req.user._id}, {'chat.$': 1}, function (err, room) { | |
console.log(room); // {chat: MessageInstance}; | |
}); |
This file contains 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
Logger.prototype.getDate = function () { | |
var date = new Date(); | |
return [ | |
[ | |
date.getFullYear(), | |
date.getMonth() + 1, | |
date.getDate() | |
].join('.'), | |
[ | |
date.getHours(), |
This file contains 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
'use strict'; | |
/** | |
* Module dependencies. | |
*/ | |
var log = require('microlog')(module); | |
var config = require('nconf'); | |
var express = require('express'); | |
// End of dependencies. |
This file contains 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
exports.getDialogs = function () { | |
return function (req, res) { | |
var dialogs = []; | |
_getUsersInDialogs(req.user._id, function (err, users) { | |
users.forEach(function (user, key, all) { | |
_getCountAndLastMessageInDialog(req.user._id, user, function (err, lastMessage, unread) { | |
dialogs.push({user: user, last_message: lastMessage, unread:unread}); | |
if (key === all.length - 1) { | |
res.json(200, { | |
data: { |
This file contains 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
module.exports = function () { | |
return function (req, res) { | |
var pageNum = req.params.pageNum |0; | |
var querySet = {}; | |
querySet['pages.'+pageNum] = false; | |
Project | |
.update({_id: req.params.projectID, owner: req.user._id}, {$set: querySet}) | |
.exec(function (err, updated) { | |
err | |
? res.json(500, {error: err.message}) |
This file contains 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
module.exports = function () { | |
var ObjectId = mongoose.Schema.ObjectId; | |
return function (req, res) { | |
mongoose | |
.model('Project') | |
.aggregate({ | |
'$match': { | |
'pages.texts._id': ObjectId(req.params.componentID) | |
} | |
}) |