Skip to content

Instantly share code, notes, and snippets.

View adyontech's full-sized avatar
😎
Working on private projects.

Aditya sharma adyontech

😎
Working on private projects.
View GitHub Profile
@adyontech
adyontech / gist:1f853bd4092ad956d2f75c6ffa00e9f8
Last active October 20, 2020 18:14
Front-end interview experience

Front-end interview experience

This is a post about my personal interview preparation & experience with more than a dozen companies.

DISCLAIMER: I never prepared for JS specific interview, my goal was to land a backend role, but KARMA SUCKS :P

Go to resources

TODO: ADD MORE INFO HERE.

@adyontech
adyontech / ClassicalInheritanceWithFunction.md
Created February 20, 2020 17:26
Classical inheritance with function
function Shape(){
      this.x = 0;
      this.y = 0;
  }


Shape.prototype.move = function (x, y){
  this.x += x;
 this.y += y;
@adyontech
adyontech / react-copy-clipboard.md
Created February 12, 2020 16:40
react-copy-clipboard ~ 1 kb
import { useState, useRef, useEffect } from 'react'
import copyToClipboard from 'copy-to-clipboard'

const useClipboard = () => {
  const [hasCopied, setHasCopied] = useState(false)
  const timeoutRef = useRef<NodeJS.Timeout | null>(null)

 useEffect(() =&gt; {
@adyontech
adyontech / gist:807aa749d070f6bb847f4887a72ecf00
Last active January 15, 2020 05:16
Input throttling with react

Correct implementation:-

import React from "react";

const throttle = (callback, limit) => {
  var wait = false;

  return function(...arg) {
    if (!wait) {
@adyontech
adyontech / react-dynamic-import.md
Last active June 28, 2021 17:57
A simple trick to dynamically import components in react.

AsyncLoadFile.jsx

import React, { Component } from 'react';

export default function asyncComponent(importComponent) {
    class AsyncComponent extends Component {
        /**
        * @constructor
        * @desc Represents AsyncComponent component
        * @param props Properties passed from parent component
(function () {
  'use strict';
  //Check if share API is supported or not
  if (navigator.share !== undefined) {
    document.addEventListener('DOMContentLoaded', function() {
      var shareBtn = document.querySelector('.share');
      //Share button event listener
      shareBtn.addEventListener('click', function(event) {
 //Web share API
(function () {
  'use strict';

  var headerElement = document.querySelector('header');
  var metaTagTheme = document.querySelector('meta[name=theme-color]');

  //After DOM Loaded
  document.addEventListener('DOMContentLoaded', function(event) {
 //On initial load to check connectivity
Enzyme :- creates virtual DOM for testing.
has better toolkit, like jquery selectors.
- (shallow rendering) render component only one level deep, i.e it will render parent but will keep placeholder for children.
- Manipulate values of state and props.
Type of test:-
unit - integration - acceptance-end-to-end
Test behaviour not implementation.
@adyontech
adyontech / prettier_config.md
Last active October 4, 2019 11:58
Prettier config

.prettierignore

dist
node_modules
coverage
.next
build
@adyontech
adyontech / beeocean.md
Last active August 20, 2018 04:12
Why do I call BeeOcean my all web dev coding knowledge source and outcome?

Why do I call BeeOcean my all web dev coding knowledge source and outcome?

Hello 😊 , thanks for finding time to navigate here. In the following Gist I will be bragging 😉 about my skills and all the cool concept I have applied to this project (BeeOcean.com, formerly proworktree.com).

If you are a non-dev person, I request you is to read through and grow your knowledge about web apps 💥, let's go a bit deeper by knowing how complex and cool it is to work on a website. 😍

I am sure after going through you won't say that a website creation is just putting some HTML-CSS together 😛...

Credits :- As a single developer in the project it would have been really difficult if this guy 👉 Rud156 had not picked up my calls for queries ( Many times ) .

Ok, Let's start now.

Business logic

This is a SaaS product, therefore there is a need to incorporate the f