Skip to content

Instantly share code, notes, and snippets.

View vadirn's full-sized avatar
🏠
Working from home

Vadim K. vadirn

🏠
Working from home
View GitHub Profile
{
"plugins": ["import", "jsx-a11y", "react"],
"parser": "babel-eslint",
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const pkg = require('./package.json');
let settings = {
version: pkg.version,
nodeEnv: 'development',
appEnv: process.env.APP_ENV || 'development',
export default {
exampleController: (cb) => {
require.ensure([], (require) => {
cb(require('./ExampleController').default);
});
},
};
import React from 'react';
import ReactDOM from 'react-dom';
import ObjectStateStorage from 'object-state-storage';
class Session {
constructor(mountPoint, controllers) {
if (!mountPoint) {
throw new Error('"mountPoint" property is not defined');
}
import { injectDeps } from 'components-di';
import RootComponent from '../../ui/views/Example';
class ExampleController {
constructor(initialState, context) {
// context has store reference and a function to replace controller
this._context = context;
this._context.store.resetState(initialState);
this._view = injectDeps(this.context, this.actions)(RootComponent);
}
// utility function, tests if provided item is a key-value object and not an array
const isObject = item => typeof item === 'object' && item !== null && !Array.isArray(item);
// utility function, clones key-value objects
export const clone = (item) => JSON.parse(JSON.stringify(item));
// utility function, recursively merges key-value objects
export const merge = (to, from) => {
import React from 'react';
import hoistStatics from 'hoist-non-react-statics';
const getDisplayName = Component => (
Component.displayName || Component.name || 'Component'
);
const isObject = item => typeof item === 'object' && item !== null && !Array.isArray(item);
// creates a new actions list with initial context argument set
@vadirn
vadirn / .babelrc
Last active February 10, 2017 16:56
{
"presets": [
["latest", { "es2015": { "modules": false } }],
["react"],
["env", {
"useBuiltIns": true,
"debug": false,
"targets": {
"browsers": ["last 3 versions"]
}
@vadirn
vadirn / .eslintrc
Last active February 21, 2017 13:02
Eslint configuration file
{
"plugins": ["import", "jsx-a11y", "react"],
"parser": "babel-eslint",
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->