Skip to content

Instantly share code, notes, and snippets.

View codergautam's full-sized avatar

Coder Gautam codergautam

View GitHub Profile
//Y value is quadratic checker
//Checks if given y values are quadratic
//Y values
var numbers = []
var arr2 = []
var arr3 = []
numbers.forEach((number, i) => {
@codergautam
codergautam / guessthiscodehack.js
Last active May 3, 2021 15:37
Hack for guessthiscode.com
//run this in the console of guessthiscode.com
setInterval(() => {
var btnlist = document.getElementsByTagName("button");
var thebtn;
for(var i = 0; i < btnlist.length; i++){
if(btnlist[i].innerHTML == rightLanguage){
thebtn = btnlist[i];
break;
}
@codergautam
codergautam / typeracerhack.js
Last active May 5, 2021 12:41
very buggy made in 5 min typeracer.com hack
//copy below code and paste in developer console
//known bugs
//you need to keep focus and unfocusing the text box for the words to register and move forwars
//it will glitch and slow down on commas, but it will move on eventually
//at the end, it will start doing character by character
//how to change speed:
//go to the last line where you see }, 500)
//make the lower for higher speed, make it higher for lower speed
function getWord() {
@codergautam
codergautam / alphabetarray.js
Created May 14, 2021 11:20
One liner for a array of alphabets in javascript
Array.from(Array(26)).map((e, i) => i + 65).map((x) => String.fromCharCode(x));
@codergautam
codergautam / .gitignore
Created October 8, 2021 21:47
Node.js Gitignore. A simple gitignore template I use for my node projects!
# Node.js Gitignore
# Coder Gautam YT
<<<<<<< HEAD
node_modules/
.env
# Compiled source #
###################
*.com
*.class
@codergautam
codergautam / viewportDimensions.js
Created October 8, 2021 21:55
Get the width and height of the viewport
function viewport()
{
var e = window
, a = 'inner';
if ( !( 'innerWidth' in window ) )
{
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }
@codergautam
codergautam / getRandomInteger.js
Last active October 24, 2021 15:38
A simple function to get a random integer from a range in JavaScript.
const getRandomInt = (min, max) => min + Math.floor(Math.random() * (max - min + 1));
@codergautam
codergautam / betterAngleLerp.js
Last active October 19, 2022 02:37 — forked from shaunlebron/angleLerp.js
The best way to interpolate 2D angles
//note: degrees only
const lerp = (start,end,amt) => start+(end-start)*amt
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
const repeat = (t, m) => clamp(t - Math.floor(t / m) * m, 0, m);
function lerpTheta(a, b, t) {
const dt = repeat(b - a, 360);
return lerp(a, a + (dt > 180 ? dt - 360 : dt), t);
}
@codergautam
codergautam / conversion.js
Created October 24, 2021 15:36
Easily convert between to types of numbers!
/*
num = val
newNum = ?
convert(2, 10, 4) //20
convert(5, 10, 50) //100
*/
const convert = (num, val, newNum) => (newNum * val) / num
@codergautam
codergautam / clamp.js
Created October 24, 2021 16:40
A simple js clamp function
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);