Skip to content

Instantly share code, notes, and snippets.

View sejalkailashyadav's full-sized avatar
:octocat:
Focusing

SEJAL YADAV sejalkailashyadav

:octocat:
Focusing
View GitHub Profile

🌐 What is DNS?

DNS = Domain Name System

It's like the phonebook of the internet.


📱 Real-Life Example

complete one-by-one command flow** for starting MySQL and Apache, then creating and running a PHP file step-by-step:


✅ STEP 1: Start MySQL

sudo systemctl start mysql

🧠 Is dynamic memory (using new and delete) necessary in C++?

Short Answer:

No, it’s not always necessary.


🔍 When You DON'T Need Dynamic Memory:

@sejalkailashyadav
sejalkailashyadav / fill everything again or scroll a lot.md
Last active May 8, 2025 11:33
fill everything again or scroll a lot.md

very common problem with large forms:

❌ When you submit a big form and Laravel validation fails, it refreshes the page and shows errors… 😩 But the user has to fill everything again or scroll a lot, which is frustrating.


✅ SOLUTION (Best Practice): Use old() values + show validation errors properly

You do NOT need to re-enter the entire form if you use Laravel’s built-in helpers the right way.


🔹 Core Concepts of OOP in JavaScript:

  1. Encapsulation: Bundling data (properties) and methods (functions) that work on the data into a single unit, usually a class. It hides the internal details of the object and only exposes what’s necessary.

  2. Abstraction: Hiding complex implementation details and showing only the necessary features to the user.

  3. Inheritance: The mechanism by which one class can inherit properties and methods from another class, allowing for code reuse and a hierarchical class structure.

Asynchronous Programming: Callbacks, Promises, and Async/Await

🔹 What is Synchronous in JavaScript?

Synchronous ka matlab hota hai — ek ke baad ek kaam hona.[sky- one by one]

Jaise ki:

Jab tak pehla kaam pura nahi hota, tab tak dusra start nahi hota.

Immutable Deep Update using Nested Maps:


🔁 Immutable Deep Update using Nested Maps

When working with nested data structures like arrays of objects (e.g., departments with employees), it's important to update values immutably — without modifying the original data.
This pattern uses nested .map() functions to update specific fields deep within the structure.


### ✅ You can use `map()` on:
1. **An array of values**
2. **An array of objects**
3. **An array of arrays**
Basically, any array.
---
### 🔹 1. **Array of values**

real-world data to show the difference between using map().flat() and flatMap().


Scenario: A List of Orders and Items

You have an array of orders, and each order contains an array of items. You want to flatten the items from all orders into a single list.

1. Using map() and flat()