Skip to content

Instantly share code, notes, and snippets.

View moshfiqrony's full-sized avatar
🎯
Worklifing

Md. Moshfiqur Rahman Rony moshfiqrony

🎯
Worklifing
View GitHub Profile
test('Component rendered successfully', async () => {
axios.get.mockImplementationOnce(() => Promise.resolve({
status: 200,
data: {
name: 'Rony',
email: '[email protected]'
}
}))
const { container, getByTestId } = render(<ApiCallMock />);
{
"name": "moshfiqrony",
"version": "1.0.0",
"license": "MIT",
"scripts": {
"test": "jest --env=jest-environment-jsdom-sixteen --watch",
"start": "react-scripts start"
},
"devDependencies": {
"@babel/core": "^7.10.2",
@moshfiqrony
moshfiqrony / dynamicCompononetLoadUsingUrls.js
Created November 1, 2020 03:39
It demo the process how slack uses url to open hide their sidebar
import React from 'react'
import { Route, Switch } from 'react-router';
import Dialog from '@material-ui/core/Dialog'
const ABC = ({ match, history, ...rest }) => {
return (
<div>
<h1
onClick={() => history.push(`${match.url}/2`)}
# Pyenv not found solve
After installing pyenv from the official installer docs - https://github.com/pyenv/pyenv-installer.
If you face problem that your pyenv is not recongnized. There can be situations that your `.bashrc` didn't updated
Open the `.bashrc` file and add following code there
```
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
@moshfiqrony
moshfiqrony / pxToRemConversion.js
Created February 21, 2023 06:12
This code converts any px value in the js of given directory and it's sub-directories file to rem value.
const fs = require("fs");
const path = require("path");
const directoryPath = "src";
const rootFontSize = 16;
function convertFilesInDirectory(directoryPath) {
const files = fs.readdirSync(directoryPath);
for (const file of files) {