{{ message }}

Instantly share code, notes, and snippets.

KirkWanooknox

Created Feb 28, 2019
This is a quick Fizz Buzz exercise I did to teach a high school student the concepts behind TDD. Method naming and code structure could be better, but I just needed to illustrate a point. I felt the exercise went well and I thought it might be worth while to keep the code.
View FizzBuzzTest.java
 package com.wanooknox.fizzbuzz; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.assertEquals; public class FizzBuzzTest { private FizzBuzzEngine fizzBuzzEngine;
Created Oct 24, 2017
Created Mar 12, 2013
Recursive matrix determinants by cofactor expansion. Contains Minor, Cofactor, CofactorMatrix, Transpose, Adjoint, and Inverse methods. The corresponding IMatrix, AMatrix, and full Matrix class structure is not mine to post. Structure assumes matrix indexing is 1 based, not 0 based.
View Matrix.cs
 public double Minor(int row, int col) { //can only calculate a Minor value if the matrix is square if (this.Rows != this.Cols) { throw new ApplicationException("Number of rows does not match number of columns"); } //the sub matrix Matrix subMatrix = (Matrix)this.NewMatrix(this.Rows - 1, this.Cols - 1);
Created Apr 23, 2015
A FizzBuzz paradise. More variants to come.
View fizzbuzz.js
 for (i = 0; i < 100; i++) { var test = ""; if (i % 3 == 0) //multiple of 3 { test += "fizz"; } if (i % 5 == 0) //multiple of 5 { test += "buzz"; } if (test == "") //no multiple { test = i; } document.write(test + "
"); //print
Last active Aug 29, 2015
Pawned!