Skip to content

Instantly share code, notes, and snippets.

View monirshimul's full-sized avatar
🎯
Focusing

monirshimul monirshimul

🎯
Focusing
View GitHub Profile
@monirshimul
monirshimul / useMemo Simple Example
Created March 29, 2022 12:18
useMemo Simple Example
const [a, setA] = useState(0);
const [b, setB] = useState(0);
// this is onClick Function=====
const testMemo = ()=>{
setA(val => val + 1)
setB(val => val + 2)
}
// this function for calculation=======
const inner = ()=>{
console.log("Inner Is calling")
@monirshimul
monirshimul / next-ssr-recoil-effects.js
Created September 12, 2021 09:30 — forked from spro/next-ssr-recoil-effects.js
Another attempt at SSR with Recoil - setting initial atom values with Next.js getServerSideProps, this time with effects
import {useEffect, useMemo} from 'react'
import {RecoilRoot, useRecoilState, atom} from 'recoil'
// User data
const user1 = {username: 'joe', bio: "You will never see me, unless of course this example is totally broken."}
const user2 = {username: 'bob', bio: "I am the one true user."}
const user3 = {username: 'fred', bio: "Just kidding, make way for the new guy."}
// A potentially dangerous mutable global variable for initial state. The main
@monirshimul
monirshimul / sw-await.js
Created May 4, 2021 15:43 — forked from bakoushin/sw-await.js
Service Worker: Promises vs Async/Await
const version = 1;
const appPrefix = 'myApp-';
const staticCacheName = appPrefix + 'static-v' + version;
const imagesCacheName = appPrefix + 'content-imgs';
var allCaches = [
staticCacheName,
imagesCacheName
];
self.addEventListener('message', event => {
@monirshimul
monirshimul / mergeArray.js
Created May 8, 2020 12:23
Merge two array into one and remove duplicate values from final array
let ar1 = [1,2,3]
let ar2 = [1,2,3,4]
let ar3 = ar1.concat(ar2)
console.log(ar3)
let uniq = [...new Set(ar3)]
console.log(uniq)
var hobbyOne = "swimming";
function oldHobby(){
console.log("Actually old hobby is:",hobbyOne)
}
var hobbiChange = function () {
console.log("My old hobby: " + hobbyOne);
var hobbyOne = "code";
function a(){
for (var i = 0; i<=10; i++){
var a = setTimeout(()=>{
var a = 10
},1000)
var a = setTimeout(()=>{
var a = 11
},2000)
var a = setTimeout(()=>{
@monirshimul
monirshimul / keras.py
Created January 20, 2020 07:24
Keras model import
import tensorflow.keras
from PIL import Image, ImageOps
import numpy as np
# Disable scientific notation for clarity
np.set_printoptions(suppress=True)
# Load the model
model = tensorflow.keras.models.load_model('keras_model.h5')
@monirshimul
monirshimul / DomAccessing.js
Created January 8, 2020 05:18
Dom Accessing in React
import React, { Component } from "react";
class DomAccessing extends Component {
state = {
bgColor: "",
mycolor: ''
};
onChange = e => {
e.preventDefault();
@monirshimul
monirshimul / toggleButton.js
Created January 8, 2020 05:17
react Toggle Button Condition.........
import React, { Component } from "react";
export class ToggleButton extends Component {
state={
surah:true,
chapter:false,
checkBtn:true
}
var a = ["monir", "shimul"];
var b = [];
for (let x of a){
for (let i=0;i<=x.length-1;i++){
//console.log(i)
//console.log(x.charAt(i))
var val = x.charAt(i)