/**
* @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
## 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// 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()
});// 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()
});// 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()
});#!/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// 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');
})# 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# 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`
### Igit remote -v
# origin https://github.com/user/repo.git (fetch)
# origin https://github.com/user/repo.git (push)
-- 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-- 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_" +<?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<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>
/**
* 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 = <?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;
?>