Skip to content

Instantly share code, notes, and snippets.

View parthamk's full-sized avatar
🎯
Focusing

Partha Mallick parthamk

🎯
Focusing
View GitHub Profile

To implement a feature where the music player pauses at the current playing time and resumes from the last playing time after a page refresh, you'll need to store the current playing time on the server side and retrieve it when the page is refreshed. Here's a general guide on how you can achieve this using the MERN stack (MongoDB, Express.js, React.js, Node.js):

  1. Server Side (Node.js & Express.js):
    • Create a MongoDB collection to store user-specific playback information. You might store the user ID, the currently playing song, and the current playback time.
    • Create API routes to handle updating and retrieving playback information.

Example:

// server.js or app.js

Thought Note


Repository Links:

  1. Frontend (salesapp-frontend):

  2. Backend (salesapp-backend):

@parthamk
parthamk / Readme.md
Created January 24, 2024 21:20
Javascript Prep

These are the most asked JavaScript interview questions I’ve seen in the 12 years of my career.

If you can correctly answer, you’re already 90% ahead of your competition.

-Explain the concept of AJAX.

-Explain closures in JavaScript.

-What is hoisting in JavaScript?

@parthamk
parthamk / ReadMe.md
Last active January 17, 2024 11:09
Fixing "Running Scripts is Disabled on This System" Error in React App Creation

Fixing "Running Scripts is Disabled on This System" Error in React App Creation

If you encounter the error message: File C:\Users\user\AppData\Roaming\npm\npx.ps1 cannot be loaded because running scripts is disabled on this system while trying to create a React app using npm create-react-app, you can follow the steps below to resolve the issue.

Step 1: Open PowerShell with Administrator Privileges

Right-click on the PowerShell icon and select "Run as Administrator" from the context menu.

@parthamk
parthamk / App.js
Last active December 18, 2023 10:48
NODE-EXPRESS-MONGODB creating connection with database
// Import necessary React hooks and external dependencies
import React, { useState, useEffect } from 'react';
import axios from 'axios';
// Define a functional component named App
function App() {
// State variables: 'items' for storing fetched items, and 'itemName' for handling input
const [items, setItems] = useState([]);
const [itemName, setItemName] = useState('');
```jsx
// Import necessary libraries and components
import React, { useState, useEffect } from 'react'; // useState and useEffect are hooks from React
import { CopyToClipboard } from 'react-copy-to-clipboard'; // Component to copy text to clipboard
import { toast, ToastContainer } from 'react-toastify'; // Toast notifications
import 'react-toastify/dist/ReactToastify.css'; // CSS for toast notifications
import 'bootstrap/dist/css/bootstrap.min.css'; // Bootstrap CSS
import { Card, Button, Form, InputGroup, FormControl } from 'react-bootstrap'; // Bootstrap components
// Define the PasswordGenerator component
@parthamk
parthamk / Url-Links.md
Created October 25, 2023 07:37
URL and Links, how to use them in your project
@parthamk
parthamk / index.html
Created October 13, 2023 12:39
Phone Book Project
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PhoneBook</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
</head>
<body>
<div class="container">

Let's break down JavaScript functions into various aspects and explain them in detail with a focus on simplicity for better understanding.

1. Function Declaration and Definition:

  • What is a Function?

    • A function is a block of reusable code designed to perform a specific task.
  • Declaration:

    • function functionName(parameters) { /* code */ }
    • Example: