Skip to content

Instantly share code, notes, and snippets.

View icorbrey's full-sized avatar
🕹️
N64s are cool

Isaac Corbrey icorbrey

🕹️
N64s are cool
View GitHub Profile
@icorbrey
icorbrey / TicTacToe.cs
Created October 3, 2023 19:24
A playable game of Tic Tac Toe in the terminal. Written in C#.
#pragma warning disable CS8524
string[] TEMPLATES = {
"┏━━━┱───┬───┐\n┃ A ┃ B │ C │\n┡━━━╃───┼───┤\n│ D │ E │ F │\n├───┼───┼───┤\n│ G │ H │ I │\n└───┴───┴───┘", // (1, 1) selectedTile
"┌───┲━━━┱───┐\n│ A ┃ B ┃ C │\n├───╄━━━╃───┤\n│ D │ E │ F │\n├───┼───┼───┤\n│ G │ H │ I │\n└───┴───┴───┘", // (2, 1) selectedTile
"┌───┬───┲━━━┓\n│ A │ B ┃ C ┃\n├───┼───╄━━━┩\n│ D │ E │ F │\n├───┼───┼───┤\n│ G │ H │ I │\n└───┴───┴───┘", // (3, 1) selectedTile
"┌───┬───┬───┐\n│ A │ B │ C │\n┢━━━╅───┼───┤\n┃ D ┃ E │ F │\n┡━━━╃───┼───┤\n│ G │ H │ I │\n└───┴───┴───┘", // (1, 2) selectedTile
"┌───┬───┬───┐\n│ A │ B │ C │\n├───╆━━━╅───┤\n│ D ┃ E ┃ F │\n├───╄━━━╃───┤\n│ G │ H │ I │\n└───┴───┴───┘", // (2, 2) selectedTile
"┌───┬───┬───┐\n│ A │ B │ C │\n├───┼───╆━━━┪\n│ D │ E ┃ F ┃\n├───┼───╄━━━┩\n│ G │ H │ I │\n└───┴───┴───┘", // (3, 2) selectedTile
"┌───┬───┬───┐\n│ A │ B │ C │\n├───┼───┼───┤\n│ D │ E │ F │\n┢━━━╅───┼───┤\n┃ G ┃ H │ I │\n┗━━━┹───┴───┘", // (1, 3) selectedTile
export type Option<T> = {
unwrap: (message?: string) => T
match: <R>(matchers: OptionMatchers<T, R>) => R
}
type OptionMatchers<T, R> = {
onSome: (value: T) => R
onNone: () => R
}
/**
* Generates a hash code from the given string using the `cyrb53` hashing
* algorithm.
*
* @param {string} str
* @param {number=} seed
*/
export const hashCode = (str, seed = 0) => {
let h1 = 0xdeadbeef ^ seed;
#!/bin/bash
compare='dev'
min_commits_ahead=5
max_commits_behind=500
max_time_elapsed="$((30 * 24 * 60 * 60))"
git fetch origin 2> /dev/null
branches="$(\
git remote show origin \
@icorbrey
icorbrey / timer.cpp
Created September 2, 2021 13:08
High resolution timer for algorithm development
#include "timer.hpp"
using namespace std;
using namespace std::chrono;
timer::timer()
{
this->hasRun = false;
this->start = high_resolution_clock::now();
}
type LocaleStrings<K extends string> = {
[key in K]: string
}
type LocaleArea<A extends string, S extends string | number> = {
[K in `@${A}/${S}`]: string
}
const area = <A extends string, K extends string>(area: A, strings: LocaleStrings<K>): LocaleArea<A, K> =>
Object.keys(strings)
declare var _screen: Screen & {
queryByRole: (role: string, options: { name: string }) => HTMLElement
queryByTestId: (testId: string) => HTMLElement
}
declare var fireEvent: {
click: (element: HTMLElement) => void
type: (element: HTMLElement, text: string) => void
}

Project Flow

  • Code is stored on a primary branch master, with no develop branch.
  • Issues
    • Roadmaps
      • Created with title vX.Y.Z
      • Gets the tag #roadmap
      • Gets a milestone of the same name
      • Current roadmap should be pinned
  • Features
import { writable } from 'svelte/store'
export const reducible = (reducer, initialState) =>
{
const { subscribe, update } = writable(initialState)
const dispatch = action =>
update(state => reducer(state, action))
return {
@icorbrey
icorbrey / git-repo-setup.md
Created June 25, 2021 17:52
Git Repo Setup

Setting Up a New GitHub Repo

Branches

Branch Purpose
master Holds the latest development progress.
stable Holds the latest stable release.
enhancement/* Contains WIP enhancements.
hotfix/* Contains hotfixes for bugs.