Skip to content

Instantly share code, notes, and snippets.

View handeyeco's full-sized avatar
🦄
🌈🍹🐠🏝

Matthew handeyeco

🦄
🌈🍹🐠🏝
View GitHub Profile
@handeyeco
handeyeco / Max7219.ino
Created May 4, 2020 16:38
First attempt at Max7219
//We always have to include the library
#include "LedControl.h"
// Arduino Pins
int dataPin = 12;
int clockPin = 11;
int loadPin = 10;
LedControl lc = LedControl(dataPin, clockPin, loadPin, 1);
@handeyeco
handeyeco / beep.ino
Created April 18, 2020 16:42
Arduino Audio Alarm
int relay = 2;
int input = 3;
int startBeep = 0;
int beepLength = 1000;
void setup() {
pinMode(relay, OUTPUT);
pinMode(input, INPUT);
Serial.begin(9600);
int digit1 = 2;
int digit2 = 3;
int digit3 = 4;
int digit4 = 5;
int clock = 10;
int latch = 11;
int data = 12;
//initialize the digital pin as an outout
void setup() {
int digit1 = 2;
int digit2 = 3;
int digit3 = 4;
int digit4 = 5;
// Serial
int clock = 10;
int latch = 11;
int data = 12;
@handeyeco
handeyeco / contain.js
Created September 15, 2019 17:38
Contain one aspect ratio within another aspect ratio
/* Simulate object-fit: contain.
* Takes an object's dimension (innerWidth/innerHeight)
* and a container's dimensions (outerWidth/outerHeight)
* and returns a new width/height where the inner object
* will use as much of the container's space as possible
* while respecting the inner object's aspect ratio
*/
function contain(
innerWidth,
@handeyeco
handeyeco / scraping-tumblr.md
Last active September 14, 2019 05:49
Artist Stalker: Scraping Tumblr

Artist Stalker: Scraping Tumblr

Introduction

I think we can all agree that Tumblr is lame now, joining the ranks of Facebook and Instagram - organizations who regularly censor content on a platform that was designed with freedom of expression and information in mind. As an art lover, I've been worried that the rise of corporate censorship would affect my favorite artists, so I decided to start working on backing up content locally. Here's what I had to do:

JavaScript URL Collection

First I logged into Tumblr, opened Chrome Dev Tools, went to the Network tab, and dug around until I found the endpoint they use for their infinite scrolling. At the time of this writing it started with indash_blog. By right clicking I was able to Copy as Fetch.

@handeyeco
handeyeco / randomVectorBetweenSpheres.js
Created August 29, 2017 19:21
Placing a random vector on a sphere or between two spheres that share a (0,0,0) center (JavaScript and THREE.js)
/*
randomVectorBetweenSpheres(radius: Number, depth: Number) -> THREE.Vector3
@param radius <Number>: Radius of inner sphere (distance between center of sphere and closest possible random vector)
@param depth <Number>: Distance between inner sphere and outer sphere (radius+depth = furthest possible random vector)
*/
function randomVectorBetweenSpheres(radius, depth) {
// Create random radius between radius and radius+depth
const randomRadius = Math.floor(Math.random() * (radius + depth - radius + 1) + radius);
// Return random vector on sphere with random radius
return this.randomSphereSurfaceVector(randomRadius);
@handeyeco
handeyeco / hexagons.js
Created July 18, 2017 16:25 — forked from zackthehuman/hexagons.js
Drawing a hexagonal grid with HTML canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas Hexagonal Map</title>
<style type="text/css">
canvas {
border:0;
display:block;
margin:0 auto;
@handeyeco
handeyeco / ffmpeg_dynamic_color.md
Last active February 10, 2023 11:23
Dynamically changing font color with FFmpeg drawtext filter and fontcolor_expr

Drawtext with fontcolor_expr

drawtext=enable='between(t,18.93,20.28)':fontfile=fonts/cousine-bold.ttf:fontsize=144:fontcolor_expr=%{eif\\: if(between(t\, 18.93\, 19.02)\, 0xFFFFFF\, 0xFFB6C1) \\: x}:x=82:y=288:text='PROGRAMMING'

Elements

enable='between(t,18.93,20.28)'

Displays the text between 18.93 and 20.28 seconds.

@handeyeco
handeyeco / slim-redux.js
Created December 7, 2016 16:53 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {