Skip to content

Instantly share code, notes, and snippets.

View ThomasRettig's full-sized avatar
👋
Hello

Thomas Rettig ThomasRettig

👋
Hello
View GitHub Profile
@ThomasRettig
ThomasRettig / delete-files.pl
Created March 31, 2023 11:09
Deletes files in a specified directory (and its subdirectories) that don't have a file extension
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
my $dir = "/path/to/directory"; # specify directory path here
find(\&process_file, $dir);
@ThomasRettig
ThomasRettig / rainbow-text.css
Created September 2, 2022 12:09
Colourful text
.rainbow-text {
-webkit-text-fill-color: transparent;
background: linear-gradient(71.18deg, rgb(0, 34, 255) -27.32%, rgb(0, 34, 255) -16.39%, rgb(81, 121, 254) -7.38%, rgb(165, 237, 182) 30.59%, rgb(250, 232, 90) 46.06%, rgb(253, 172, 62) 62.61%, rgb(255, 92, 0) 75.82%) text;
}
img {
min-height: 50px;
}
img::before {
content: " ";
display: block;
position: absolute;
top: -10px;
.wrapper::after {
content: "";
display: block;
background: linear-gradient(180deg, hsla(0, 0%, 100%, 0), white 50%, white);
bottom: 0;
position: fixed;
left: 12px;
height: 100px;
width: 33%;
}
@ThomasRettig
ThomasRettig / reflection.css
Created May 1, 2022 11:26
CSS Image Reflection (non-standard)
img {
-webkit-box-reflect: below 0.5vmin linear-gradient(transparent 0 50%, #ffffff38 100%);
}

The 19 Combinations of Writing HTML

The 6 general ways of writing HTML now lead to the following 19 combinations of writing HTML. It’s a list of ways that are compatible with each other.

The list doesn’t include random combinations—for example, when a unsystematically written document happens to be valid.

Unsystematic

  • Valid
  • Valid, semantic
  • Valid, semantic, accessible
  • Valid, semantic, accessible, required-only
@ThomasRettig
ThomasRettig / crypto.js
Created March 14, 2022 15:35
Little Node.js experiment which uses the `crypto` library to hash a string with the sha256 algorithm.
const { createHmac } = await import("crypto");
const secret = "blah blah";
const hash = createHmac("sha256", secret)
.update("Blah Blah")
.digest("hex");
console.log(hash);
document.title = (
(new Date()).toTimeString().split(':').slice(0,2).join(':') +
' — ' + (new Date()).toDateString();
);
// by Rasmus Andersson https://github.com/rsms/inter/blob/7b4e19f9a852a394885ccb935decb4ad0732d4c8/docs/lab/index.html#L1274
@ThomasRettig
ThomasRettig / selectmenu.html
Created March 4, 2022 11:54
<selectmenu> syntax
<style>
.my-select-menu::part(button) {
color: white;
background-color: #f00;
padding: 5px;
border-radius: 5px;
}
.my-select-menu::part(listbox) {
padding: 10px;
@ThomasRettig
ThomasRettig / links.css
Last active May 1, 2022 11:27
Display an icon if the link opens in a new tab