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
{ | |
test: /(?<!\.module)\.scss$/, | |
use: [ | |
require.resolve('style-loader'), | |
{ | |
loader: require.resolve('css-loader'), | |
options: { | |
importLoaders: 1, | |
}, | |
}, |
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 classNames from 'classnames' | |
import styles from './styles.module.scss' | |
export default ({ negative = false, name, surname }) => ( | |
<div | |
className={classNames( | |
styles['name-container'], | |
negative && styles['name-negative'], |
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
form.rowByTag("vNome")?.disabled = true | |
form.rowByTag("vNome")?.evaluateDisabled() | |
form.rowByTag("vLocal")?.disabled = true | |
form.rowByTag("vLocal")?.evaluateDisabled() | |
form.rowByTag("vData")?.disabled = true | |
form.rowByTag("vData")?.evaluateDisabled() | |
form.rowByTag("vEquipe")?.disabled = true | |
form.rowByTag("vEquipe")?.evaluateDisabled() | |
form.rowByTag("vAmigos")?.disabled = true | |
form.rowByTag("vAmigos")?.evaluateDisabled() |
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
let tags: [String] = ["vNome", "vLocal", "vData", "vEquipe", "vAmigos", "vReferencia"] | |
for tag in tags { | |
form.rowByTag(tag)?.disabled = true | |
form.rowByTag(tag)?.evaluateDisabled() | |
} |
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
function login() { | |
// login logic here | |
} | |
class LoginForm extends React.PureComponent { | |
render() { | |
return ( | |
<form onSubmit={login}> | |
<input type="email" /><br /> | |
<input type="password" /><br /> |
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, { Component } from 'react'; | |
import { Switch, Route } from 'react-router-dom'; | |
const PAGES = [ | |
{ | |
name: 'Home', | |
path: '/', | |
loader: './pages/Home', | |
}, | |
]; |
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 MyUserSelectableList = ({ users ) => { | |
const { onRowCheck, isRowSelected } = useSelectedRows(); | |
return ( | |
<> | |
{users.map(user => ( | |
<> | |
<Checkbox value={isRowSelected(user)} onChange={(value) => onRowCheck(user, value)} /> | |
<span>{user.name}</span> | |
</> |
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
function useMutualNumberField({ | |
values, | |
index, | |
setCurrentValue, | |
setAllValues, | |
}) { | |
return function handlePercentageChange(rawInputtedValue) { | |
const inputtedValue = parseInt((rawInputtedValue || 0).toString(), 10) | |
const prevValue = values[index].percentage | |
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
function getAge(month, day, year) { | |
const birthDate = new Date(year, month - 1, day) | |
const fromNow = new Date() - birthDate | |
const absoluteAge = new Date(fromNow).getFullYear() | |
// that's because timestamps starts from 1970, so | |
// we're getting relatively to that year | |
return Math.abs(absoluteAge - 1970) | |
} |
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
/* | |
Time complexity: O(nˆ2) since it has two nested loops | |
Space complexity: O(1) since it uses a reference to something that already exists and does not create new arrays | |
*/ | |
const selectionSort = array => { | |
for (let arrayIndex = 0; arrayIndex < array.length - 1; arrayIndex++) { | |
let minIndex = arrayIndex | |
for (let subArrayIndex = arrayIndex + 1; subArrayIndex < array.length; subArrayIndex++) { |