Skip to content

Instantly share code, notes, and snippets.

@mayakraft
mayakraft / opxToSVG.js
Created December 20, 2022 08:17
OPX to SVG conversion. OPX is an origami file format outputted by ORIPA by Jun Mitani
const svgNS = "http://www.w3.org/2000/svg";
/**
* @description Not currently used.
* There are top level nodes which contain metadata,
* I'm not sure how many there are, but at least I've seen:
* memo, originalAuthorName, title
*/
const getMetadataValue = (oripa, metadataKey) => {
const parentNode = Array.from(oripa.children)
.filter(el => el.attributes.length && Array.from(el.attributes)
@mayakraft
mayakraft / algebra.ts
Last active February 15, 2021 16:51
(a,b,c) ring algebra
class Ring {
a: number;
b: number;
c: number;
constructor(a: number, b: number, c:number) {
this.a = a;
this.b = b;
this.c = c;
}
};
@mayakraft
mayakraft / index.html
Created April 17, 2020 01:02
file from today
<!-- 2 terminal windows
one running ngrok
one running localhost server
php -S localhost:8000 -->
<!DOCTYPE html>
<head>
<title>three js</title>
<style>
var degtorad = Math.PI / 180;
function makeRotationMatrix(alpha, beta, gamma) {
var _x = beta ? beta * degtorad : 0;
var _y = gamma ? gamma * degtorad : 0;
var _z = alpha ? alpha * degtorad : 0;
var cX = Math.cos( _x );
var cY = Math.cos( _y );
@mayakraft
mayakraft / index.html
Created April 17, 2020 00:34
threejs-first
<!DOCTYPE html>
<head>
<title>three js</title>
<style>
/*css goes here*/
html, body {
margin: 0;
overflow: hidden; /*nice to not use this*/
}
</style>
@mayakraft
mayakraft / index.html
Last active April 6, 2020 22:01
instanceof custom object
<!DOCTYPE html>
<title>.</title>
<script>
// must instantiate with "new"
var Point = function (x, y) {
this.x = x;
this.y = y;
};
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<input type="file">
</body>
<script>
@mayakraft
mayakraft / counter.pd
Created April 3, 2020 00:55
pd count
#N canvas 100 128 450 324 12;
#X obj 230 291 dac~;
#X obj 230 267 osc~;
#X obj 41 13 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1
;
#X obj 39 65 i;
#X obj 76 66 + 1;
#X obj 324 158 expr $f1 * 3 / 2;
#X obj 151 239 f;
#X obj 203 219 f;
@mayakraft
mayakraft / counter.pd
Created April 3, 2020 00:55
pd count
#N canvas 100 128 450 324 12;
#X obj 230 291 dac~;
#X obj 230 267 osc~;
#X obj 41 13 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1
;
#X obj 39 65 i;
#X obj 76 66 + 1;
#X obj 324 158 expr $f1 * 3 / 2;
#X obj 151 239 f;
#X obj 203 219 f;
@mayakraft
mayakraft / template.html
Created March 13, 2020 01:01
threejs template
<!DOCTYPE html>
<head>
<title>three js</title>
<style>
/*css goes here*/
html, body {
margin: 0;
overflow: hidden; /*nice to not use this*/
}
</style>