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
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; |
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
{ | |
"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", |
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
export default { | |
getInitialState() { | |
const data = {}; | |
this.subscribe(this.props, this.context, (key, value) => { | |
data[key] = value; | |
}); | |
this.unsubscribe(); | |
return { 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
import React, { Component } from 'react'; | |
// Usage: | |
// | |
// @Stateful({ | |
// initialize(props) { | |
// return { | |
// count: 0 | |
// }; | |
// }, |
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
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]) { |
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
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(' '); |
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
/** | |
* 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) { |
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
/* NINJA FP */ | |
function mapping(transform) { | |
return function (reduce) { | |
return function (result, input) { | |
return reduce(result, transform(input)); | |
}; | |
}; | |
} |
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
/* @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 |
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
(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++; | |
} |