This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Demos | |
| - name: react-movies-app | |
| repo: https://github.com/trainings-juanmaguitar/react-movies-app | |
| online: http://react-movies.surge.sh/ | |
| description: demo created w/ create-react-app that shows th use of react w/ react-router and react-bootstrap, results with pagination | |
| snapshot: https://raw.githubusercontent.com/trainings-juanmaguitar/react-movies-app/master/md-img/movie-finder-snapshot.png | |
| tags: react, demo, online, surge react-router | |
| - name: socket-react-example-simple | |
| repo: https://github.com/trainings-juanmaguitar/socket-react-example-simple | |
| description: Demo that shows the use of socket.io with a react app |
Run programs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm i -D babel-preset-es2015 babel-preset-stage-2 babel-preset-react | |
| npm i -D babel-eslint eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-standard prettier-eslint | |
| curl -fsSL https://gist.githubusercontent.com/juanmaguitar/f8f09d9eda71d8bd77b88c8bfac32cda/raw/e8322eb79ade613996ed503cd962040cbbfffe06/.babelrc > .babelrc | |
| curl -fsSL https://gist.githubusercontent.com/juanmaguitar/f8f09d9eda71d8bd77b88c8bfac32cda/raw/e8322eb79ade613996ed503cd962040cbbfffe06/.eslintrc > .eslintrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ERROR_METHODS_AS_STRINGS = 'Interface constructor expects method names to be passed in as a string' | |
| const ERROR_PROPERTIES_AS_STRINGS = 'Interface constructor expects property names to be passed in as a string' | |
| const ERROR_NO_OBJECT = 'No Object to check' | |
| const ERROR_METHOD_NOT_IMPLEMENTED = (interface, method) => `The object does not implement the interface ${interface}. Method ${method} not found.` | |
| const ERROR_PROPERTY_NOT_IMPLEMENTED = (interface, property) => `The object does not implement the interface ${interface}. Property ${property} not found.` | |
| const isString = text => typeof text === 'string' | |
| const isFunction = fn => typeof fn === 'function' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EventEmitter = { | |
| _events: {}, | |
| publish: function (event, data) { | |
| if (!this._events[event]) return; // no one is listening to this event | |
| this._events[event].forEach( callback => callback(data) ) | |
| }, | |
| subscribe: function (event, callback) { | |
| if (!this._events[event]) this._events[event] = []; // new event | |
| this._events[event].push(callback); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sum = (a,b) => a+b | |
| const multiplication = (a,b) => a*b | |
| const showResult = msg => fn => (a,b) => `${msg} ${fn(a,b)}` | |
| showResult("sum is ")(sum)(2,4) // sum is 6 | |
| showResult("result = ")(multiplication)(2,4) // result = 8 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>Hello World</title> | |
| <script src="https://unpkg.com/react@16/umd/react.development.js"></script> | |
| <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script> | |
| <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script> | |
| </head> | |
| <body> |