Skip to content

Instantly share code, notes, and snippets.

View codergautam's full-sized avatar

Coder Gautam codergautam

View GitHub Profile
@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 / .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 / 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 / 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() {
//Y value is quadratic checker
//Checks if given y values are quadratic
//Y values
var numbers = []
var arr2 = []
var arr3 = []
numbers.forEach((number, i) => {
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active July 22, 2024 05:09
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

// Linear interpolation
const lerp = function(start, end, t){
return start * (1 - t) + end * t;
}
@wanglf
wanglf / vscode-extension-offline.md
Last active July 16, 2024 07:34
Download VS Code extensions as VSIX

How to use?

  • Copy content of vsix-bookmarklet, create a bookmark in your browser.
  • Navigate to the web page of the VS Code extension you want to install.
  • Click the bookmark you just created, then click the download button.
    download
  • After download finished, rename the file extension to *.vsix.
  • In VS Code, select Install from VSIX... in the extension context menu.
    vsc
@ericelliott
ericelliott / .gitignore
Created November 15, 2016 19:51
Sample Node project .gitignore
node_modules
build
npm-debug.log
.env
.DS_Store
@nvictus
nvictus / loadnpy.js
Last active July 4, 2024 09:10
NumPy binary file parser for javascript
// Client-side parser for .npy files
// See the specification: http://docs.scipy.org/doc/numpy-dev/neps/npy-format.html
var NumpyLoader = (function () {
function asciiDecode(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
function readUint16LE(buffer) {
var view = new DataView(buffer);
var val = view.getUint8(0);