Skip to content

Instantly share code, notes, and snippets.

View amsourav's full-sized avatar
🎯
Focusing

sourav sarkar amsourav

🎯
Focusing
  • 09:31 (UTC +05:30)
View GitHub Profile
@amsourav
amsourav / useEffectDebugger.js
Created July 2, 2024 20:11 — forked from markselby9/useEffectDebugger.js
A `useEffectDebugger` hook to debug which dependency changed causing `useEffect` hook to fire
// a code snippet living in a component
// source: https://stackoverflow.com/a/59843241/3600510
const usePrevious = (value, initialValue) => {
const ref = useRef(initialValue);
useEffect(() => {
ref.current = value;
});
return ref.current;
};
const useEffectDebugger = (effectHook, dependencies, dependencyNames = []) => {
@amsourav
amsourav / enzyme_render_diffs.md
Created June 23, 2020 09:47 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@amsourav
amsourav / awc-ecs-access-to-aws-efs.md
Created December 17, 2018 09:17 — forked from duluca/awc-ecs-access-to-aws-efs.md
Step-by-step Instructions to Setup an AWS ECS Cluster

Configuring AWS ECS to have access to AWS EFS

If you would like to persist data from your ECS containers, i.e. hosting databases like MySQL or MongoDB with Docker, you need to ensure that you can mount the data directory of the database in the container to volume that's not going to dissappear when your container or worse yet, the EC2 instance that hosts your containers, is restarted or scaled up or down for any reason.

Don't know how to create your own AWS ECS Cluster? Go here!

New Cluster

Sadly the EC2 provisioning process doesn't allow you to configure EFS during the initial config. After your create your cluster, follow the guide below.

New Task Definition for Web App

If you're using an Alpine-based Node server like duluca/minimal-node-web-server follow this guide: