In your command-line run the following commands:
brew doctorbrew update
| var colorArray = ['#FF6633', '#FFB399', '#FF33FF', '#FFFF99', '#00B3E6', | |
| '#E6B333', '#3366E6', '#999966', '#99FF99', '#B34D4D', | |
| '#80B300', '#809900', '#E6B3B3', '#6680B3', '#66991A', | |
| '#FF99E6', '#CCFF1A', '#FF1A66', '#E6331A', '#33FFCC', | |
| '#66994D', '#B366CC', '#4D8000', '#B33300', '#CC80CC', | |
| '#66664D', '#991AFF', '#E666FF', '#4DB3FF', '#1AB399', | |
| '#E666B3', '#33991A', '#CC9999', '#B3B31A', '#00E680', | |
| '#4D8066', '#809980', '#E6FF80', '#1AFF33', '#999933', | |
| '#FF3380', '#CCCC00', '#66E64D', '#4D80CC', '#9900B3', | |
| '#E64D66', '#4DB380', '#FF4D4D', '#99E6E6', '#6666FF']; |
| find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \; |
| /* | |
| * Handling Errors using async/await | |
| * Has to be used inside an async function | |
| */ | |
| try { | |
| const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
| // Success 🎉 | |
| console.log(response); | |
| } catch (error) { | |
| // Error 😨 |
| defaults write com.apple.dock size-immutable -bool true; killall Dock |
In your command-line run the following commands:
brew doctorbrew updateTo ensure that the coding style is consisitent in the project from different members, for React + Typescript projects, it is recommanded set up ESlint and Prettier.
yarn add eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-react -D
| export const getUniqueColorsForShowIds = (showIds: number[]) => { | |
| console.log("colors.length "+colors.length); | |
| console.log("showIds "+showIds); | |
| // get list of indicies in color array | |
| const listOfIndicies: number[] = showIds.map(id => { | |
| // using modulus operator, so if id = 103 and color.length = 100, then colorIndex will be 3 | |
| const colorIndex = id % colors.length; | |
| return colorIndex; | |
| }); |