Skip to content

Instantly share code, notes, and snippets.

View francoisgeorgy's full-sized avatar

François Georgy francoisgeorgy

View GitHub Profile
@francoisgeorgy
francoisgeorgy / index.html
Created November 26, 2024 12:49
Smooth Full-Spectrum Color Picker with buttons
<div id="color-spectrum">
<canvas id="gradient-canvas"></canvas>
<div id="color-indicator"></div>
</div>
<div id="selected-color">Selected Color: <span id="color-display">N/A</span></div>
<div id="controls">
<button id="select-white">Select White</button>
<button id="select-black">Select Black</button>
<button id="select-random">Select Random</button>
</div>
@francoisgeorgy
francoisgeorgy / centering.css
Created January 7, 2022 14:07
css centerring #css
/* source: https://web.dev/centering-in-css/ */
.gentle-flex {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1ch;
}
@francoisgeorgy
francoisgeorgy / midi-frequency-voct.cpp
Created November 21, 2021 06:36
C++ MIDI Frequency V/oct #cc #audio #cpp #midi
/* https://onecompiler.com/cpp/3xhec63fj */
#include <cstdint>
#include <cmath>
/*
Examples for converting between note numbers, frequencies, and Volts/octave.
If you're unfamiliar with MIDI note numbers, they are integers that
correspond to semitones (half steps). For example, MIDI note 12 is
@francoisgeorgy
francoisgeorgy / proxy-and-reflect.js
Created November 14, 2021 19:54
#javascript #proxy
// https://reflect.run/articles/reflection-at-reflect/
// PROXY example 1 :
// makeStoreAccessProxy.ts
const makeStoreAccessProxy = (obj: Object) => {
return new Proxy(obj, {
get(target, key, receiver) {
console.log(`GOT FIELD ${key}`)
return Reflect.get(target, key)
@francoisgeorgy
francoisgeorgy / theme-detection.css
Created October 31, 2021 08:19
CSS theme detection #css
/*
Source: https://naruhodo.dev/detect-users-favorite-theme-with-css-only/
*/
/* If user's system preference is light or unknown */
@media (prefers-color-scheme: light) {
:root {
--palette-background: var(--light-palette-background);
--palette-text: var(--light-palette-text);
@francoisgeorgy
francoisgeorgy / scrollbars.css
Created October 31, 2021 08:10
CSS scrollbar #css
/*
- https://www.bram.us/2021/07/23/prevent-unwanted-layout-shifts-caused-by-scrollbars-with-the-scrollbar-gutter-css-property/
- https://codepen.io/bramus/pen/LYyzKrX
*/
.scrollbar-gutter-auto {
scrollbar-gutter: auto;
}
.scrollbar-gutter-stable {
@francoisgeorgy
francoisgeorgy / reset.css
Created October 31, 2021 08:05
CSS Reset #css
/* Source: https://piccalil.li/blog/a-modern-css-reset/ */
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Remove default margin */
ps aux | convert label:@- process.png
curl ipinfo.io
# see which commands you run often
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
# view the 10 largest directories in your current directory
du -hs */ | sort -hr | head
@francoisgeorgy
francoisgeorgy / git-forked.txt
Created November 22, 2020 08:13
#git move back forked repo
# https://stackoverflow.com/questions/43686302/how-to-move-forked-repo-back-to-the-main-repo
$ git remote add forked <forked-repo-url>
$ git checkout master
$ git pull forked master # now your repo's master = forked repo's master
$ git push origin master # push/update remote master
@francoisgeorgy
francoisgeorgy / limitLoop.js
Created September 9, 2020 11:14 — forked from addyosmani/limitLoop.js
Limit the frame-rate being targeted with requestAnimationFrame
/*
limitLoop.js - limit the frame-rate when using requestAnimation frame
Released under an MIT license.
When to use it?
----------------
A consistent frame-rate can be better than a janky experience only
occasionally hitting 60fps. Use this trick to target a specific frame-
rate (e.g 30fps, 48fps) until browsers better tackle this problem