Skip to content

Instantly share code, notes, and snippets.

View Juanjofp's full-sized avatar
💭
Learning

Juanjo Juanjofp

💭
Learning
View GitHub Profile
@Juanjofp
Juanjofp / trilateration.js
Created June 24, 2020 18:17 — forked from kdzwinel/trilateration.js
Simple trilateration algorithm implementation in JavaScript.
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;
@Juanjofp
Juanjofp / connect.js
Created October 31, 2017 11:20 — forked from gaearon/connect.js
connect.js explained
// 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 (