For example
timeAgo('Sun Sep 25 2022 12:57:46 GMT+0600 (Bangladesh Standard Time)'); // 16 seconds ago
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name localhost; | |
# Load configuration files for the default server block. | |
include /etc/nginx/default.d/*.conf; | |
location / { | |
proxy_pass http://localhost:3000; |
import { LRUCache } from 'lru-cache'; | |
const rateLimit = (options) => { | |
const tokenCache = new LRUCache({ | |
max: options?.uniqueTokenPerInterval || 500, | |
ttl: options?.interval || 60000, | |
}) | |
return { | |
check: (res, limit, token) => |
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); |
MONGO_ROOT_USER=root | |
MONGO_ROOT_PASSWORD=123456 |
.dockerignore | |
.env | |
.git | |
.gitignore | |
.vs | |
.vscode | |
*.dbmdl | |
*.jfm | |
azds.yaml | |
charts |
.dockerignore | |
.env | |
.git | |
.gitignore | |
.vs | |
.vscode | |
*.dbmdl | |
*.jfm | |
azds.yaml | |
charts |
For example
timeAgo('Sun Sep 25 2022 12:57:46 GMT+0600 (Bangladesh Standard Time)'); // 16 seconds ago
// 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) { |
// 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> |
/** | |
* Custom Iterator | |
* Making an Object iterable by using for...of loop | |
* By Muhammad Lahin | |
*/ | |
let obj = { | |
id: 1, | |
name: "John Cena", | |
profession: "Wrestling" |