tips to evolve as a developer
developers get stuck, paralized
https://www.oreilly.com/library/view/apprenticeship-patterns/9780596806842/ch04.html
Make It Stick https://www.amazon.com.br/Make-Stick-Science-Successful-Learning/dp/0674729013
import { NamingStrategyInterface, DefaultNamingStrategy } from 'typeorm' | |
import { snakeCase } from 'typeorm/util/StringUtils' | |
export class SnakeNamingStrategy extends DefaultNamingStrategy implements NamingStrategyInterface { | |
tableName(className: string, customName: string): string { | |
return customName ? customName : snakeCase(className) | |
} | |
columnName(propertyName: string, customName: string, embeddedPrefixes: string[]): string { | |
return snakeCase(embeddedPrefixes.join('_')) + (customName ? customName : snakeCase(propertyName)) |
import { useEffect, useRef } from 'react'; | |
import { useHistory } from 'react-router-dom'; | |
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => { | |
const history = useHistory(); | |
const self = useRef(null); | |
const onWindowOrTabClose = event => { | |
if (!when) { |
export function cpfMask (value) { | |
return value | |
.replace(/\D/g, '') | |
.replace(/(\d{3})(\d)/, '$1.$2') | |
.replace(/(\d{3})(\d)/, '$1.$2') | |
.replace(/(\d{3})(\d{1,2})/, '$1-$2') | |
.replace(/(-\d{2})\d+?$/, '$1') | |
} | |
export function cnpjMask (value) { |
type Props = { | |
}; | |
const FormUseFormik = (props: Props) => { | |
const { enqueueSnackbar } = useSnackbar(); | |
const onSubmit = (values) => { | |
enqueueSnackbar(`submit: ${JSON.stringify(values)}`, { | |
preventDuplicate: true, | |
persist: false, | |
}); |
const checkboxHandlers = useCheckboxString('myCheckboxList'); | |
{possibleValues.map(value => ( | |
<Checkbox | |
key={value} | |
name={value} | |
label={t(value)} | |
{...checkboxHandlers(disability)} | |
/> | |
))} |
tips to evolve as a developer
developers get stuck, paralized
https://www.oreilly.com/library/view/apprenticeship-patterns/9780596806842/ch04.html
Make It Stick https://www.amazon.com.br/Make-Stick-Science-Successful-Learning/dp/0674729013
you should review every pull request of your team
you should ensure consistency of the code base
you should pair programming with all devs of your team
/** | |
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'. | |
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315 | |
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381 | |
*/ | |
import { useContext, useEffect, useCallback } from 'react'; | |
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom'; | |
/** | |
* Blocks all navigation attempts. This is useful for preventing the page from | |
* changing until some condition is met, like saving form data. |