Skip to content

Instantly share code, notes, and snippets.

View JokingChicken's full-sized avatar
🐔
Always working, just not on the things I should...

DanJ JokingChicken

🐔
Always working, just not on the things I should...
View GitHub Profile
@JokingChicken
JokingChicken / annotated.js
Last active June 15, 2018 12:25 — forked from jed/LICENSE.txt
generate random UUIDs
function b(
a // placeholder
){
return a // if the placeholder was passed, return
? ( // a random number from 0 to 15
a ^ // unless b is 8,
Math.random() // in which case
* 16 // a random number from
>> a/4 // 8 to 11
).toString(16) // in hexadecimal
@JokingChicken
JokingChicken / TrueColour.md
Created April 15, 2018 20:12 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"