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
class Application extends React.Component { | |
constructor () { | |
super(); | |
this.state = { | |
euro: 0, | |
czk: 0 | |
} | |
} | |
updateEuro (event) { | |
const euro = parseInt(event.target.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 function getRandomValueFromArray (arr) { | |
return arr[ Math.floor(Math.random() * arr.length) ]; | |
} | |
// Credit: João Victor | |
// Github: https://github.com/Jvsierra | |
// CodePen: https://codepen.io/Jvsierra/pen/BNbEjW | |
export function uuidv4 () { | |
function s4() { | |
return Math.floor((1 + Math.random()) * 0x10000) |
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
// Point is inside circle. | |
function isWithinCircle(x, y, circleX, circleY, circleRadius){ | |
return square(circleX - x) + square(circleY - y) < square(circleRadius); | |
} | |
// Two circles interecting | |
function doCirclesIntersect(x1, y1, r1, x2, y2, r2){ | |
return Math.sqrt(square(x1-x2) + square(y1 - y2)) <= r1 + r2; | |
} |