Skip to content

Instantly share code, notes, and snippets.

View TheNolle's full-sized avatar
💻
I may be slow to respond.

Nolly TheNolle

💻
I may be slow to respond.
View GitHub Profile
@TheNolle
TheNolle / les.fenêtres.en.javascript.md
Last active May 16, 2024 21:00
A quick and effective guide to creating and managing windows with JavaScript, including code samples, limitations, and best practices for providing an enjoyable user experience.

English Version: Click me


Les fenêtres en JavaScript 🖼️🌐🔩

Dans ce guide, nous allons explorer la création et la gestion des fenêtres avec JavaScript. Vous apprendrez comment créer des fenêtres avec des dimensions précises, positionner et déplacer des fenêtres, et en connaître les limitations. Vous trouverez ci-dessous la table des matières pour vous aider à naviguer facilement dans ce guide.

@TheNolle
TheNolle / _console.color.md
Last active May 16, 2024 20:58
An extension to the console that allows you to use colors directly in a string

Important

It is for Node.JS only

How to use it ?

Either add the class and the line global.console = new Console() in your main file, or put it in another folder and require/import the file in your main file.
Basically, in your main file you add require('path/to/the/file/console.color').
It will allow you to use the command console.color(<string>) anywhere.
Colors are used the same way as minecraft: &<code>

Example

@TheNolle
TheNolle / img-to-pip.js
Created January 18, 2023 11:27
Static Image as Picture In Picture | Pure JavaScript
const video = document.createElement('video') // video element to then ask for pip
// we can't use display = 'none' cause else, pip is blank
video.style.width = '0' // hides it so it doesn't destroy the flow, and shows ONLY the pip
video.style.height = '0' // hides it so it doesn't destroy the flow, and shows ONLY the pip
video.playsInline = true // useful, but not an obligation
video.autoplay = true // obligation
video.muted = true // useful, but not an obligation
const canvas = document.createElement('canvas') // creates the canvas in which we'll put the image
canvas.style.display = 'none' // hides it so it doesn't destroy the flow, and shows ONLY the pip
const ctx = canvas.getContext('2d') // get the 2d context of it