Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
👨‍🎨 👨‍💻

Jordan Shaw jshaw

🤖
👨‍🎨 👨‍💻
View GitHub Profile
@jshaw
jshaw / greyscale.frag
Created Jun 22, 2022 — forked from Volcanoscar/greyscale.frag
A simple glsl color -> greyscale shader, using luminosity method
View greyscale.frag
// fragment shader
//
// RGBA color to RGBA greyscale
//
// smooth transition based on u_colorFactor: 0.0 = original, 1.0 = greyscale
//
// http://www.johndcook.com/blog/2009/08/24/algorithms-convert-color-grayscale/
// "The luminosity method is a more sophisticated version of the average method.
// It also averages the values, but it forms a weighted average to account for human perception.
// We’re more sensitive to green than other colors, so green is weighted most heavily. The formula
@jshaw
jshaw / angle-between-points.js
Created Mar 11, 2022 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
View angle-between-points.js
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
View tableSizeChart.html
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
overflow:hidden;padding:10px 5px;word-break:normal;}
.tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
.tg .tg-baqh{text-align:center;vertical-align:top}
</style>
<table class="tg">
<thead>
@jshaw
jshaw / p5js_video_snippet.js
Created Dec 12, 2021
snippet for interpreting, manipulating and displaying video
View p5js_video_snippet.js
if(label == "Start"){
flippedVideo.loadPixels();
noStroke();
for (let y = 0; y < flippedVideo.height; y += 8) {
for (let x = 0; x < flippedVideo.width; x += 8) {
let offset = ((y*flippedVideo.width)+x)*4;
fill(flippedVideo.pixels[offset],
flippedVideo.pixels[offset+1],
flippedVideo.pixels[offset+2]);
rect(x, y, 8, 8);
@jshaw
jshaw / snippetfile2.json
Created Sep 14, 2020
Example marketing payload, only email
View snippetfile2.json
{
email: "email@gmail.com"
}
@jshaw
jshaw / snippetfile1.json
Last active Dec 17, 2020
Example marketing payload Optional fields: * api_key * legal array
View snippetfile1.json
{
email: "email@gmail.com"
}
@jshaw
jshaw / GLSL-Noise.md
Created May 30, 2019 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms
View GLSL-Noise.md

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
	return mix(rand(fl), rand(fl + 1.0), fc);
}
@jshaw
jshaw / about.md
Created Feb 14, 2019 — forked from mattdesl/about.md
A Browser and Node.js compatible canvas-sketch script for generative and parametric 3D geometry.
View about.md

Generative Geometry in Browser + Node.js

Here is a script that can be run with canvas-sketch to generate OBJ files from a parametric/algorithmic 3D ThreeJS geometry.

Hitting "Cmd + S" from the canvas-sketch tool will export a PNG and OBJ file of the scene.

If the same script is run from Node, it will simply render the OBJ to stdout, or write to the filename argument if given.

@jshaw
jshaw / .bash_profile
Created Feb 13, 2019 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
View .bash_profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
View aframe-autoplay-video-on-mobile.js
function playVideoOnClick (selector) {
el = document.querySelector(selector);
if (el) {
addListener();
} else {
window.addEventListener('load', addListener);
}
function addListener () {