Skip to content

Instantly share code, notes, and snippets.

View cassidoo's full-sized avatar
⌨️
sleepy

Cassidy Williams cassidoo

⌨️
sleepy
View GitHub Profile
@cassidoo
cassidoo / wrapunicodespangpt4.md
Last active February 18, 2024 21:24
A GPT-4 prompt to write a simple JavaScript function
View wrapunicodespangpt4.md

Prompt: Write a function in JavaScript that wraps a Unicode character in an HTML document in a <span> tag with a CSS class.


Raw GPT-4 Output:

You can use the following JavaScript function to achieve this:

function wrapUnicodeCharacter(char, cssClass) {
@cassidoo
cassidoo / mergerefs.jsx
Created January 10, 2023 22:57
Merge refs in React so a component can have more than one ref
View mergerefs.jsx
export function mergeRefs(refs) {
return (value) => {
refs.forEach((ref) => {
if (typeof ref === "function") {
ref(value);
} else if (ref != null) {
ref.current = value;
}
});
};
@cassidoo
cassidoo / youtubeid.js
Created January 6, 2023 20:16
Get YouTube ID with JavaScript
View youtubeid.js
let url = "https://www.youtube.com/watch?v=nVvxOwxuk_w";
url = url.split("v=")[1].split("&")[0]; // this removes out any extra parameters, like a playlist point etc
console.log(url);
// id = nVvxOwxuk_w
@cassidoo
cassidoo / base-css.md
Created May 4, 2022 06:37
Base CSS for a plain HTML document
View base-css.md

If you don't want to deal with styling a mostly text-based HTML document, plop these lines in and it'll look good:

html {
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  font-size: 1.3em;
  max-width: 40rem;
  padding: 2rem;
  margin: auto;
 line-height: 1.5rem;
@cassidoo
cassidoo / .zshrc
Created February 13, 2022 23:16
Latest .zshrc file
View .zshrc
export HOMEBREW_INSTALL_BADGE="🧋"
# Bash/ZSH Stuff
alias reload='source ~/.zshrc'
alias a='echo "------------Your aliases------------";alias'
alias sa='source ~/.zshrc;echo "ZSH aliases sourced."'
alias bp='vim ~/.zshrc'
# Install git completion here: brew install git bash-completion
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
@cassidoo
cassidoo / 5letterdictionary.txt
Created January 10, 2022 02:50
Words that are 5 letters long
View 5letterdictionary.txt
ABACI
ABACK
ABASE
ABASH
ABATE
ABBEY
ABBOT
ABEAM
ABEAR
ABETS
@cassidoo
cassidoo / support.html
Created December 3, 2021 18:38
Support Black Orgs
View support.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Support Black Orgs</title>
<link rel="stylesheet" href="https://fonts.xz.style/serve/inter.css" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css"
@cassidoo
cassidoo / index.js
Created December 3, 2021 18:25
React demo
View index.js
import React, { useState, useEffect, useReducer, useMemo } from 'react'
import ReactDOM from 'react-dom'
// let text = 'hellllooooo'
// I AM REACT
// let domTable = {}
// let element = Counter // state = 0
// commit(element, domTable)
@cassidoo
cassidoo / index.html
Created December 3, 2021 18:15
Netlify Form Demo
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ha ha, Business!</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
<h1>I am an incredibly fancy business woman</h1>
@cassidoo
cassidoo / human.md
Created October 14, 2021 20:22
Human Template for Obsidian
View human.md
cuid alias tags
human<% tp.file.creation_date("YYYYMMDD-HHmmss") %>
👤 <% tp.file.title.substring(1) %>
<% tp.file.title.substring(1) %>
person/friends, person/family, person/coworker, person/rwc

👤 <% tp.file.title.substring(1) %>

🎂 Birthday: 💌 Email: ☎️ Phone: