Skip to content

Instantly share code, notes, and snippets.

View Arecsu's full-sized avatar
🍪
Baking some cookies

Alejandro Romano Arecsu

🍪
Baking some cookies
View GitHub Profile
@Arecsu
Arecsu / README.md
Created August 25, 2023 18:03 — forked from jennyknuth/README.md
Transform an SVG into a data URI—best practice

How to transform an SVG into a data URI

by Jenny Knuth, based on the work of Chris Coyier and Taylor Hunt

A data URI is a nice way to include a web resource without needing to make an HTTP request. Chris Coyier explains the technique nicely in Probably Don't Base64 SVG.

While a PNG might use Base64 encoding, for SVG, there is a better way.

Taylor Hunt's experiments led to this solution for optimizing SVGs in data URIs:

"So the best way of encoding SVG in a data URI is data:image/svg+xml,[actual data]. We don’t need the ;charset=utf-8 parameter (or the invalid ;utf8 parameter…), because URLs are always ASCII."

@Arecsu
Arecsu / RealViewportDimensions.md
Created June 26, 2022 20:09
Real time REAL viewport height - mobile toolbars included

Javascript code to set a CSS var --real-vh with the real value in px. It updates when the browser gets resized.

function realVH() {
  document.documentElement.style.setProperty('--real-vh', (window.innerHeight) + "px")
}

realVH()
@Arecsu
Arecsu / lasfm-p-dw.py
Last active March 30, 2022 07:22
Last.fm bulk artist photos downloader
# download every image from an artist profile in last.fm!
# full resolution! and multithreading!
# .webp images and .gifs
# want .jpg images instead of .webp? Search for the .replace('jpg' part in the code and delete that line
# jpg in 2022, can you imagine?
#
# usage:
# $ python3 lastfm-p-dw.py https://www.last.fm/es/music/Yung+Lean/+images
#
# SUBMIT A LINK LIKE THAT ONE without any "?page=1". Just clean as the example.