Skip to content

Instantly share code, notes, and snippets.

View debabrata100's full-sized avatar
🤡
Dethinking

Debabrata debabrata100

🤡
Dethinking
  • Bangalore
View GitHub Profile
@debabrata100
debabrata100 / learn-docker.txt
Last active June 4, 2023 13:40
Common Docker commands
Docker
- $ docker image ls
- $ docker build -t hello-docker .
- $ docker run hello-docker
- $ docker login -u debabrata100
- $ docker tag hello-docker debabrata100/myfirstapp
- $ docker push debabrata100/myfirstapp
- $ docker rm [CONTAINER_ID]
- $ docker rmi [IMAGE_ID]
Bash commands
- $ echo
- $ say “Hi There”
- $ date
- $ cal
- $ whoami
- $ pwd
- $ ls-a (List all hidden files)
- $ ls -l
@debabrata100
debabrata100 / session-local-storage-cookie
Created March 5, 2022 16:33
Session Storage-Local Storage-Cookies
@debabrata100
debabrata100 / jsinterview.readme
Created February 17, 2021 09:44
Js Interview questions
## React Js Interview Questions
1. Explain How react works.
2. What makes React different from other libraries>
3. What is Reconciliation?
4. What are the best practices one should think and follow while designing a component?
5. What is a Higher Order Component in react? Explain with code example.
6. What are the ways with which you can delay the loading of modules in react? Which one is better over another and why?
7. How React handles code splitting?
8. What are the ways to reuse a react component state logic ? Which one is better over another and why?
9. What are render props ?
@debabrata100
debabrata100 / arrayObjectSortWrtAnotherArray.js
Last active September 24, 2020 14:30
Sort Array of objects with respect to another array
function sortFunc(a, b) {
var sortingArr = ["A", "B", "C"];
return sortingArr.indexOf(a.type) - sortingArr.indexOf(b.type);
}
const itemsArray = [
{
type: "A",
},
{
@debabrata100
debabrata100 / MultipleImageUploadReact.js
Created June 1, 2020 18:46
How to upload multiple images and store base 64 urls in a React State
import React, { Fragment, useRef, useState } from 'react';
const previewStyle = {
flexFlow: 'row wrap',
marginTop: '24px'
}
const imgStyle = {
height: '100px',
marginRight: '16px'
}
@debabrata100
debabrata100 / DebounceButtonInJs.html
Last active December 1, 2019 14:17
How to implement debounce in javascript using html button as an example for click action
<html>
<body>
<button id="debounce">
Debounce
</button>
<script>
var button = document.getElementById("debounce");
const debounce = (func, delay) => {
let tid;
return (...args) => {
@debabrata100
debabrata100 / FinalLocaleApp.js
Created October 18, 2019 19:34
Final App component for implementation of react localization
import React, { useState } from 'react';
import './App.css';
import { IntlProvider, FormattedMessage } from 'react-intl';
const en = require('react-intl/locale-data/en');
const zh = require('react-intl/locale-data/zh');
const ru = require('react-intl/locale-data/ru');
const fr = require('react-intl/locale-data/fr');
const addLocaleData = require('react-intl').addLocaleData;
@debabrata100
debabrata100 / LocaleApp.js
Created October 18, 2019 18:36
On Change of locale save to react state and store locale value to localStorage
import React, { useState } from 'react';
import './App.css';
const defaultLocale = localStorage['locale'] ? localStorage['locale'] : 'en'; // English is default locale if none is set
const localeList = [
{ name: 'English', code: 'en', lang: 'English' },
{ name: '中文', code: 'zh', lang: 'Chinese' },
{ name: 'русский', code: 'ru', lang: 'Russian' },
{ name: 'Française', code: 'fr', lang: 'French' }
];
@debabrata100
debabrata100 / infix_to_postfix.py
Created September 15, 2018 17:22
This python program illustrates how to write a python program to convert infix expression to postfix using python list as stack
def getOperatorWeight(op):
weights = {
'+': 1,
'-': 1,
'*': 2,
'/': 2,
'^': 3
}
return weights.get(op)
def isRightAssociative(op):