Skip to content

Instantly share code, notes, and snippets.

View TravisL12's full-sized avatar
🪲
Smokes if you got'em.

Travis Lawrence TravisL12

🪲
Smokes if you got'em.
View GitHub Profile
@TravisL12
TravisL12 / app.js
Created September 13, 2024 21:43
Tic Tac Toe React
const PLAYER_MARKS = ["X", "O"];
const EMPTY = "";
const checkWinner = (moves, player) =>
moves.every((c) => c === PLAYER_MARKS[player]);
const Board = ({ size }) => {
const [tiles, setTiles] = React.useState(new Array(size ** 2).fill(EMPTY));
const [playerIdx, setPlayerIdx] = React.useState(1);
const [isWinner, setIsWinner] = React.useState(false);
@TravisL12
TravisL12 / scrapeZoomTranscript.js
Last active August 29, 2024 17:04
Various chrome snippets
// when viewing a zoom recording on the web you can use this to export the transcripts
function scrape(htmlContent) {
const transcriptItems = htmlContent.querySelectorAll('.transcript-list-item');
const chatArray = Array.from(transcriptItems).reduce((acc,item)=>{
const user = item.querySelector('.user-profile-info')?.textContent.trim();
const timestamp = item.querySelector('.time')?.textContent.trim();
const chat = item.querySelector('.text')?.textContent.trim();
@TravisL12
TravisL12 / smb4_rosters.md
Last active May 30, 2023 18:28
Super Mega Baseball 4 Teams
Team League First Last
Boomers Legends Hank Aaron
Boomers Legends Dick Allen
Boomers Legends Vida Blue
Boomers Legends Cecil Cooper
Boomers Legends Tom Herr
Boomers Legends Tommy John
Boomers Legends Carney Lansford
Boomers Legends Frank Linzy
@TravisL12
TravisL12 / application.js
Created February 18, 2022 06:51
Beginner Skeleton project
console.log("hey there!");
@TravisL12
TravisL12 / calculator.js
Last active December 22, 2020 21:59
Calculator function for handling multiple inputs
function operate(num1, num2, operand) {
switch (operand) {
case '-':
return num1 - num2;
case '*':
return num1 * num2;
case '/':
return num1 / num2;
default:
return num1 + num2;
@TravisL12
TravisL12 / README.md
Last active February 24, 2021 17:54
Node Script to crop out images from Super Mega Baseball Card image

Download all the results from : https://drive.google.com/drive/u/0/folders/1RtlftwSAvzLRdTmpspko-ejrwEhGO6Rl

The group team photos I used are from: https://drive.google.com/drive/folders/12hVarUZZ0vGPNSmyXAUcjealuxE4EK4S

The team logos are available from Metalhead: https://www.dropbox.com/sh/47d8tahwogx9qcn/AAC8nU1NF5_hVSBeF9MzRzIza/Logos?dl=0&subfolder_nav_tracking=1

I had to take two photos of each team because one player is always highlighted which makes their image bigger. So for my script you have to separate these two team photos into a ./teams and a ./first_players folders.

Make sure a ./updated directory als exists for the final images.

@TravisL12
TravisL12 / multipleReGroups.js
Created September 21, 2020 19:16
Loop through text to group variables and values
function groupThese(text) {
let idx = 0;
let count = 0;
const groups = {}
const re = new RegExp(/(?<=const |var |let )([^\s=]+)\s?=\s?["']?(#\w*)["']?/,"i");
while (count < 10 && idx >= 0) {
const match = text.slice(idx).match(re)
if (match?.index) {
groups[match[1]] = match[2]
@TravisL12
TravisL12 / html_generate.sh
Created February 7, 2020 17:36
Generate simple HTML/CSS/JS folder structure
#!/bin/bash
NEW_DIR=$1 # define folder/project name as command line argument
if [[ -z $NEW_DIR ]]; then # if no CLI argument provided then prompt for project name
echo "Give a directory name to create:"
read NEW_DIR
fi
ORIG_DIR=$(pwd)
[[ -d $NEW_DIR ]] && echo $NEW_DIR already exists, aborting && exit
@TravisL12
TravisL12 / index.html
Created February 3, 2020 15:07
Cave Forest Game
<html>
<link href="css/styles.css" type="text/css" rel="stylesheet" />
<body>
<div class="content">
<div class="half-container">
<h3>
<span id="top-label">What Awaits? :</span
><span id="top-message"></span>
</h3>
@TravisL12
TravisL12 / application.css
Created March 12, 2018 22:42
Javascript Forrest!
body {
margin: 0;
}
#forrest {
position: relative;
width: 100vw;
height: 100vh;
background-color: lightblue;
}