190. Reverse Bits

Reverse bits of a given 32 bits signed integer.
/**
 * @param {number} n
 * @return {number}
 */
var reverseBits = function(n) {
    // This will accumulate the reversed bit pattern.
    // Start at 0 because we build it up bit-by-bit.
    let result = 0;

    // We must process exactly 32 bits.
    for (let i = 0; i < 32; i++) {

        // Step 1: Extract the least significant bit (LSB) of n.
        // (n & 1) gives us either 0 or 1.
        let bit = n & 1;

        // Step 2: Shift result left to make room for the new bit.
        result

AI ML

# AI / ML

## Prompt

Openness to experience, Conscientiousness, Extraversion, Agreeableness, Non-Neuroticism. (https://github.com/aimclub/OCEANAI?tab=readme-ov-file)


- AIM
- OCEAN
- CoT

## Context

- `.github/prompts/*.prompt.md` - default in VSCode (change: `chat.promptFilesLocations`) https://code.visualstudio.com/docs/copilot/customization/prompt-files
- `@...`
- Structured Output

how to test if a element is enabled on page using Playwright?

// you can do that using the toBeEnabled method of the object that returns expect method
 
import { test, expect } from '@playwright/test';
 
test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const inputName = page.locator("#name") // Select element by id
  await expect(inputName).toBeEnabled()
});

how to check if a element is visible on a page using PlayWright?

// you can do that using the toBeVisible method of the object that returns expect method
 
import { test, expect } from '@playwright/test';
 
test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const inputName = page.locator("#name") // Select element by id
  await expect(inputName).toBeVisible()
});

how to select an html element using css selector in Playwright?

// you can do that using the locator method of the page object that is set as argument of the test function argument

import { test, expect } from '@playwright/test';

test('basic test', async ({ page }) => {
  await page.goto('https://playwright.dev/');
  const inputName = page.locator("#name") // Select element by id
  await expect(inputName).toBeVisible()
});

Prevent to push on branches

- Create `.git/hooks/pre-push` with ``` #!/bin/bash protected_branches=("develop" "main" "master" "prodcution") current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') for branch in "${protected_branches[@]}"; do if [ "$current_branch" = "$branch" ]; then echo "🚫 Direct push to '$branch' is not allowed." echo " Please create a feature branch and open a pull request." exit 1 fi done exit 0 ``` - Then make it executable with `chmod +x .git/hooks/pre-push`
#!/bin/bash

protected_branches=("develop" "main" "master" "production")
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')

for branch in "${protected_branches[@]}"; do
    if [ "$current_branch" = "$branch" ]; then
        echo "🚫 Direct push to '$branch' is not allowed."
        echo "   Please create a feature branch and open a pull request."
        exit 1
    fi
done

exit 0

How to navigate to another page on Playwright?

// You can navigate to another page using the goto method of the page object that is set as argument on the function argument for test function page.goto
import { test, expect } from '@playwright/test';
  test('email entered on login page is displayed on code page', async ({ page }) => {
    await page.goto('/login');
  })

🐧 - Ubuntu - Cheatsheet `fd`

# Cheatsheet fd — De zéro à avancé

## Syntaxe générale

```
fd [FLAGS/OPTIONS] [<pattern>] [<chemin>]
```

- `pattern` : regex par défaut (pas un glob)
- `chemin` : dossier de recherche (défaut : répertoire courant)
- Tout est optionnel : `fd` seul liste tous les fichiers non-cachés du dossier courant

---

## Niveau 1 : Les fondamentaux

### Recherche simple

```bash
# Tous les fichiers contenant "test" dans le nom
fd test

# Recherche dans un dossier spécifique
fd test src/

# Recherche depui

🐧 Ubuntu - Alternatives modernes à find et grep

# Alternatives modernes à `find` et `grep` sur Ubuntu

## Vue d'ensemble

| Outil classique | Alternative moderne | Auteur / Écosystème | Langage |
|-----------------|--------------------|--------------------|---------|
| `find` | **fd** | David Peter | Rust |
| `grep` | **ripgrep** (`rg`) | Andrew Galloway (BurntSushi) | Rust |

Philosophie commune : valeurs par défaut intelligentes, parallélisation, respect automatique de `.gitignore`, syntaxe concise.

---

## fd — Remplaçant de `find`

### I

How can I check what is the remote repository of my current branch?

git remote -v
# origin  https://github.com/user/repo.git (fetch)
# origin  https://github.com/user/repo.git (push)

10. Creer un enemy qui chasse le Player

-- Creer une variable Player

-- Dans ready sauvegarder le player

func _ready() -> void:
	player = get_tree().get_first_node_in_group("Player")

-- Dans physicis process utuliser direction_to

func _physics_process(delta: float) -> void:
	direction = position.direction_to(player.position)
	velocity = direction * vitesse

-- Jouer animation de l'enemy:
 
 func enemy_animation():
	if abs(direction.x) > abs(direction.y):
		if direction.x > 0.0:
			animated_sprite_2d.play("walk_right")
		elif  dire

9.Comment implementer attaque Godot

-- Creer une variable bool pour traquer l'attaque

-- Dans Physic process

func _physics_process(delta: float) -> void:
	if est_en_train_attaquer:
		velocity = Vector2.ZERO
		return


-- Puis creer la function integré de Godot

func _unhandled_input(event: InputEvent) -> void:
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
			if not est_en_train_attaquer:
				est_en_train_attaquer = true
				animated_sprite_2d.play("attack_" +

Crypto Class for PHP

<?php

class Crypto
{
    private const CIPHER = 'aes-256-gcm';

    /* ---------- KEY HELPERS ---------- */

    public static function generateKey(): string
    {
        return random_bytes(32);
    }

    /* ---------- STRING ENCRYPT / DECRYPT ---------- */

    public static function encrypt(string $plaintext, string $key): string
    {
        $ivLength = openssl_cipher_iv_length(self::CIPHER);
        $iv = random_bytes($ivLength);

        $ciphertext = openssl_encrypt(
            $plai

Bootstrap Styled PC Repair Services Section

<section class="py-5 bg-light">
  <div class="container">
    <div class="text-center mb-5">
      <h2 class="fw-bold">PC Repair & IT Support Services</h2>
      <p class="text-muted">Reliable technical solutions for home and business users</p>
    </div>

    <div class="row g-4">

      <!-- Service 1 -->
      <div class="col-md-4">
        <div class="card h-100 shadow-sm">
          <div class="card-body text-center">
            <i class="bi bi-pc-display fs-1 text-primary"></i>
          

67. Add Binary

Given two binary strings a and b, return their sum as a binary string.
/**
 * Adds two binary strings and returns their binary sum.
 * @param {string} a
 * @param {string} b
 * @return {string}
 */
var addBinary = function(a, b) {
    let result = "";   // final binary string (built from right to left)
    let carry = 0;     // carry bit (0 or 1)

    // Continue while there are digits left in either string OR a remaining carry
    while (a.length > 0 || b.length > 0 || carry > 0) {

        // Extract last digit of each string (or 0 if empty)
        const bitA = 

Generate a Full URL of Current Page

<?php
// Determine the protocol (http or https)
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https://" : "http://";

// Get the host name (e.g., www.example.com)
$host = $_SERVER['HTTP_HOST'];

// Get the requested URI (e.g., /path/to/page.php?query=string)
$uri = $_SERVER['REQUEST_URI'];

// Construct the full URL
$current_url = $protocol . $host . $uri;

// Echo the URL
echo $current_url;
?>