Skip to content

Instantly share code, notes, and snippets.

View howyay's full-sized avatar
🏠
Working from home

howyay

🏠
Working from home
  • Hunan, China & NY, US
View GitHub Profile
/* Center of Gravity Finder
This script will find the center of gravity (centroid) of all closed paths in the selection set. It was built for a specific purpose so does not have much error
handling. For example, if you get errors it may be the result of the selection set containing compound shapes or a self-intersecting polygon.
References for the math:
http://paulbourke.net/geometry/polygonmesh/ (Calculating the area and centroid of a polygon)
https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon
Save this file with a jsx extension and place in your Illustrator/Presets/en_US/Scripts folder. You can then access it from the File > Scripts menu
@howyay
howyay / worker.js
Last active April 6, 2020 15:16 — forked from tobiaslins/worker.js
Notion.so Custom Domain + Inline LaTeX Rendering
const MY_DOMAIN = "YOUR_DOMAIN"
const START_PAGE = "URL_TO_NOTION_LANDING_PAGE"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, HEAD, POST,PUT, OPTIONS",