Skip to content

Instantly share code, notes, and snippets.

View juanmaguitar's full-sized avatar

JuanMa juanmaguitar

View GitHub Profile
# 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
@juanmaguitar
juanmaguitar / install.sh
Last active February 14, 2018 19:58
Scripts Devel Environment
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
@juanmaguitar
juanmaguitar / Interface.js
Created December 18, 2017 17:15
Interface implementation
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'
@juanmaguitar
juanmaguitar / PubSub Implementation
Last active October 8, 2017 16:05
Publish/Subscribe Implementation
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);
}
@juanmaguitar
juanmaguitar / function-composition.js
Created September 29, 2017 09:40
Function Composition Arrow Function
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
@juanmaguitar
juanmaguitar / index.html
Last active September 28, 2017 07:35
React index html scripts cdn
<!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>
@juanmaguitar
juanmaguitar / markdown-bootstrap-angular.md
Last active September 5, 2017 08:45
Markdown Bootstrap Angular Notes

Markdown Bootstrap Angular Notes

Libs

### jquery

<script src="/jquery/dist/jquery.slim.min.js"></script>
@juanmaguitar
juanmaguitar / ClasesES2015.md
Created August 3, 2017 08:14
clases es2015

Clases ES2015

ES5

code

function Person( name ) {
  this.name = name
  console.log(this)