Skip to content

Instantly share code, notes, and snippets.

View hoqqanen's full-sized avatar

George Hoqqanen hoqqanen

View GitHub Profile
# SETUP BEFORE RUNNING:
# - download and install python 3, https://www.python.org/downloads/
# - In a terminal:
# - pip install pytest-playwright
# - playwright install
# To run: in a terminal type python3, a space, then drag and drop this file.
# Press return and the program will start!
function mouseDown(c, f) {
c.addEventListener("mousedown", e => {
f({x: e.pageX, y: e.pageY});
});
c.addEventListener("touchstart", e => {
f({x: e.touches[0].pageX, y: e.touches[0].pageY});
});
}
function mouseMove(c, f) {
c.addEventListener("mousemove", e => {
@hoqqanen
hoqqanen / colorHelpers.js
Last active February 20, 2018 04:07
javascript color utilities
/*
CONTENTS:
- color converters
- randomness helpers
- Color class
- palette generators
*/
// Courtesy of https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately
function HSVtoRGBA(h, s, v) {
// Binds events from the first midi device
function bindMidiHandler(myMIDIMessagehandler){
var m = null; // m = MIDIAccess object for you to make calls on
function onsuccesscallback( access ) {
m = access;
// Things you can do with the MIDIAccess object:
var inputs = m.inputs; // inputs = MIDIInputMaps, you can retrieve the inputs with iterators
var outputs = m.outputs; // outputs = MIDIOutputMaps, you can retrieve the outputs with iterators
@hoqqanen
hoqqanen / Dom node deletion bookmarklet
Last active August 29, 2015 14:12
A snippet of javascript meant to be injected into webpages which allows you to zap elements out of existence.
javascript:(function(){
var on_top_style = "background-color:rgba(0,0,0,.01);position:fixed;top:0px;left:0px;bottom:0px;right:0px;z-index:1290479853759;";
var on_bottom_style = "background-color:rgba(0,0,0,.01);position:fixed;top:0px;left:0px;bottom:0px;right:0px;z-index:-10;";
if (document.getElementById("deleteDomNodeTopOverlay")) {
var overlay = document.getElementById("deleteDomNodeTopOverlay");
overlay.setAttribute("toggle",overlay.getAttribute("toggle")+1);
if (overlay.getAttribute("toggle").length%2==0) {
overlay.setAttribute('style', on_bottom_style);
}
return 0;