Skip to content

Instantly share code, notes, and snippets.

View fogleman's full-sized avatar

Michael Fogleman fogleman

View GitHub Profile
@fogleman
fogleman / index.html
Created December 21, 2016 22:06
Virtual Plotter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script src="paths.js"></script>
@fogleman
fogleman / index.html
Created December 21, 2016 21:10
Plotting
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script src="https://www.michaelfogleman.com/static/tree-paths.js"></script>
@fogleman
fogleman / index.html
Created December 21, 2016 03:43
Random Walkers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script>
@fogleman
fogleman / spatialhash.go
Created December 20, 2016 19:19
Simple Spatial Hash in Go
package path
type SpatialHash struct {
CellSize float64
Cells map[SpatialHashKey][]interface{}
}
type SpatialHashKey struct {
X, Y int
}
@fogleman
fogleman / index.html
Last active December 20, 2016 02:27
p5.js on bl.ocks.org
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
padding: 0;
margin: 0;
function flat_piece(r, h, a, o) {
var shape = CAG.fromPoints([
[0, 0],
[r, 0],
[cos(a) * r, sin(a) * r],
]);
shape = linear_extrude({height: h}, shape);
return shape.rotateZ(o);
}
@fogleman
fogleman / dyson_spheres.ipynb
Created October 7, 2016 20:13
Dyson Spheres and Alien Megastructures
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def sum_factor(x, n, values):
if len(values) == n:
if x == 0:
print values
return
for i in xrange(x + 1):
values.append(i)
sum_factor(x - i, n, values)
values.pop()
@fogleman
fogleman / dominant.go
Created September 23, 2016 16:42
Dominant Image Color
package dominant
import (
"fmt"
"image"
"image/color"
"github.com/mdesenfants/gokmeans"
"github.com/nfnt/resize"
)
@fogleman
fogleman / kuler-copy.js
Created August 19, 2016 15:57
Copy all Adobe Kuler hex values to clipboard
var s = ''; for (var e of document.querySelectorAll('[data-comp=hex]')) {s += e.value + '\n';} copy(s.trim());