Skip to content

Instantly share code, notes, and snippets.

View eightants's full-sized avatar
🎲
Creating experiences...

Anthony Teo eightants

🎲
Creating experiences...
View GitHub Profile
@eightants
eightants / appearances.py
Created November 25, 2020 05:34
Modified gantt plot to visualize the appearances of characters in the manga 'Kanojo, Okarishimasu'
# Given a one-hot encoded csv file with character names as the columns and each row representing a chapter/episode,
# this script generates a gantt chart timeline for the appearances of each character.
# Created by Anthony Teo
# Example: mainapps.csv
# Kazuya,Ruka,Mami
# 1,0,0
# 0,1,1
# 1,1,1
# 1,0,0
@eightants
eightants / Duotone.js
Last active June 27, 2023 02:36
Spotify Duotone Filter with HTML Canvas and Javascript
// Spotify Duotone Filter with HTML Canvas and Javascript
// by Anthony Teo
/*
This function generates a duotone version of an image on an HTML Canvas element using Javascript.
It makes use of the newer canvas functions, including filter and the globalCompositeOperations, making it
less code-heavy compared to existing implementations in canvas.
The benefit of using this method compared to CSS filters is the ability to convert the canvas to an image to be saved.
Libraries like HTMLtoCanvas state in their documentation that CSS filters are not supported, so it is probably not possible
to do so in CSS. This is a purely JS and Canvas implementation.
*/
@eightants
eightants / DotPlot.js
Last active July 4, 2020 03:15
D3 Customisable Dot Plot
// Customizable Dot Plot (for D3 v3)
// by Anthony Teo
// adapted from code by Yan Holtz
/*
This function generates a responsive and customisable dot plot that can be used as
a lolipop plot, a dumbell plot, or other dot-plot-like graphs.
I needed a really lightweight dot plot function in D3 v3 that shows the domain in each plot without needing axes,
so I made this by adapting a basic Cleveland plot implementation that used D3 v4, and added configurations.
The config object is passed in for styling customisations.
*/