Skip to content

Instantly share code, notes, and snippets.

View boo1ean's full-sized avatar
🎯
Focusing

Egor Gumenyuk boo1ean

🎯
Focusing
View GitHub Profile
const EditPage = (props) => {
switch (true) {
case editPlatformNoData(props): return fetchPlatform(props)
case editPlatformHasData(props): return <EditForm onSubmit={props.updatePlatform} initialValues={props.data} />
case newPlatform(props): return <EditForm onSubmit={props.createPlatform} />
case error(props): return <h2>нельзя такое редактировать</h2>
default: throw new Error('Undefined state')
}
class Math {
add(a, b) {
return a + b;
}
sub(a, b) {
return a - b;
}
}
module.exports = {
sum: (a, b) => {
return a + b;
},
sub: (a, b) => {
return a - b;
}
}

Join channel

Join to channel using specified identifier. After joining user will remain active in channel until manual leave request

Request

POST /channels/{channel_name}/join

Join channel

Join to channel using specified identifier. After joining user will remain active in channel until manual leave request

Request

POST /channels/{channel_name}/join
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
context: path.join(__dirname, '../frontend'),
entry: [
path.join(__dirname, '../frontend'),
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
shim: {
'jquery': {
path: 'public/vendor/jquery/jquery.js',
exports: '$'
},
'underscore': {
path: 'public/vendor/lodash/dist/lodash',
exports: '_'
},
'backbone': {
define(["marionette", "underscore"],
function(Marionette, _) {
return Marionette.AppRouter.extend({
appRoutes: {},
initialize: function(modules) {
this.appRoutes = _.extend.apply(null, _.pluck(modules, "appRoutes"));
this.controller = _.extend.apply(null, _.pluck(modules, "actions"));
this.listenTo(app, "navigate", function(location, force) {
if (force) {
define(["marionette", "underscore"], function(Marionette, _) {
return Marionette.Controller.extend({
mixins: [],
initialize: function(options) {
this.mixinModules();
this.m = {}; // Module models
this.c = {}; // Module collections
this.v = {}; // Modules views
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = new httpProxy.createProxyServer();
http.createServer(function (req, res) {
proxy.web(req, res, {
target: req.url
});
}).listen(8000);