Skip to content

Instantly share code, notes, and snippets.

View eldonwilliams's full-sized avatar
😁

Eldon Williams eldonwilliams

😁
View GitHub Profile
// Eldon Williams
// Lab 6
// Imports
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Constants as compiler macros
@eldonwilliams
eldonwilliams / main.c
Created March 4, 2026 16:52
Arduino lab programming 2 ENGR 111 UofL
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
pinMode(A0, INPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
@eldonwilliams
eldonwilliams / main.c
Created March 3, 2026 17:52
Arduino Traffic Light Crossing Controller
#include <LiquidCrystal_I2C.h>
#include <math.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const float warningTime = 1000;
const float crossingTime = 5000;
float requestedCrossingTime = 0;
@eldonwilliams
eldonwilliams / EXPLAIN.md
Last active June 18, 2023 05:58
A cool little bit of code and how it works

What is going on here

Let's break down the thing we're trying to do...

The problem

We want to display text to the user. HTML lets us do this using p tags (short for paragraph). What if we need some text with a link inside it like

Hello, how are doing?

@eldonwilliams
eldonwilliams / useMediaQuery.ts
Created May 18, 2023 13:16
A react hook to make a media query
import { DependencyList, useEffect, useState } from "react";
/**
* Takes in the handler function, subscribes it to any functions you need, and then returns a cleanup function.
*/
export type eventSetup_fn = (handler: ()=>void) => (()=>void); // looks nasty cause react doesn't export Destructor type
/**
* Performs a media query and returns the result.
* Event setup allows you to subscribe to any events that the media query may depend on,
@eldonwilliams
eldonwilliams / UILineRenderer.cs
Created April 17, 2023 19:25
Renders a line using unity's canvas system. Takes any number of points. Scale should be Vector3.one and size should be (0,0) for best results. Credit to CGPala for the original version
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
/// <summary>
/// Renders a line using the UI canvas system.
/// </summary>
/// Thank you CGPala for the original UILineRender
/// https://gist.github.com/CGPala/d1ace7dddbfbe78cd2de2bb9e40f6393
[RequireComponent(typeof(CanvasRenderer))]
local Spr = require(game:GetService("ReplicatedStorage"):WaitForChild("Packages"):WaitForChild("Spr"))
export type TargetInstance = Frame
export type InitialPositionFunction = (target: TargetInstance) -> Vector2
export type NewSpringListElementParams = {
RenderInstance: GuiObject,
SpringDamping: number,
SpringFrequency: number,
CalculateInitalPosition: InitialPositionFunction,
TargetParent: Instance,
import { Divider, Paper, Stack, Typography } from "@mui/material";
import { motion } from "framer-motion";
import { useState } from "react";
import StyledTextField from "./StyledTextField";
const STFWrap = (props: Parameters<typeof StyledTextField>[0]) => {
const [focused, setFocused] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>("");
return (
# GIST NOTE
"""
TimeProvider is a basic utility which will give a *reliable* signal X times a second.
It isn't considered to be 100% reliable and the signal connections are provided the deltatime as well as the tick number.
The timer also takes account of the time it takes to execute any connections
Possible efficency increases:
- Wrap each signal connection in a thread and wait for them all to resolve allowing multiple to run at once and keeping one for yielding (timeouts could be imposed)
- Fix the deltatime for the first two frames, currently it initalizes to 0 (which is normal I think) and the second frame is wonky, afterward I get expected behaviour
- Is it compatiable with different OS's?
local Players = game:GetService("Players")
local R15Blank = game:GetService("ReplicatedStorage"):WaitForChild("Assets"):WaitForChild("R15Blank")
local LoadCharacter = {}
-- Generally useful types
export type BrickColorID = number
export type AssetType = string
export type CharacterAsset = {