Skip to content

Instantly share code, notes, and snippets.

View MatthewCallis's full-sized avatar
🍖
Hungry Goriya

Matthew Callis MatthewCallis

🍖
Hungry Goriya
View GitHub Profile
@MatthewCallis
MatthewCallis / AI & Coding.md
Last active March 14, 2024 17:59
Using AI to help write better code

AI & Coding

Let's just ask it.

🧔🏻‍♂️ You: How can software engineers make the best use of generative AI technologies?

🤖 ChatGPT: To make the best use of generative AI technologies, software engineers can:

  1. Automate repetitive tasks: Use AI to generate code snippets, documentation, or automate testing and debugging.
  2. Enhance creativity: Leverage AI for design, brainstorming new ideas, or solving complex problems.
@MatthewCallis
MatthewCallis / test-state-setters.tsx
Created February 26, 2024 17:21
React Code Snippets
// Testing State Setters
// const [payload, setPayload] = useState({})
it('can update the number of times to loop', () => {
const mockSetPayload = vi.fn()
const mockPayload = {
timeOfLoop: 0,
amount: 0,
units: 'hours',
exitCondition: {
groups: [],
@MatthewCallis
MatthewCallis / .zprofile
Last active January 21, 2024 22:59
zsh Confugration
eval "$(/opt/homebrew/bin/brew shellenv)"
@MatthewCallis
MatthewCallis / useEffectDebugger.ts
Last active August 31, 2023 20:43
useEffectDebugger See what changed in useEffect
// https://stackoverflow.com/questions/55187563/determine-which-dependency-array-variable-caused-useeffect-hook-to-fire
// https://github.com/simbathesailor/use-what-changed/tree/master
// https://dev.to/vsramalwan/ways-to-handle-deep-object-comparison-in-useeffect-hook-1elm
import { toJS } from 'mobx'
import { useEffect, useRef } from 'react'
import type { EffectCallback } from 'react'
export interface Update {
oldValue: any
@MatthewCallis
MatthewCallis / useDebounce.test.ts
Last active August 23, 2023 17:33
Debounce & useDebounce React Hook
import { renderHook } from '@testing-library/react-hooks/dom'
import useDebounce, * as allDebounce from 'hooks/useDebounce'
describe('debounce', () => {
it('calls as expected', () =>
new Promise<void>((done) => {
const callingArgument = 'debounce it!'
const debounceCallback = (value: string) => {
expect(value).toBe(callingArgument)
@MatthewCallis
MatthewCallis / Pull Request - Tips & Strategies.md
Created July 18, 2023 16:46
Pull Request - Tips & Strategies

Pull Requests

Having fellow developers check your code (and checking theirs in turn) helps eliminate mistakes, clean the codebase, and share knowledge across the team. Code review is a purely human communication process. And a good way to approach humans (especially the ones you need to work with) is with empathy. This includes the obvious: politeness, kindness, and respect. But you can go a step further and remember that when you're assigning reviewers to look through your code, you're requesting another person's time and energy. Therefore, it's nice to make the process easier for them, and doing so will probably result in a more efficient code review. So, keeping empathy in mind, let's discuss some practical tips that can make your code reviewers happier.

Before & During Coding

Branch Naming Strategy

The branch name is your first opportunity to give your task context. In case your reviewer decides to check the code out locally, they will need to find that branch among many others. Prefix the br

@MatthewCallis
MatthewCallis / playwright.config.ts
Created January 16, 2023 22:43
Playwright Config
import type { PlaywrightTestConfig } from '@playwright/test';
import { devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
@MatthewCallis
MatthewCallis / index.html
Created January 13, 2023 19:12
Animated Form Labels
<div className="flex gap-3 justify-between">
<div className="animated-label w-full">
<fieldset>
<input
defaultValue={user?.FirstName}
id="first-name"
name="first-name"
type="text"
autoComplete="given-name"
className={`${inputStyles} ${hasError['first-name'] && 'border-red-500'}`}
@MatthewCallis
MatthewCallis / ffmpeg-video-generation.sh
Created April 30, 2022 01:31
Use FFMPEG to generate video for audio
# Game of Life
ffmpeg -i audio.wav \
-vsync vfr -filter_complex "life=size=1920x1554:mold=10:rate=60:random_fill_ratio=0.1:death_color=#ff32ff:life_color=#33feff[left]; \
[0:a]showspectrum=mode=separate:slide=scroll:color=rainbow:scale=cbrt:size=1920x1554[right]; \
[0:a]showwaves=size=3840x606:mode=p2p:rate=30:colors=0xff32ff|0x33feff[bottom]; \
[left][right]hstack[top]; \
[top][bottom]vstack[out]" -map "[out]" -map 0:a -c:v libx264 -profile:v high -bf 2 -g 30 -crf 18 -pix_fmt yuv420p -c:a aac -b:a 384k -r 48000 -shortest -movflags +faststart -threads 0
# Cellauto
ffmpeg -i audio.wav \
@MatthewCallis
MatthewCallis / cassette-tape-recorder.md
Last active March 5, 2022 06:50
Helpful Information & Links for Cassette Tape Recorders

Tascam Portastudio 414

Some notes for working on and with the Tascam 414 Portastudio 4 Track Recorder deck.

The gap between Erase and Write is 0:00:245 in length at normal speed, 0:00:301 at slow speed.

Generic 5 Second Cassette Loop

This is a generic clear tape loop from WarbleLoopLab. The tape has a particular constant warble, to the point a clear sine tone cannot be read out enough to get an exact key difference. The BPM difference is also impacted by the extreme warble, where it will skip ahead or completely stop on occasion.