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
| function getTrilateration(position1, position2, position3) { | |
| var xa = position1.x; | |
| var ya = position1.y; | |
| var xb = position2.x; | |
| var yb = position2.y; | |
| var xc = position3.x; | |
| var yc = position3.y; | |
| var ra = position1.distance; | |
| var rb = position2.distance; | |
| var rc = position3.distance; |
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
| //source: http://blog.koalite.com/2017/02/tratar-con-fechas-en-json-en-javascript-y-typescript/ | |
| const dateParser = (key, value) => { | |
| if (typeof value !== 'string') | |
| return value; | |
| const isoDate = /(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})[+-](\d{2})\:(\d{2})/; | |
| return value.match(isoDate) ? new Date(value) : value; | |
| }; |
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
| export const runSameScope = () => { | |
| let i = 0; | |
| for(i= 0; i < 5; i++) { | |
| setTimeout(() => console.log('I has', i)) // 5 5 5 5 5 | |
| } | |
| }; | |
| export const runScopes = () => { | |
| let i = 0; | |
| for(i = 0; i < 5; i++) { |
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 fn1 = (v1) => `fn1(${v1})`; | |
| const fn2 = (v2) => `fn2(${v2})`; | |
| const fn3 = (v3) => `fn3(${v3})`; | |
| // Funcion que recibe un listado de funciones como argumentos y devuelve una funci贸n | |
| // la cual acepta un conjunto de parametros como argumentos. | |
| // La funci贸n creada ejecuta cada funci贸n pasada como argumento a su funci贸n creadora y devuelve un | |
| // array con el resultado de la ejecuci贸n de cada funci贸n pasandoles a estas sus propios argumentos | |
| const hof = (...fns) => (...args) => { | |
| //let result = []; |
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
| // connect() is a function that injects Redux-related props into your component. | |
| // You can inject data and callbacks that change that data by dispatching actions. | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // It lets us inject component as the last step so people can use it as a decorator. | |
| // Generally you don't need to worry about it. | |
| return function (WrappedComponent) { | |
| // It returns a component | |
| return class extends React.Component { | |
| render() { | |
| return ( |