Skip to content

Instantly share code, notes, and snippets.

View rcoppy's full-sized avatar

Alex RC rcoppy

View GitHub Profile
@rcoppy
rcoppy / unit_test_example.py
Created November 3, 2021 21:14
Python3 simple unit test example (reusable)
# A super-simple way to implement unit tests for a python program.
# example: tell me, true or false, if a number is odd.
# procedure:
# -- come up with test cases.
# -- write and rewrite code until all of your test cases pass.
# -- if you have time, refactor the end result to make it more readable.
@rcoppy
rcoppy / mergesort.java
Created December 2, 2019 05:43
A merge sort NIGHTMARE
import java.util.Arrays;
public class MergeSort {
private static void mergeSort(Integer[] inputArray) {
// CONTEXT
// This took about twelve hours of tweaking and line-by-line debugging. It's arguably spaghetti code.
// That is to say, I don't fully understand why it works!
// The first bit, splitting the list into intervals, is not so complicated.