(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title>Redirect</title> | |
| <script type="text/javascript"> // <![CDATA[ | |
| //iPhone Version: | |
| if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { | |
| window.location = "http://goo.gl/IWd7J"; | |
| } | 
| var webdriver = require('selenium-webdriver'); | |
| var fs = require('fs'); | |
| var driver = new webdriver.Builder().build(); | |
| webdriver.WebDriver.prototype.saveScreenshot = function(filename) { | |
| return driver.takeScreenshot().then(function(data) { | |
| fs.writeFile(filename, data.replace(/^data:image\/png;base64,/,''), 'base64', function(err) { | |
| if(err) throw err; | |
| }); | 
| git branch -m old_branch new_branch # Rename branch locally | |
| git push origin :old_branch # Delete the old branch | |
| git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote | 
| //*********** IMPORTS ***************** | |
| var gulp = require('gulp'); | |
| var sass = require('gulp-ruby-sass'); | |
| var gutil = require('gulp-util'); | |
| var rename = require("gulp-rename"); | |
| var map = require("map-stream"); | |
| var livereload = require("gulp-livereload"); | |
| var concat = require("gulp-concat"); | |
| var uglify = require('gulp-uglify'); | |
| var watch = require('gulp-watch'); | 
| // Require chai.js expect module for assertions | |
| var chai = require('chai'); | |
| var expect = require('chai').expect; | |
| // Application Server | |
| var serverUri = '0.0.0.0:3000'; | |
| // Official selenium webdriver testing setup | |
| var webdriver = require('selenium-webdriver'); | 
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.
Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.
| var uniqueArray = function(arrArg) { | |
| return arrArg.filter(function(elem, pos,arr) { | |
| return arr.indexOf(elem) == pos; | |
| }); | |
| }; | |
| var uniqEs6 = (arrArg) => { | |
| return arrArg.filter((elem, pos, arr) => { | |
| return arr.indexOf(elem) == pos; | |
| }); | 
| var state = Immutable.fromJS({ | |
| product_preview: { | |
| product_type: '', | |
| media_items: [ | |
| {id: 0, url: 'my_url'}, | |
| {id: 1, url: 'my_url'}, | |
| {id: 2, url: 'my_url'} | |
| ], | |
| }, | |
| }); |