Skip to content

Instantly share code, notes, and snippets.

View loganzartman's full-sized avatar
🏳️‍🌈
protect civil liberties

Logan loganzartman

🏳️‍🌈
protect civil liberties
View GitHub Profile
"Logan's vimrc
"Basic setup
set autoread "update automatically when file is modified externally
filetype plugin on
filetype indent on
set wildmenu
syntax on
set mouse=a
@loganzartman
loganzartman / noise.py
Created July 27, 2017 14:54
Perlin noise in python
import random
import math
class Noise:
def __init__(self, seed=None):
self.P = [x for x in range(1,256)]
self.P += self.P
random.seed(seed)
random.shuffle(self.P)
@loganzartman
loganzartman / BinaryST.java
Created January 30, 2017 03:53
A Binary Search Tree implementation that demonstrates some functional paradigms.
/**
* This file has been modified slightly for public release.
* Some documentation has been removed.
*/
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.function.Function;
@loganzartman
loganzartman / Vector.js
Last active January 24, 2017 05:55
Immutable vectors in Javascript
class Vector {
constructor(x,y) {
if (arguments.length === 2) {
this.x = x;
this.y = y;
}
else if (arguments.length === 0) {
this.x = 0;
this.y = 0;
}
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = process.argv[2] || 8001;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@loganzartman
loganzartman / Color.js
Last active January 24, 2017 05:59
A standalone library for working with color in Javascript.
/**
* Represents a color that can be expressed as an RGB value.
* RGB values are in the range 0 ~ 255 (rounded for display).
* HSL values are in the range 0 ~ 1.
* A color can be constructed using any of the following:
* - No arguments; will be interpreted as black
* - A single integer representing a packed RGB value
* - Three integers or floats representing RGB or HSL values (depending on Color.DEFAULT_MODE)
* - A hex #NNNNNN color string
* - A canvas2d/CSS rgb(n,n,n) or hsl(n,n%,n%) color string
@loganzartman
loganzartman / ramping_function.js
Last active August 29, 2015 14:15
will be used for robot
function ramp(t, min, max, fluff) {
var diff = t>fluff?1-t:t;
var deaden = 0;
if (diff < fluff)
deaden = (fluff-diff)/fluff;
return min+(max-min)*(1-deaden);
}
var min = 1, max = 10;
for (var i=0; i<=max; i++) {
@loganzartman
loganzartman / WavepotWindchimes.js
Last active August 29, 2015 14:02
rain is better now
/*!
*
* wavepot windchimes
* nondefault.net
*
*/
var transpose = 0;
var ct = 0;
@loganzartman
loganzartman / sketchpad.html
Last active August 29, 2015 13:56
Sketchpad
<html>
<head>
<script src="http://nondefault.net/c_lite.js"></script>
<script>
var mxp = Mouse.x, mxy = Mouse.y;
function init() {
}
function step() {
if (Mouse.down) {