For example
timeAgo('Sun Sep 25 2022 12:57:46 GMT+0600 (Bangladesh Standard Time)'); // 16 seconds ago
/* | |
Simple Memoization example used Closure | |
Made by: Muhammad Lahin | |
*/ | |
const myObj = {memo: {}} | |
const memo = fn => { | |
return (first_name, last_name) => { | |
let slice = Array.prototype.slice; | |
let key = JSON.stringify(slice.call(arguments)); |
/** | |
* Custom Iterator | |
* Making an Object iterable by using for...of loop | |
* By Muhammad Lahin | |
*/ | |
let obj = { | |
id: 1, | |
name: "John Cena", | |
profession: "Wrestling" |
{ | |
"env": { | |
"commonjs": true, | |
"es6": true, | |
"node": true, | |
"mocha": true | |
}, | |
"plugins": [ | |
"security" | |
], |
// accordion component using Compound Component (with context) | |
// app.js | |
function App() { | |
return ( | |
<div className="App"> | |
<Accordion defaultSelect="1" collapsible> | |
<AccordionItem id="1"> | |
<AccordionToggle>Section 1</AccordionToggle> | |
<AccordionPanel>Section 1 content</AccordionPanel> |
// useClickOutside.js | |
import { useEffect, useRef } from "react"; | |
function useClickOutside(elRef, callback) { | |
const callbackRef = useRef(); | |
callbackRef.current = callback; | |
useEffect(() => { | |
const handleClickOutside = (e) => { | |
if (!elRef?.current?.contains(e.target) && callbackRef.current) { |
.dockerignore | |
.env | |
.git | |
.gitignore | |
.vs | |
.vscode | |
*.dbmdl | |
*.jfm | |
azds.yaml | |
charts |
.dockerignore | |
.env | |
.git | |
.gitignore | |
.vs | |
.vscode | |
*.dbmdl | |
*.jfm | |
azds.yaml | |
charts |
MONGO_ROOT_USER=root | |
MONGO_ROOT_PASSWORD=123456 |
For example
timeAgo('Sun Sep 25 2022 12:57:46 GMT+0600 (Bangladesh Standard Time)'); // 16 seconds ago
const [images, setImages] = useState([]); | |
const [base64Images, setBase64Images] = useState([]); | |
const handleFileChange = (event, index) => { | |
const files = event.target.files; | |
const _images = [...images]; | |
_images[index] = files[0]; | |
setImages(_images); |