Skip to content

Instantly share code, notes, and snippets.

View technikhil314's full-sized avatar

Nikhil Mehta technikhil314

View GitHub Profile
@technikhil314
technikhil314 / index..js
Created February 17, 2022 14:29
Simple throttle implementation
function throttle(fun, timeduration) {
let shouldCall = true;
return () => {
if (shouldCall) {
shouldCall = false;
fun();
setTimeout(() => {
shouldCall = true;
}, timeduration)
}
@technikhil314
technikhil314 / base64.js
Created November 18, 2021 08:39 — forked from jhurliman/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;
@technikhil314
technikhil314 / index.html
Last active October 28, 2021 14:34
event capture, target, bubble with propagation explained
<!DOCTYPE html>
<html id="html">
<head>
<title>Page Title</title>
</head>
<body id="body">
<div id="one">
@technikhil314
technikhil314 / publicEmailProviders.txt
Last active August 15, 2023 21:21
List of all public email provider domains
123mail.org
150mail.com
150ml.com
16mail.com
2-mail.com
4email.net
50mail.com
aim.com
airpost.net
alice.it
@technikhil314
technikhil314 / index.js
Created August 6, 2021 13:02
Return only positive angle degrees
function positiveDeg(input) {
const actualInput = input % 360;
return actualInput >= 0 ? actualInput : 360 + actualInput;
}
@technikhil314
technikhil314 / README.md
Created August 1, 2021 07:09
System design interview pointers

These are some pointers from candidate perspecitve

  1. Anticipated user base? and DAU (Daily active users)
  2. What should be the read vs write frequency if read is more then CDN might be needed
  3. Identify components that are critial those should be fault tolerant
  4. Identify functional and non funtional requirements
  5. Anticipate possible security issues and how will to mitigate them
  6. Does it need realtime sync or cross device syncronization?
  7. What browser support is needed?
  8. Does it have to responsive?
@technikhil314
technikhil314 / .zshrc
Last active June 27, 2021 17:01
My git aliases
alias gitHouseKeeping="git gc && git gc --prune && git remote prune origin && git prune && git clean -df"
git-amend-old() (
# Stash, apply to past commit, and rebase the current branch on to of the result.
current_branch="$(git rev-parse --abbrev-ref HEAD)"
apply_to="$1"
git stash
git checkout "$apply_to"
git stash apply
git add -u
git commit --amend --no-edit
@technikhil314
technikhil314 / readme.md
Last active June 19, 2021 12:13
Single line web url to simple paint app

Copy paste following line in your favorite browsers url bar and hit enter.

data:text/html,<canvas id=v><script>d=document,P='onpointer',c=v.getContext('2d'),v.width=innerWidth,v.height=innerHeight,f=0,d[P+'down']=e=>{f=e.pointerId+1;e.preventDefault();c.beginPath();c.moveTo(e.x,e.y)};d[P+'move']=e=>{f==e.pointerId+1&&c.lineTo(e.x,e.y);c.stroke()},c.lineWidth=3,d[P+'up']=_=>f=0</script></canvas>

This is a public gist of following secret gist

Original gist by minko gechev

@technikhil314
technikhil314 / README.md
Last active August 20, 2021 13:34
Browser based audio output recorder

HOW TO USE

  1. copy and paste the code to browser console
  2. run record(); to record audio output
  3. run stop(); to stop recording
  4. run download() to download last recording
@technikhil314
technikhil314 / Link.jsx
Created June 8, 2021 12:56
Gatsby disable prefetch link component