Skip to content

Instantly share code, notes, and snippets.

View mattnewport's full-sized avatar

Matt Newport mattnewport

View GitHub Profile
@mattnewport
mattnewport / speakrune.hoon
Last active February 22, 2020 04:25
Convert runes to their spoken form
|= raw=tape
^- tape
=< ?:((valid raw) (turn raw convert) "input contains non-rune characters")
|%
++ valid
|= x=tape
^- ?
=/ chars (sy x)
(~(all in chars) |=(c=@t (~(has by table) c)))
++ convert
@mattnewport
mattnewport / planetppm.hoon
Created August 29, 2019 03:54
Procedural Planet raytracer in Hoon
|= dim=@ud ^- (list @t)
=/ dx (div:rs .1 (sun:rs dim))
=/ white [.1 .1 .1]
=< (genppm dim)
|%
++ min
|= [x=@rs y=@rs] ^- @rs
?: (lth:rs x y) x y
++ max
|= [x=@rs y=@rs] ^- @rs
@mattnewport
mattnewport / joint_allocation.cpp
Last active August 29, 2015 14:09
Mesh with joint allocation using C++11 allocators
// Usage - with library support for joint allocation, usage might look something like this:
struct Vector3 {
float x, y, z;
};
struct Mesh {
private:
JointPool pool;
@mattnewport
mattnewport / gist:1352a031be58bde028c0
Created November 10, 2014 23:08
Simple Mesh initialization
#include <vector>
using namespace std;
struct Vector3 { float x, y, z; };
struct Mesh {
vector<Vector3> positions;
vector<int> indices;
};
@mattnewport
mattnewport / about.md
Created February 7, 2012 20:45 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer