Skip to content

Instantly share code, notes, and snippets.

@snarkbait
snarkbait / FileIO.java
Created December 6, 2015 21:31
FileIO.java Simplified static file functions, made specifically for the AdventOfCode challenges.
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
import java.util.regex.PatternSyntaxException;
@snarkbait
snarkbait / Advent7.java
Created December 8, 2015 03:18
Advent of Code Day 7
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.IntBinaryOperator;
/**
* @author /u/Philboyd_Studge on 12/6/2015.
*/
public class Advent7 {
@snarkbait
snarkbait / Advent14.java
Last active December 14, 2015 07:21
Advent Day 14 AdventOfCode
import java.util.ArrayList;
import java.util.List;
/**
* @author /u/Philboyd_Studge on 12/13/2015.
*/
public class Advent14 {
List<Reindeer> deer = new ArrayList<>();
@snarkbait
snarkbait / Coordinate.java
Last active December 28, 2015 05:08
Maze DFS/BFS example file for Coursera : UCSD Advanced Data Structures - Week 2
package util;
public class Coordinate {
private int row;
private int col;
public Coordinate(int row, int col) {
this.row = row;
this.col = col;
}
package enumexample;
import javax.swing.*;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
/**
* @author /u/Philboyd_Studge on 1/10/2016.
*/
@snarkbait
snarkbait / DoublyChainedTrie.java
Last active April 25, 2017 13:13
String-Based Trie Example with Word Suggestion GUI
package trie;
import java.util.ArrayList;
import java.util.List;
/**
* Doubly Chained String/Character based-Trie
* @author /u/Philboyd_Studge on 1/13/2016.
*/
public class DoublyChainedTrie implements STrie {
@snarkbait
snarkbait / DynamicArray.java
Created March 7, 2016 21:56
Dynamic Array example
import java.util.Arrays;
import java.util.Iterator;
import java.util.RandomAccess;
/**
* Dynamic Array class (based on java.util.ArrayList)
* for /r/JavaExamples - for tutorial purposes -
* @author /u/Philboyd_Studge on 11/18/2015.
*/
@snarkbait
snarkbait / Cards.java
Last active July 17, 2017 14:24
Poker Hand Scoring example for /r/javaexamples
package enumexample;
import java.util.*;
/**
* Cards class for playing cards. Uses simple integer-based system
* where the card face value is n mod 13 and the suit is n mod 4
* @author /u/Philboyd_Studge on 3/26/2016.
*/
public class Cards {
@snarkbait
snarkbait / FVController.java
Created March 27, 2017 21:46
JavaFX Example - Future Value
package fvcalc;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import logic.FVLogic;
import logic.FVLogic.CompoundType;
@snarkbait
snarkbait / CSVField.java
Created April 3, 2017 19:06
Annotations and Reflection: CSV-to-Object Reader
package csv;
import java.lang.annotation.*;
/**
* @author /u/Philboyd_Studge on 4/1/2017.
*/
@Inherited
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)