Skip to content

Instantly share code, notes, and snippets.

View arbaouimehdi's full-sized avatar
🎯
focusing

Arbaoui Mehdi arbaouimehdi

🎯
focusing
View GitHub Profile

Setup Visual Studio Code Live Server to Use HTTPS

How to setup Live Server extension for Visual Studio Code to use HTTPS with your own SSL certificate without Chrome complaining about an untrusted certificate or insecure origin.

✅ Chrome 115.0.5790.75

✅ macOS Monterey 12.6.7

Warning

Make sure Chrome is not already running.

@arbaouimehdi
arbaouimehdi / measure-operation-duration.js
Created March 17, 2024 14:48
Measures the duration of a 2-second simulated operation after page `load` using `performance.now()`
// Function to simulate
// a long-running operation
function longRunningOperation() {
// Simulate a 2-second operation
return new Promise((resolve) => {
setTimeout(() => {
console.log(
"Operation completed"
);
resolve();
@arbaouimehdi
arbaouimehdi / vscode-link-replacement-using-regex.md
Last active January 7, 2024 20:23
Link Replacement with Regex in VS Code
@arbaouimehdi
arbaouimehdi / vscode-regex-href-replace.html
Created December 1, 2023 20:59
VSCode RegEx `href` Replace
Regex: href="[^"]*"
@arbaouimehdi
arbaouimehdi / vscode-regex-html-comment-removal.html
Created December 1, 2023 20:55
VSCode Regex Comment Removal
RegEx: <!--[\s\S]*?-->
@arbaouimehdi
arbaouimehdi / video-visbility-handler.js
Created October 31, 2023 19:04
Pauses or Play a video based on the tab's visibility status
/**
* Determines the browser-specific properties
* for detecting document visibility changes.
*/
function getVisibilityProperties() {
const mappings = {
hidden: "visibilitychange",
msHidden: "msvisibilitychange",
webkitHidden: "webkitvisibilitychange",
};
@arbaouimehdi
arbaouimehdi / demo.html
Created October 26, 2023 10:34
List.js Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<link rel="stylesheet" href="draft.css" />
<title>Demo</title>
@DATABASE@__%Y-%m-%d_%H-%M-%S
//Self-Signed Certificate for using with VS Code Live Server
//Save both files in a location you will remember
1. create a private key
openssl genrsa -aes256 -out localhost.key 2048
// you will be prompted to provide a password
//this will create localhost.key (call it whatever you like)
2. create the certificate

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).