Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
يسهل حقن التبعيات استبدال العناصر الحقيقية بمحاكاة (Mocks) أثناء الاختبارات، مما يقلل التعقيد ويزيد دقة نتائج الاختبار.
يمكن تعديل أو استبدال أي تبعية دون تغيير الكائن الرئيسي، مما يجعل الكود أسهل في التطوير على المدى الطويل.
How to Stop SSH From Timing Out
Restart SSH:
sudo systemctl restart sshdHow to Translate URLs in React (2025 Guide)
Create i18n.js:
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import en from './locales/en.json';
import fr from './locales/fr.json';
i18n
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources: { en: { translation: en }, fr: { translation: fr } },
fallbackLng: 'en',
interpolation: {
escapeValue: false,
},
});
export default i18n;Globalization in React (2025 Trends & Best Practices)
new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(4999.99);
// Output: $4,999.99Make this dynamic in React:
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
import React from 'react';
import { useTranslation } from 'react-i18next';
const Home = () => {
const { t, i18n } = useTranslation();
const changeLanguage = (lng) => {
i18n.changeLanguage(lng);
};
const today = new Date();
const price = 199.99;
return (
<div className="p-4">
<h1>{t('welcome')}</h1>
<div className="mt-4">
<strong>{t('language')}:</strong>
<button onClick={() => changeLanguage('en')} className="ml-2">EN</button>
<button onClick={() => changeLanguage('fr')} className="ml-2">FR</button>
</div>
<p>{t('date_example', { date: today })}</p>
<p>{t('price_example', { price })}</p>
</div>
);
};
export default Home;Install i18next-format plugin (optional):
Building Micro-Frontends with Webpack Module Federation (2025 Guide)
Start the remote app (Vue):
cd analytics-app
npx webpack serveState Management Beyond Redux: Using Zustand for Scalable React Apps
import create from 'zustand';
import { persist } from 'zustand/middleware';
const useStore = create(persist(
(set) => ({
count: 0,
increase: () => set((state) => ({ count: state.count + 1 })),
}),
{
name: 'counter-storage',
}
));Zustand allows you to select specific parts of the state to prevent unnecessary re-renders:
Mastering React Rendering Performance with Memoization and Context
In this example, Greeting will only re-render when the name prop changes. This optimization is particularly beneficial for components that render frequently with the same props.([React][4], [Content That Scales][5])
Passing functions as props can cause child components to re-render unnecessarily because functions are recreated on every render. The useCallback hook memoizes functions, ensuring they maintain the same reference unless their dependencies change.([React][4])
How to Disable MySQL Password Validation on Ubuntu 25.04
UNINSTALL COMPONENT 'file://component_validate_password';If successful, you'll see:
How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04
If needed, recreate the MySQL socket directory:
sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqldHow to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)
sudo mysql_secure_installationThis script will prompt you to set a root password, remove anonymous users, disallow remote root login, remove the test database, and reload privilege tables.
How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
You’ll see a list like:
driver : nvidia-driver-550 - distro non-free recommended
...
driver : xserver-xorg-video-nouveau - distro free builtinAvoiding Memory Leaks in C++ Without Smart Pointers
Consider this code:
void loadData() {
char* buffer = new char[1024];
// some processing...
if (someCondition()) {
return; // leak!
}
delete[] buffer;
}Deep Copy in C++: How to Avoid Shallow Copy Pitfalls
- Avoid shallow copies.
- Always implement deep copy logic.
- Follow the Rule of Three (or Rule of Five).
- Prefer
std::string,std::vector, or smart pointers in modern C++.
Understanding deep copy is essential for writing robust, bug-free C++ code.
Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work
https://www.google.com/recaptcha/admin
Limit how many times a single IP can submit a form within a short period (e.g., 3 times per minute).
Build a Custom Rate Limiter in Node.js with Redis
You’re no longer blindly relying on a package—you understand and control the system.
Want to extend this?
Arduino Basics: A Step-by-Step Tutorial
Open the Arduino IDE and enter the following code:
// Arduino LED Blink Example
// The setup function runs once when you press reset or power the board.
void setup() {
// Initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// The loop function runs repeatedly forever.
void loop() {
digitalWrite(13, HIGH); // Turn the LED on (HIGH is the voltage level)
delay(1000); // Wait for one second (1000 milliseconds)
digitalWrite(13, LOW); // Turn the LED off by making the voltage LOW
delay(1000); // Wait for one second
}
Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js
In this tutorial, you’ll learn how to create a web application that performs real-time object detection using your webcam. By combining TensorFlow.js—Google’s library for machine learning in JavaScript—with p5.js for creative coding and drawing, you can build an interactive app that detects objects on the fly.
This guide will walk you through setting up your development environment, loading a pre-trained model, capturing video input, and overlaying detection results on the video feed.
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
npm run devIn a separate terminal window, start Tauri’s development server:
Implementing a Domain-Specific Language (DSL) with LLVM and C++
(3 + 4) * (5 - 2) / 2The lexer (or tokenizer) converts a stream of characters into a sequence of tokens. Each token represents a logical unit, such as a number or operator.