Skip to content

Instantly share code, notes, and snippets.

View pfreema1's full-sized avatar

Paul Freeman pfreema1

View GitHub Profile
@pfreema1
pfreema1 / amzn-reviews
Last active July 19, 2023 07:38
Get all amazon reviews on current page
/*
To use:
-open amazon product page
-click "see all reviews" and scroll to bottom of page to load all reviews
-copy and paste this code into console
-repeat on pages 2,3,4 etc
*/
let allReviews = "";
const CARD_CLASS = ".Yl-.MIw.Hb7";
const CARD_TITLE = ".tBJ.dyH.iFc.j1A.O2T.zDA.IZT.H2s.CKL"
document.querySelectorAll(CARD_CLASS).forEach(el => {
console.log(el);
const titleEls = el.querySelectorAll(CARD_TITLE);
if (titleEls.length !== 2) {
el.style.display = 'none';
}
@pfreema1
pfreema1 / gist:4e26b3c4579d41818ab99a0f2f748512
Last active August 8, 2023 03:59
Filter only million view videos (tiktok)
/*
To use:
-Go to a tiktok account page
-Keep scrolling to the bottom to load up as many videos as possible
-open the browser console (right click on page -> click inspect -> click the console tab)
-copy the code below and paste into the console
-press enter
-give it a few seconds if a lot of videos are loaded
-you should see only videos with 1M+ views
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
float osc(float low, float high, float speed) {
return map(sin(iTime * speed), -1.0, 1.0, low, high);
}
/*
taken from: https://gist.github.com/ayamflow/96a1f554c3f88eef2f9d0024fc42940f
// Basically solving an AAS triangle https://www.mathsisfun.com/algebra/trig-solving-aas-triangles.html
https://i.stack.imgur.com/PgSn3.jpg
*/
// return height and width of plane that covers viewport at the given plane z position
export default (camera, planeZ, viewWidth, viewHeight) => {
const cameraZ = camera.position.z;
function addFunc(num) {
return [].concat(this).map(item => item + num);
}
// add method 'addToArr' to Array prototype
Object.defineProperty(Array.prototype, 'addToArr', {
value: addFunc
});
<svg
id="Layer_1"
data-name="Layer 1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 96.92 27.47"
:class="$style.svg"
>
<!-- MASK -->
<defs>
<clipPath id="myClip">
// from www.thebookofshaders.com
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
THREE.WebGLShader: gl.getShaderInfoLog() vertex
ERROR: 0:49: 'fff' : syntax error
1: precision highp float;
2: precision highp int;
3: #define HIGH_PRECISION
4: #define SHADER_NAME ShaderMaterial
5: #define VERTEX_TEXTURES
6: #define GAMMA_FACTOR 2
7: #define MAX_BONES 0
8: #define BONE_TEXTURE
THREE.WebGLShader: gl.getShaderInfoLog() fragment
ERROR: 0:343: 'fff' : syntax error
1: precision highp float;
2: precision highp int;
3: #define HIGH_PRECISION
4: #define SHADER_NAME MeshBasicMaterial
5: #define GAMMA_FACTOR 2
6: uniform mat4 viewMatrix;
7: uniform vec3 cameraPosition;
8: #define TONE_MAPPING