Find the code you need
Search through tutorials, code snippets, and development resources
ما هو حقن التبعيات (Dependency Injection)؟
عندما تعتمد الكائنات على إنشاء التبعيات داخلياً، فإن النظام يصبح مترابطاً بشكل كبير. حقن التبعيات يفصل عملية الإنشاء عن الاستخدام، مما يقلل الترابط ويجعل البنية أكثر تنظيماً.
يسهل حقن التبعيات استبدال العناصر الحقيقية بمحاكاة (Mocks) أثناء الاختبارات، مما يقلل التعقيد ويزيد دقة نتائج الاختبار.
How to Stop SSH From Timing Out
Host *
ServerAliveInterval 60
ServerAliveCountMax 3This ensures your SSH client pings the server regularly.
How to Translate URLs in React (2025 Guide)
Start with a React project (you can use CRA or Vite):
npx create-react-app react-i18n-routing
cd react-i18n-routingGlobalization in React (2025 Trends & Best Practices)
new Intl.DateTimeFormat('fr-FR').format(new Date());
// Output: 04/05/2025 (French format)React example:
Implementing Internationalization (i18n) in a Large React Application (2025 Guide)
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import './i18n'; // import i18n config
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);Use the useTranslation hook:
Building Micro-Frontends with Webpack Module Federation (2025 Guide)
Create src/components/Analytics.vue:
<template>
<div class="analytics">
<h2>Real-Time Analytics</h2>
<p>This component is loaded remotely via Module Federation.</p>
</div>
</template>
<script>
export default {
name: 'Analytics',
};
</script>State Management Beyond Redux: Using Zustand for Scalable React Apps
Zustand allows you to select specific parts of the state to prevent unnecessary re-renders:
const count = useStore((state) => state.count);Mastering React Rendering Performance with Memoization and Context
Steps:
Regular profiling helps in maintaining optimal performance as the application evolves.([Content That Scales][5])
How to Disable MySQL Password Validation on Ubuntu 25.04
INSTALL COMPONENT 'file://component_validate_password';Then you'll need to restart MySQL:
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)
sudo phpenmod mbstring
sudo systemctl restart apache2You can now access phpMyAdmin at http://localhost/phpmyadmin.
How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)
Open a terminal and run:
lspci -k | grep -EA3 'VGA|3D|Display'Avoiding Memory Leaks in C++ Without Smart Pointers
For arrays:
template <typename T>
class ScopedArray {
private:
T* ptr;
public:
explicit ScopedArray(T* p = nullptr) : ptr(p) {}
~ScopedArray() {
delete[] ptr;
}
T& operator[](int index) const { return ptr[index]; }
T* get() const { return ptr; }
void reset(T* p = nullptr) {
if (ptr != p) {
delete[] ptr;
ptr = p;
}
}
// Prevent copy
ScopedArray(const ScopedArray&) = delete;
ScopedArray& operator=(const ScopedArray&) = delete;
};Deep Copy in C++: How to Avoid Shallow Copy Pitfalls
When your class uses raw pointers:
- 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++.
Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work
<input type="text" name="phone_number" style="display:none" autocomplete="off">if (!empty($_POST['phone_number'])) {
die("Bot detected");
}Build a Custom Rate Limiter in Node.js with Redis
Protect your API from abuse and learn how rate limiting works under the hood.
When developing web apps or APIs, it’s critical to prevent users from overwhelming your server. That’s where rate limiting comes in. In this guide, we’ll build a custom rate limiter in Node.js using Redis—no libraries, no magic, just code you control and understand.
Arduino Basics: A Step-by-Step Tutorial
- Arduino board (e.g., Arduino Uno)
- Breadboard
- LED
- 220Ω resistor
- Jumper wires
- Connect the longer leg (anode) of the LED to digital pin 13.
- Connect the shorter leg (cathode) to one end of the 220Ω resistor.
Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js
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.
Before you begin, make sure you have the following installed and set up:
Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial
Open the src-tauri/tauri.conf.json file to adjust settings like the application window, bundle identifiers, and security policies. For example, you might configure the window title and size:
{
"package": {
"productName": "TauriSvelteApp",
"version": "0.1.0"
},
"tauri": {
"windows": [
{
"title": "My Tauri App",
"width": 800,
"height": 600,
"resizable": true
}
],
"security": {
"csp": "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'"
}
}
}Implementing a Domain-Specific Language (DSL) with LLVM and C++
Project Structure Example:
mydsl/
CMakeLists.txt
include/
DSL/
Lexer.h
Parser.h
AST.h
src/
Lexer.cpp
Parser.cpp
AST.cpp
CodeGen.cpp
main.cpp