Inspiration from article How to Favicon in 2025: Three files that fit most needs.
Image sizes:
- .svg
- 32x32
- 180x180
- 192x192
<?php | |
// User uploads a profile picture (jpg or png), try to verify it is a safe file. | |
// Helpful info about uploading files in PHP: https://www.php.net/manual/en/features.file-upload.php | |
// use finfo to learn the file MIME type: https://www.php.net/manual/en/function.finfo-open.php | |
$finfo = new finfo(FILEINFO_MIME_TYPE); | |
for each($_FILES[‘pictures’][‘error’] as $key => $error) { | |
if ($error == UPLOAD_ERR_OK) { | |
$tmpName = $_FILES[‘pictures’][‘tmp_name’][$key]; |
/** | |
* Parse a string of tags into an array of individual tags. Tags are either delimited | |
* with a ; or a /, but only one or the other. It also weeds out things we don't want | |
* such as empty or invalid tags. | |
* @param {string} A string of tags, each tag separated by a / or a ;. | |
* @returns {Array} An array of the individual tag strings, one tag per array element. | |
*/ | |
function parseTags(tags) { | |
const tagsNotAllowed = ["shit", "fuck", "dick"]; | |
const tagsNormalized = tags.trim().toLowerCase(); |
Inspiration from article How to Favicon in 2025: Three files that fit most needs.
Image sizes:
/** | |
* Count the number of times each unique word appears in the string of text. The text is | |
* normalized to lowercase and | |
* @param {string} text A string of text to process. | |
* @returns {array} An array of key/value pairs where the key is the word encountered in | |
* the text string and the value is the count of occurrences of that word in the text. | |
*/ | |
function determineWordWeights(text) { | |
const stopWords = [ |
Many hidden and OS files are not shown in Finder. In a Finder window, ⌘ + ⇧ + . to show all files in Finder.
From this window you can start up from a different disk, start up in safe mode, use macOS Recovery, and more.
/** | |
* Remove and add classes to any element. Removes are performed before adds. | |
* @param {string} Selector to target. Must resolve to a single element. | |
* @param {string|array} Classes to add. If using single string, can only be a single class. Otherwise use array of strings for each class to add. | |
* @param {string|array} Classes to remove. If using single string, can only be a single class. Otherwise use array of strings for each class to remove. | |
*/ | |
function setClassList(selector, classesToAdd, classesToRemove) { | |
let element = document.querySelector(selector); | |
if (Array.isArray(classesToRemove) && classesToRemove.length > 0) { |
const screenSizes = ["sm", "md", "lg", "xl", "2xl"]; | |
const screenWidthPx = { | |
sm: "640px", | |
md: "768px", | |
lg: "1024px", | |
xl: "1280px", | |
"2xl": "1536px" | |
}; | |
const screenWidth = { | |
sm: 640, |
<!DOCTYPE html> | |
<html lang="en" dir="ltr"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /> | |
<title>HTML console type text animation</title> | |
<style> | |
.introContainer { | |
width: 90%; | |
max-width: none; |