This file contains 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
public Boolean isWithinCircle(Double x, Double y, Double radius) { | |
final Double TWO = new Double(2); | |
return (Math.pow(x, TWO) + Math.pow(y, TWO)) < Math.pow(radius, TWO); | |
} | |
public List<PhotosCollection> getPhotosCollectionsWithinRadius(List<Locations> locationsList) { | |
List<PhotosCollection> photosCollection = new ArrayList<>(); | |
final Double RADIUS = new Double(10); | |
for(Location location: locationsList) { |
This file contains 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
List<ResultType> resultsList = new ArrayList<>(); | |
final Double TWO = new Double(2); | |
final Double LIMIT = new Double(10); | |
for(ItemType item: itemsList) { | |
if(Math.pow(item.x, TWO) + Math.pow(item.y, TWO) < Math.pow(LIMIT, TWO)) { | |
resultsList.add(item.toResultType()); | |
} | |
} |
This file contains 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
{ | |
app: { | |
users: { | |
user01: { | |
id: "user01", | |
name: "John" | |
}, | |
user02: { | |
id: "user02", | |
name: "Bob" |
This file contains 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
/* | |
index.js | |
*/ | |
import React from "react"; | |
import { render } from "react-dom"; | |
import { Provider } from "react-redux"; | |
import { createStore } from "redux"; | |
import Header from "./Header"; | |
import UserTasks from "./UserTasks"; |
This file contains 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
Show hidden characters
{ | |
"presets": [ | |
"@babel/preset-react", | |
["@babel/preset-env", { | |
"targets": { | |
"browsers": ["last 2 versions", "safari >= 7"] | |
} | |
}] | |
] | |
} |
This file contains 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 initialState = { | |
users: [{ id: "user01", name: "John" }, { id: "user02", name: "Bob" }], | |
tasks: [ | |
{ id: "task01", title: "Wash car", assignee: "user01" }, | |
{ id: "task02", title: "Watch tutorial", assignee: "user01" }, | |
{ id: "task03", title: "Do Homework", assignee: "user02" } | |
], | |
get userTasks() { | |
return this.users.map(user => | |
Object.assign({}, user, { |
This file contains 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 initialState = { | |
users: [{ id: "user01", name: "John" }, { id: "user02", name: "Bob" }], | |
tasks: [ | |
{ id: "task01", title: "Wash car", assignee: "user01" }, | |
{ id: "task02", title: "Watch tutorial", assignee: "user01" }, | |
{ id: "task03", title: "Do Homework", assignee: "user02" } | |
], | |
profiles: [ | |
{ id: "profile01", user: "user01", picture: "picture01URL" }, | |
{ id: "profile02", user: "user02", picture: "picture02URL" } |
This file contains 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
import React from "react"; | |
import { connect } from "react-redux"; | |
const mapStateToProps = (({ userTasksCount }) => ({ userTasksCount })); | |
class Header extends React.Component { | |
render() { | |
const { userTasksCount } = this.props; | |
return <div> | |
{JSON.stringify(userTasksCount)} |
This file contains 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 initialState = { | |
app: { | |
users: [{ id: "user01", name: "John" }, { id: "user02", name: "Bob" }], | |
tasks: [ | |
{ id: "task01", title: "Wash car", assignee: "user01" }, | |
{ id: "task02", title: "Watch tutorial", assignee: "user01" }, | |
{ id: "task03", title: "Do Homework", assignee: "user02" } | |
] | |
}, | |
ui: { /* ... */ } |
This file contains 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
import { createSelector } from "reselect"; | |
const initialState = { | |
app: { | |
users: [{ id: "user01", name: "John" }, { id: "user02", name: "Bob" }], | |
tasks: [ | |
{ id: "task01", title: "Wash car", assignee: "user01" }, | |
{ id: "task02", title: "Watch tutorial", assignee: "user01" }, | |
{ id: "task03", title: "Do Homework", assignee: "user02" } | |
] |