Skip to content

Instantly share code, notes, and snippets.

View joshjung's full-sized avatar

Joshua Jung joshjung

View GitHub Profile
@joshjung
joshjung / webpack.config.prod.js
Created November 14, 2017 11:26
Asynchronous Webpack Configuration
...
// Build your configuration object, and then return a Promise
let finalConfig = {
devtool: 'eval',
output: { /* your configuration */ },
plugins: [ /* your configuration */ ]
};
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const prodBuild = require('./webpack.config.prod.js');
module.exports = new Promise(resolve => {
prodBuild.then(build => {
build.plugins.push(new BundleAnalyzerPlugin());
resolve(build);
});
});
const webpack = require('webpack');
const path = require('path');
const ROOT_PATH = path.resolve(process.env.PWD);
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UGLIFY_WHITELIST = require('./uglifyWhitelist.json');
require('babel-polyfill');
const webpack = require('webpack');
const path = require('path');
const ROOT_PATH = path.resolve(process.env.PWD);
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UGLIFY_WHITELIST = require('./uglifyWhitelist.json');
require('babel-polyfill');
import DebugInspector from 'ringa-fw-react/src/components/debugInspector/DebugInspector';
import Theme from 'ringa-fw-react/src/components/containers/Theme';
...
render() {
return <Theme>
{this.props.children} // The rest of your application...
<DebugInspector />
</Theme>;
}
/**
* In the game 2048, the board consists of a 2-dimensional array of values.
*
* Every tile will always be a power of 2, starting with 2.
*
* The player can swipe left, up, right, or down. When this happens the numbers
* "collapse" in that direction. Duplicate values merge into a single tile and
* after swiping all non-zero values should have shifted in that direction.
*
* NOTE! A maximum of 2 tiles can merge at a time! So if you have a row of [4, 4, 2, 2]
window.Game2048 = function () {
this.cells = [];
this.boardValues = [
[0, 0, 0, 0],
[2, 0, 0, 0],
[0, 0, 0, 0],
[0, 2, 0, 0]];
this.board = [[{}, {}, {}, {}],
[{}, {}, {}, {}],