Skip to content

Instantly share code, notes, and snippets.

View skywritergr's full-sized avatar

George Stefanis skywritergr

View GitHub Profile
import 'awesome-transferwise-library';
import 'bootstrap/dist/js/bootstrap';
import 'bootstrap/dist/css/bootstrap.css';
// ...
externals: {
moment: 'moment'
}
// ...
@skywritergr
skywritergr / webpack.conf.js
Last active February 24, 2018 18:02
webpack-visualizer
var Visualizer = require('webpack-visualizer-plugin');
//...
plugins: [new Visualizer()],
//...
FROM node:4.3.1-wheezy
# Install app dependencies
COPY package.json /src/package.json
RUN cd /src; npm install --production
# Bundle app source
COPY . /src
EXPOSE 3000
CMD ["node", "/src/server.js"]
var webpack = require('webpack');
module.exports = {
entry: './public/js/render.jsx',
output: {
// Output the bundled file.
path: './public/build',
// Use the name specified in the entry key as name for the bundle file.
filename: 'bundle.js'
},
var gulp = require('gulp');
var source = require('vinyl-source-stream'); // Used to stream bundle for further handling
var browserify = require('browserify');
var watchify = require('watchify');
var reactify = require('reactify');
var concat = require('gulp-concat');
gulp.task('browserify', function() {
var bundler = browserify({
entries: ['./public/js/render.jsx'], // Only need initial file, browserify finds the deps
var gulp = require('gulp'),
requireDir = require('require-dir');
requireDir('./gulp');
gulp.task('default', ['browserify']);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>React Tutorial</title>
<!-- Not present in the tutorial. Just for basic styling. -->
<link rel="stylesheet" href="css/base.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser.js"></script>
{
"id": 123,
"name": "Awesome TV series",
"watched": false,
"children": [
{
"id": 4324,
"name": "Season 1",
"watched": false,
"children": [
var recursivelyToggle = function recursivelyToggleChildren(array){
var localArray = array;
for(var i=0;i<localArray.length;i++){
var node = localArray[i];
toggleFlag(node); // toggles the flag of the node.
if(node.children){
node.children = recursivelyToggleChildren(node.children);
}