Skip to content

Instantly share code, notes, and snippets.

View eeropic's full-sized avatar

Eero Pitkänen eeropic

View GitHub Profile
@eeropic
eeropic / fix-objc.sh
Last active January 6, 2024 04:05
Glyphs2 osx 13.6.3 python fix
pip2 install pyobjc
@eeropic
eeropic / y_for_x_unitbezier_paperjs.js
Created September 28, 2022 10:28
solve y for x with unit beziers in range of x [0,1] for animation etc purposes
// http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h
class UnitBezier {
constructor(p1x,p1y,p2x,p2y){
// Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).
this.cx = 3.0 * p1x;
this.bx = 3.0 * (p2x - p1x) - this.cx;
this.ax = 1.0 - this.cx - this.bx;
this.cy = 3.0 * p1y;
this.by = 3.0 * (p2y - p1y) - this.cy;
this.ay = 1.0 - this.cy - this.by;
@eeropic
eeropic / gettype.js
Created September 13, 2022 13:09
get object prop type
const getType = x => Array.isArray(x) ? 'array' : typeof x;
@eeropic
eeropic / color_proportions.js
Created November 12, 2021 14:20
paperjs color palette color proportions tool
const calcWeights = cutoffs => {
let weights = [cutoffs[0]]
for(let i = 1; i < cutoffs.length; i++){
let weight = cutoffs[i] - cutoffs[i-1]
weights.push(weight)
}
weights.push(1 - cutoffs.at(-1))
return weights
}
@eeropic
eeropic / index.html
Created November 10, 2021 20:51
touchosc custom properties
<!-- https://forum.freecodecamp.org/t/nesting-custom-web-components/326322/4 -->
<template id="toscPropertyTemplate"><slot></slot><slot></slot></template>
<template id="toscKeyTemplate"></template>
<template id="toscValueTemplate"></template>
<div id="editor">
</div>
<div id="toolbar">
<div id="file-controls">
<div id="drop-zone">
<span id="drop-zone-text">Drop a .TOSC file here</span>
@eeropic
eeropic / lua_tips_touchosc.md
Last active September 13, 2021 12:04
Lua tips for TouchOSC scripting (Lua 5.1)
  • You can omit parenthesis in function calls, if your argument is a string or a table
myFunc"hello"
myFunc{1,2,3}
  • Variable number of function arguments
@eeropic
eeropic / scriptui-svg-alpha.jsx
Created September 2, 2021 09:04
scriptui-svg alpha
// @target aftereffects
// altKeyPressed(win), optKeyPressed(mac) ctrlKeyPressed, cmdKeyPressed(mac), shiftKeyPressed, capsLockKeyPressed, numLockKeyPressed
// leftButtonPressed, middleButtonPressed, rightButtonPressed, mouseOver, hasFocus,
//encapsulate the script in a function to avoid global variables
(function (thisObj) {
default xml namespace = "http://www.w3.org/2000/svg";
var xmlString = """
<!-- Generator: Adobe Illustrator 23.1.1, SVG Export Plug-In -->
@eeropic
eeropic / keys.txt
Created August 18, 2021 16:25
zigsim arkit face tracker osc keys
faceposition
facerotation
facelefteyeposition
facerighteyeposition
facelookatposition
faceeyeblinkleft
faceeyeblinkright
faceeyelookdownleft
faceeyelookdownright
faceeyelookinleft
@eeropic
eeropic / gzip.js
Last active June 10, 2021 14:41
gzip-js
// https://github.com/beatgammit/gzip-js/blob/master/lib/gzip.js
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
const gzip = require('gzip-js');
},{"gzip-js":6}],2:[function(require,module,exports){
(function () {
'use strict';
var table = [],
poly = 0xEDB88320; // reverse polynomial
This file has been truncated, but you can view the full file.
testData = [[-0.002345,0.049722,-0.006237,180,120,95],
[-0.002345,0.049744,-0.006316,180,120,95],
[-0.002397,0.049722,-0.006316,180,120,95],
[-0.002488,0.049722,-0.007304,183,122,97],
[-0.002345,0.049773,-0.007304,183,122,97],
[-0.002345,0.049722,-0.007538,183,122,97],
[-0.001620,0.049722,-0.005327,189,127,101],
[-0.001356,0.049722,-0.004959,189,127,101],
[-0.001356,0.049826,-0.005327,189,127,101],
[-0.001356,0.050038,-0.006316,192,129,103],