View load-nvmrc.sh
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
load-nvmrc() { | |
local node_version="$(nvm version)" | |
local nvmrc_path="$(nvm_find_nvmrc)" | |
if [ -n "$nvmrc_path" ]; then | |
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") | |
if [ "$nvmrc_node_version" = "N/A" ]; then | |
nvm install | |
elif [ "$nvmrc_node_version" != "$node_version" ]; then |
View PrivateRoute.jsx
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 { withRouter, Redirect } from 'react-router-dom'; | |
const PrivateRoute = (WrappedComponent) => { | |
class PrivateRoute extends React.Component { | |
state = { | |
isLogged: false, | |
} | |
_checkAuthentication() { |
View fragments.js
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 gql from 'graphql-tag'; | |
const USER_FRAGMENT = { | |
account: gql` | |
fragment AccountDetails on FinancialUserType { | |
id | |
username | |
firstName | |
lastName |
View zombies.json
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
[ | |
{ | |
"title": "Classic zombies", | |
"picture": "https://via.placeholder.com/150x80/000000/FFFFFF/?text=Imagem+01", | |
"description": | |
"Slow, quiet and clumsy, the reason for these dead to reanimate is unknown. After a zombie apocalypse, all dead humans turn into zombies. Being bitten by a zombie results in illness and death. Can only be killed by massive brain trauma." | |
}, | |
{ | |
"title": "Voodoo Zombies", | |
"picture": "https://via.placeholder.com/150x80/000000/FFFFFF/?text=Imagem+02", |
View ModalHOC.js
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 { compose, withState, withHandlers } from "recompose"; | |
import { ModalComponent } from "./Modal"; | |
const hoc = compose( | |
withState("showModal", "updateModal", false), | |
withHandlers({ | |
onHandleModal: ({ updateModal, showModal }) => () => updateModal(!showModal), | |
onBtnSuccess: () => () => console.warn("Success"), |
View Modal.js
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 PropTypes from "prop-types"; | |
import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; | |
export const ModalComponent = ({ | |
showModal, | |
onHandleModal, | |
onBtnSuccess, | |
onBtnCancel, | |
mainBtnLabel, |
View ModalClass.js
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 { ModalComponent } from "./Modal"; | |
class ModalContainer extends React.Component { | |
state = { | |
showModal: false | |
}; | |
onHandleModal = () => { |
View mapProps.js
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 { compose, withState, mapProps } from 'recompose'; | |
const MyComponent = ({ myCounter, setCounter }) => ( | |
<div> | |
<h1>{myCounter}</h1> | |
<button onClick={() => setCounter(myCounter + 1)}>Add</button> | |
<button onClick={() => setCounter(myCounter - 1)}>Remove</button> | |
</div> | |
); |
View withHandlers.js
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 { compose, withState, withHandlers } from 'recompose'; | |
const MyComponent = ({ counter, increment, decrement, reset }) => ( | |
<div> | |
<h2>{counter}</h2> | |
<button onClick={increment}>Add</button> | |
<button onClick={decrement}>Remove</button> | |
<button onClick={reset}>Reset</button> | |
</div> |
View nest.js
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 { nest } from 'recompose'; | |
const Header = ({ children }) => ( | |
<div> | |
<header>HEY!</header> | |
{children} | |
</div> | |
); |
NewerOlder