Skip to content

Instantly share code, notes, and snippets.

View PavelDemyanenko's full-sized avatar
Right now mostly reacting

xeLL PavelDemyanenko

Right now mostly reacting
View GitHub Profile
Basic saga flow:
// sagas/index.js
export default function* rootSaga() {
yield fork(dataSaga)
// index.js
import rootSaga from './sagas'
A7 data server
контроль теплоснобжения А7 системы
Что такое А7:
data base + applications server = fast big data server
db -> vm+control accsess =>> extenstion, graphs == 1m in memory 50k transactions (couchDB in speed perf)
a7 systems store data in counters for graphics and user actions
react data stores (sets are stored in vesrions vector) (vesrions vector, changes vector)
so the max index of value wins in the case of this structures
merge fucntion is applyied when the replication starts
merge function has access to the index and merge state (vectors)
index: function(req, res) {
User.findOne(req.token).exec(function(err, message) {
// Work with the user here
module.exports = function(req, res, next) {
var token;
if (req.headers && req.headers.authorization) {
var parts = req.headers.authorization.split(' ');
if (parts.length == 2) {
var scheme = parts[0],
credentials = parts[1];
if (/^Bearer$/i.test(scheme)) {
register: function(req, res) {
//TODO: Do some validation on the input
if (req.body.password !== req.body.confirmPassword) {
return res.json(401, {err: 'Password doesn\'t match'});
User.create({email:, password: req.body.password}).exec(function(err, user) {
if (err) {
res.json(err.status, {err: err});
var jwt = require('jsonwebtoken');
module.exports.issueToken = function(payload) {
var token = jwt.sign(payload, process.env.TOKEN_SECRET || "our biggest secret");
return token;
module.exports.verifyToken = function(token, verified) {
return jwt.verify(token, process.env.TOKEN_SECRET || "our biggest secret", {}, verified);
PavelDemyanenko / AuthController.js
Last active August 29, 2015 14:14
authenticate: function(req, res) {
var email = req.param('email');
var password = req.param('password');
if (!email || !password) {
return res.json(401, {err: 'email and password required'});
User.findOneByEmail(email, function(err, user) {
if (!user) {
PavelDemyanenko / .ackrc
Last active August 29, 2015 14:14 — forked from theaboutbox/.ackrc