Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
يسهل حقن التبعيات استبدال العناصر الحقيقية بمحاكاة (Mocks) أثناء الاختبارات، مما يقلل التعقيد ويزيد دقة نتائج الاختبار.
يمكن تعديل أو استبدال أي تبعية دون تغيير الكائن الرئيسي، مما يجعل الكود أسهل في التطوير على المدى الطويل.
How to Stop SSH From Timing Out
Add:
Host *
ServerAliveInterval 60
ServerAliveCountMax 3How to Translate URLs in React (2025 Guide)
Use a framework like Next.js for SSR with dynamic routes
Add <html lang="en"> and <link rel="alternate" hreflang="fr"> tags
Globalization in React (2025 Trends & Best Practices)
- Ensure localized content fits small screens
- Test RTL support on all breakpoints
- Use dynamic font scaling for languages like Arabic or Hindi
- Translate push notifications and in-app messages
In 2025, certain laws enforce localized data:
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
Use localStorage via i18next-browser-languagedetector:
detection: {
order: ['localStorage', 'navigator', 'htmlTag'],
caches: ['localStorage'],
}Building Micro-Frontends with Webpack Module Federation (2025 Guide)
Micro-frontends allow different teams to work independently on isolated UI components, which are then stitched together at runtime. This enables:
- Faster deployment cycles
- Independent scaling of frontend parts
- Team autonomy across tech stacks (e.g., React, Vue, Angular)
State Management Beyond Redux: Using Zustand for Scalable React Apps
However, for large-scale applications requiring complex state interactions, middleware, and extensive tooling, Redux might still be the preferred choice.
Zustand presents a compelling alternative to Redux for state management in React applications. Its minimalistic API, ease of use, and performance optimizations make it suitable for a wide range of projects, from simple applications to more complex systems.
Mastering React Rendering Performance with Memoization and Context
The Context API allows for sharing state across components without prop drilling. However, improper use can lead to performance issues, as any change in context value triggers re-renders in all consuming components.([Medium][6], [GeeksforGeeks][2])
Best Practices:
How to Disable MySQL Password Validation on Ubuntu 25.04
sudo mysqlRun the following command in the MySQL prompt:
How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04
Choose your new location, for example /mnt/data/mysql, and move the current data:
sudo mv /var/lib/mysql /mnt/data/mysqlHow to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)
Ubuntu 25.04 includes PHP 8.3 in its official repositories. Install PHP along with commonly used extensions for Laravel:
sudo apt install php php-cli php-mbstring php-xml php-bcmath php-curl php-mysql php-zip php-gd php-fpm unzipHow to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
Install the recommended version:
sudo apt install nvidia-driver-550 nvidia-primeAvoiding 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
class Deep {
public:
int* data;
Deep(int val) {
data = new int(val);
}
// Copy constructor for deep copy
Deep(const Deep& other) {
data = new int(*other.data);
}
// Assignment operator for deep copy
Deep& operator=(const Deep& other) {
if (this != &other) {
delete data;
data = new int(*other.data);
}
return *this;
}
~Deep() {
delete data;
}
};If your class handles dynamic memory:
Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work
const duration = Date.now() - formStartTime;
if (duration < 3000) {
return res.status(403).send("Too fast, bot?");
}Yes, reCAPTCHA is still useful—especially v3, which assigns a score based on user behavior.
Build a Custom Rate Limiter in Node.js with Redis
const userKey = req.headers['x-api-key'] || req.ip;
const key = `rate_limit:${userKey}`;You can now:
Arduino Basics: A Step-by-Step Tutorial
Table 2: Digital vs. Analog signals in Arduino projects.
One of the simplest and most popular starter projects is blinking an LED. Follow these steps:
Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Real-Time Object Detection</title>
<style>
body {
text-align: center;
background: #222;
color: #fff;
font-family: sans-serif;
}
canvas {
border: 2px solid #fff;
}
</style>
</head>
<body>
<h1>Real-Time Object Detection Web App</h1>
<!-- p5.js and TensorFlow.js -->
<script src="https://cdn.jsdelivr.net/npm/p5@1.6.0/lib/p5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@4.6.0/dist/tf.min.js"></script>
<!-- Pre-trained model: COCO-SSD -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd"></script>
<script src="sketch.js"></script>
</body>
</html>This HTML file loads p5.js, TensorFlow.js, and the COCO-SSD model library. We also reference our custom script file (sketch.js), which will contain our application logic.
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
This integration demonstrates how to extend your application’s functionality by leveraging native system features.
By following this tutorial, you’ve built your first cross-platform desktop application using Tauri and Svelte. You learned how to set up a Svelte project, integrate Tauri, configure essential settings, and extend your app with Tauri’s native APIs. Tauri’s lightweight approach combined with Svelte’s reactive simplicity makes for a powerful combination that can significantly improve performance and reduce application size compared to traditional Electron-based solutions.
Implementing a Domain-Specific Language (DSL) with LLVM and C++
Our AST nodes will represent numeric literals and binary operations. Later, these nodes are traversed to generate LLVM IR.
Header: AST.h