This file contains hidden or 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
| Terminating a process on port 8081 | |
| Run the following command on a Mac to find the id for the process that is listening on port 8081: | |
| $ sudo lsof -i :8081 | |
| Then run the following to terminate the process: | |
| $ kill -9 <PID> | |
| On Windows you can find the process using port 8081 using Resource Monitor and stop it using Task Manager. |
This file contains hidden or 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 { createStore } from 'redux'; | |
| import { Provider as RRProvider } from 'react-redux'; | |
| import { render as rtlRender } from '@testing-library/react-native'; | |
| import { rootReducer } from 'store'; | |
| // you can provide initialState or the entire store that the ui is rendered with | |
| export const renderWithStore = ( | |
| ui, | |
| { |
This file contains hidden or 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 { createStore } from 'redux'; | |
| import { Provider } from 'react-redux'; | |
| import { render as rtlRender } from '@testing-library/react-native'; | |
| import { rootReducer } from 'store'; | |
| // you can provide initialState or the entire store that the ui is rendered with | |
| export const renderWithStore = ( | |
| ui, | |
| { |
This file contains hidden or 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
| # source: | |
| # https://discussions.apple.com/message/32354266#message32354266 | |
| sudo mdutil -Ea | |
| sudo mdutil -ai off | |
| sudo mdutil -ai on |
This file contains hidden or 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
| jest.mock('../../../api', () => { | |
| return { | |
| getCurrencies: () => | |
| Promise.resolve({ | |
| data: [{ code: 1, label: 'EUR' }] | |
| }), | |
| getProducts: () => | |
| Promise.resolve({ | |
| data: [{ code: 1, label: 'Facebook' }] | |
| }) |
This file contains hidden or 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
| export const roundDigit = (value, decimals) => { | |
| const base = 10 ** decimals //** power of the given exponent | |
| return Math.ceil(value * base) / base | |
| } |
This file contains hidden or 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
| /* eslint-disable consistent-return */ | |
| import { useEffect, useRef } from 'react' | |
| export default function useInterval(callback, delay, running = false) { | |
| const savedCallback = useRef() | |
| // Remember the latest callback. | |
| useEffect(() => { | |
| savedCallback.current = callback | |
| }, [callback]) |