This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* source: https://web.dev/centering-in-css/ */ | |
.gentle-flex { | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
justify-content: center; | |
gap: 1ch; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
- 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Source: https://piccalil.li/blog/a-modern-css-reset/ */ | |
/* Box sizing rules */ | |
*, | |
*::before, | |
*::after { | |
box-sizing: border-box; | |
} | |
/* Remove default margin */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
NewerOlder