Skip to content

Instantly share code, notes, and snippets.

const getDDT = (userData) => async (dispatch) => {
dispatch(loadDDT());
await account
.post("getAllDivisionsDistrictThana", userData)
.then((res) => res)
.catch((err) => err);
};
@TedSean
TedSean / node.md
Created January 22, 2021 12:48 — forked from kevinvoduy/node.md
node

Node Notes

Study up mother fucker

1. What is Node? Where can you use it?

Node is a server side scripting language based on Google's V8 JavaScript engine. It is used to build scalable programs that are computationally simple but frequently accessed.

You can use node in I/O intensive web applications like video streaming site, real-time web applications, network applications, general-purpose applications, and distributed systems.

Talkspace Full-stack candidate exercise

Guidelines: The following exercise questions should take 1-2 hours, Put your answers after each question - try to give some short explanation for your

Candidate Name: Pery Date: 12/02/2020

@TedSean
TedSean / react-useCallback.md
Created January 6, 2021 13:20 — forked from JamesBliss/react-useCallback.md
Measuring a DOM node

React => measuring a DOM node

Your first instinct will be to use a useRef which can be a good solution, although an object ref doesn’t notify us about changes to the current ref value. This means when the ref.current changes you will not see the updated value.

Solution 1.

Use a callback ref (this example is taken from the react hooks FAQ) This is a super simple and pretty nice solution for one-off measurements.

🔻

NOTE: This page is currently a work in progress. There is a lot to cover in detail. The plan is to breakout details on conventions like 'How To Write Your Selectors' and 'How To Normalize Your Data' a bit later. For now just look for existing examples in the code or ask a friend.

To get the quick and dirty bullet list, scroll down to the TL;DR; below.


React Best Practices & Patterns

There are a few tricks we've picked up since we started that will help us with debugging, reuse, scalability, performance, and common pitfalls of complex singles page app development. We are not code Nazis but getting familiar with these things will help the whole team increase output and reduce code debt. These things should be pointed out in code reviews and corrected.

The goal is to write consistent code with less opportunities for bugs. Complex code is buggy code. It's really that simple.

import React, { useState, useEffect } from "react";
import { Grid, StepLabel, Card } from "@material-ui/core";
import CheckCircleIcon from "@material-ui/icons/CheckCircle";
import DeleteIcon from "@material-ui/icons/Delete";
import IconButton from "@material-ui/core/IconButton";
import Menu from "@material-ui/core/Menu";
import MenuItem from "@material-ui/core/MenuItem";
import MoreVertIcon from "@material-ui/icons/MoreVert";
import cn from "classnames";
import { sha256 } from "js-sha256";
@TedSean
TedSean / PrepaidCardForm.js
Created May 18, 2020 16:24
This is the child of a parent component PrepaidCard(/index/prepaid-card) and on form submission after success message. I want to route it to parent.
import React, { useState, useEffect, memo } from "react";
import { useSelector, useDispatch } from "react-redux";
import {
Card,
CardHeader,
CardBody,
CardTitle,
Row,
Col,
Form,
@TedSean
TedSean / PrepaidCard.js
Created May 18, 2020 15:04
This is the root component which just route the user to either ManageCard or PrepaidCardForm. This has a route name /index/prepaid-card
import React, { useEffect, useCallback } from "react";
import { useSelector, useDispatch } from "react-redux";
import { sha256 } from "js-sha256";
import { getPrepaidCard } from "../../redux/actions/prepaidCardActions";
import val from "../../getThemeDetails";
import Layout from "../../components/Wrappers/Layout";
import PrepaidCardForm from "./ApplyPrepaidCard/PrepaidCardForm";
import ShowPrepaidCards from "./DisplayPrepaidCards/ShowPrepaidCards";
function PrepaidCard() {