Skip to content

Instantly share code, notes, and snippets.

Avatar

Jared Updike jupdike

View GitHub Profile
View ff-convert.sh
#!/bin/bash
# ONLY CONVERTS TO .SVG FONTS
# REAME: call from ffconvert.sh with (cd /path/with/font/files && ffconvert.sh *.ttf)
# or *.otf
# if a problem occurs, just rename fonts without spaces!
echo "" | /Applications/FontForge.app/Contents/MacOS/FontForge -script /path/to/font-to-svg.txt $@ &>/dev/null
View font-to-svg.txt
#!/Applications/FontForge.app/Contents/MacOS/FontForge
# ONLY CONVERTS TO .SVG FONTS
# REAME: call from ffconvert.sh with (cd /path/with/font/files && ffconvert.sh *.ttf)
# or *.otf
# if a problem occurs, just rename fonts without spaces!
#Open($1)
#Generate($1:r + ".svg")
@jupdike
jupdike / IntersectTwoCircles.js
Last active Sep 3, 2020
Find the intersections (two points) of two circles, if they intersect at all
View IntersectTwoCircles.js
// based on the math here:
// http://math.stackexchange.com/a/1367732
// x1,y1 is the center of the first circle, with radius r1
// x2,y2 is the center of the second ricle, with radius r2
function intersectTwoCircles(x1,y1,r1, x2,y2,r2) {
var centerdx = x1 - x2;
var centerdy = y1 - y2;
var R = Math.sqrt(centerdx * centerdx + centerdy * centerdy);
if (!(Math.abs(r1 - r2) <= R && R <= r1 + r2)) { // no intersection
You can’t perform that action at this time.