Skip to content

Instantly share code, notes, and snippets.

View wgrzr's full-sized avatar
🕸️

will greer wgrzr

🕸️
View GitHub Profile
@wgrzr
wgrzr / yaw-pitch-handler.js
Created February 11, 2022 09:00
Marzipano click window for yaw and pitch
// this outputs coordinates of yaw/pitch on click
document.addEventListener('click', (e) => {
let view = viewer.view()
let x = e.clientX
let y = e.clientY
console.log(view.screenToCoordinates({ x, y }))
})
@wgrzr
wgrzr / regex.txt
Last active January 31, 2022 21:27
helpful regex patterns
# find group of 10 chars (numbers and letters - lowercase)
(?:[0-9+a-z]{10})$
ex: ja4xwjaen2
@wgrzr
wgrzr / credit.md
Last active January 26, 2022 12:11
Useful React Hooks

15 Custom Hooks to Make your React Component Lightweight JavaScript in Plain English on Medium

Original Article

@wgrzr
wgrzr / git-fetch-all
Last active January 19, 2022 08:52
git - fetch & pull all
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@wgrzr
wgrzr / snippets.md
Last active December 9, 2021 03:09

Useful javascript snippets

flatten an array recursively

const flatten = (arr, depth = 1) =>
  arr.reduce((a, v) => a.concat(depth > 1 && Array.isArray(v) ? flatten(v, depth - 1) : v), []);

flatten([1, [2], 3, 4]);  [1, 2, 3, 4]
flatten([1, [2, [3, [4, 5], 6], 7], 8], 2); [1, 2, 3, [4, 5], 6, 7, 8]
‎‎​
@wgrzr
wgrzr / 0-Index.md
Last active November 29, 2021 05:42
Educative-Modules

Index

Educative Modules

[[1-SlidingWindow]] [[DSAX-Modules/educative.io/2-RotatedArray]]

// this outputs coordinates of yaw/pitch on click
document.addEventListener("click", (e) => {
var view = viewer.view();
let x = e.clientX;
let y = e.clientY;
console.log(view.screenToCoordinates({ x, y }));
});
@wgrzr
wgrzr / GLSL-Noise.md
Created August 23, 2021 08:28 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

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);
}
float threshold(float edge0, float edge1, float x) {
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
}
float hash(vec3 p) {
p = fract(p * 0.3183099 + .1);
p *= 17.0;
return fract(p.x * p.y * p.z * (p.x + p.y + p.z));
}