Skip to content

Instantly share code, notes, and snippets.

View ClickerMonkey's full-sized avatar
💭
VPLs, ORMs, and Bag End

Philip Diffenderfer ClickerMonkey

💭
VPLs, ORMs, and Bag End
View GitHub Profile
@ClickerMonkey
ClickerMonkey / animation.cpp
Created January 7, 2022 00:25
C++ Animation system
//
// Created by Philip Diffenderfer on 10/24/21.
//
#include <string>
#include <map>
#include <vector>
#include <cmath>
#include <functional>
@ClickerMonkey
ClickerMonkey / state-machine.cpp
Created January 7, 2022 00:17
C++ State Machine Prototype with Animation example
//
// Created by Philip Diffenderfer on 10/24/21.
//
#include <map>
#include <cmath>
#include <functional>
#include <iostream>
template <typename V>
@ClickerMonkey
ClickerMonkey / types.ts
Last active February 6, 2024 07:21
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@ClickerMonkey
ClickerMonkey / Playground.vue
Last active January 11, 2019 07:07
Playground: v-calendar-daily
<template>
<v-app class="panes">
<div class="left">
<v-select
label="Type"
v-model="type"
:items="typeOptions"
></v-select>
@ClickerMonkey
ClickerMonkey / Markov.java
Created October 29, 2014 15:19
Markov chain data structure.
import java.util.Collection;
import java.util.List;
import java.util.Random;
public class Markov<T>
{
protected final MarkovChain<T> root;
protected final MarkovChain<T> starters;
@ClickerMonkey
ClickerMonkey / Matching.java
Created October 29, 2014 15:10
A shape & color matching game for kids.
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.event.KeyEvent;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.Rectangle2D;
@ClickerMonkey
ClickerMonkey / CollisionResolution.java
Created October 29, 2014 15:09
Collision resolution visualization
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.util.Arrays;
import java.util.List;
@ClickerMonkey
ClickerMonkey / CircleCircle.java
Created October 29, 2014 15:07
Priori intersection algorithms for circles, rectangles, and planes.
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.MouseEvent;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
@ClickerMonkey
ClickerMonkey / Wikipedia.java
Last active August 29, 2015 14:08
Gathers information about all articles on Wikipedia and builds a graph of all related articles.
public class Wikipedia
{
public static class Article implements Serializable {
private static final long serialVersionUID = 1L;
public int id;
public String title;
public Set<String> related = new HashSet<String>();
}
@ClickerMonkey
ClickerMonkey / StringTemplate.java
Last active August 29, 2015 14:08
A simple string templating utility.
public class StringTemplate
{
public static final String DEFAULT_START = "{";
public static final String DEFAULT_END = "}";
private String[] chunks;
public StringTemplate( String text )
{