Skip to content

Instantly share code, notes, and snippets.

var path = require('path');
var express = require('express');
var nunjucks = require('nunjucks');
var logger = require('bunyan').createLogger({ name: 'mdz:web' });
module.exports = function (redisClient, config, development) {
'use strict';
var HOST = process.env.FRONT_HOST || 'meduza.io';
var DEST_ROOT = development ? config.DEV_DEST_ROOT : config.DIST_DEST_ROOT;
{
"root": [
"news/2015/01/21/zhopik",
"news/2015/01/21/another-test",
"feature/2015/01/21/ficher-s-bez-kartin",
"news/2015/01/19/test-memchikov",
"cards/kak-ustroen-zakon-pro-inostrantsev-v-smi",
"galleries/2015/01/16/charlie-hebdo",
"galleries/2014/11/21/poves-moy-brauzer",
"news/2014/11/18/novost-na-proverku-reklamy-s-otnositelnym-urolom",
export default {
getInitialState() {
const data = {};
this.subscribe(this.props, this.context, (key, value) => {
data[key] = value;
});
this.unsubscribe();
return { data };
@itrelease
itrelease / Stateful.js
Last active August 29, 2015 14:19 — forked from gaearon/Stateful.js
import React, { Component } from 'react';
// Usage:
//
// @Stateful({
// initialize(props) {
// return {
// count: 0
// };
// },
function sort(arr) {
var tmp = [];
var sorted = [];
var i, l;
var ii, ll;
for (i=0, l=arr.length; i<l; i++) {
var value = arr[i];
if (!tmp[value]) {
@itrelease
itrelease / pu.js
Last active August 29, 2015 14:20
pack-unpack
function serialize(root) {
if (root == null)
return "- ";
else {
return root.value + " " + serialize(root.node.left) + serialize(root.node.right);
}
}
function deserialize(string) {
var tokens = string.trim().split(' ');
/**
* Stores are just seed + reduce function.
* Notice they are plain objects and don't own the state.
*/
const countUpStore = {
seed: {
counter: 0
},
reduce(state, action) {
@itrelease
itrelease / transd.js
Created July 5, 2015 14:03
Transducers difference?
/* NINJA FP */
function mapping(transform) {
return function (reduce) {
return function (result, input) {
return reduce(result, transform(input));
};
};
}
/* @flow */
type State = Object
type Action = {type: string | void}
type AsyncAction = (performAction: FluxPerformFunction, state: State) => void
type ActionCreator = () => Action | AsyncAction
type StoreFunction = (state: State, action: Action) => State
@itrelease
itrelease / bloop.js
Last active August 29, 2015 14:25 — forked from jlongster/bloop.js
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}