Skip to content

Instantly share code, notes, and snippets.

Avatar

George Stefanis skywritergr

View GitHub Profile
View gist:9b01c407791154ef7a25cc00f2f213d5
import 'awesome-transferwise-library';
import 'bootstrap/dist/js/bootstrap';
import 'bootstrap/dist/css/bootstrap.css';
View gist:749c75a6c864b9d31e811952f2990241
// ...
externals: {
moment: 'moment'
}
// ...
@skywritergr
skywritergr / webpack.conf.js
Last active Feb 24, 2018
webpack-visualizer
View webpack.conf.js
var Visualizer = require('webpack-visualizer-plugin');
//...
plugins: [new Visualizer()],
//...
View Dockerfile_ibm_driver
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"]
View webpack.config.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'
},
View react-tutorial-browserify.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
View react-tutorial-gulpfile.js
var gulp = require('gulp'),
requireDir = require('require-dir');
requireDir('./gulp');
gulp.task('default', ['browserify']);
View react-tutorial-Index.html
<!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>
View complicatedObject.json
{
"id": 123,
"name": "Awesome TV series",
"watched": false,
"children": [
{
"id": 4324,
"name": "Season 1",
"watched": false,
"children": [
View recursiveFunction.js
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);
}
You can’t perform that action at this time.