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 / customWhitespaceMatcher.js
Last active February 21, 2023 20:12
A custom matcher for when you want to compare strings in Jest and ignore whitespace
// Modified version of this Stack Overflow response:
// https://stackoverflow.com/a/48459005/1950503
// (Removes ramda dependency, adds .trim() to string replacer, adds it to Jest global var instead of exporting)
// To use:
// Put `<rootDir>/path/to/customWhitespaceMatcher.js` in your Jest config under setupFiles
// Call it in your tests like this:
// expect(
// customMatchers.whitespaceMatcher(receivedResult, expectedResult).pass
// ).toBeTruthy();
@cassidoo
cassidoo / useMedia.jsx
Last active October 27, 2022 16:13
An example of checking on a media query with React Hooks
function useMedia(query) {
const [matches, setMatches] = useState(window.matchMedia(query).matches)
useEffect(() => {
const media = window.matchMedia(query)
if (media.matches !== matches) {
setMatches(media.matches)
}
const listener = () => {
setMatches(media.matches)
import time
print "..."
time.sleep(1)
print "..."
print "..."
print "..."
print "..."
time.sleep(1)
print "..."
@cassidoo
cassidoo / .zshrc
Created February 13, 2022 23:16
Latest .zshrc file
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
ABACI
ABACK
ABASE
ABASH
ABATE
ABBEY
ABBOT
ABEAM
ABEAR
ABETS
@cassidoo
cassidoo / copilot-suggestions.js
Last active December 11, 2021 19:05
A gist of all of the functions that Copilot wrote for me
/**
As seen on twitch.tv/cassidoo
*/
// A function that validates an email address
function validateEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
@cassidoo
cassidoo / support.html
Created December 3, 2021 18:38
Support Black Orgs
<!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
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
<!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 / Igneous.css
Last active December 1, 2021 21:20
An Obsidian theme
/*
IMPORTANT: Change the fonts on lines 31-35 to make this work the way you want!
*/
:root {
--dark0: #2e3440;
--dark1: #3b4252;
--dark2: #434c5e;