Skip to content

Instantly share code, notes, and snippets.

View pgupta56's full-sized avatar
πŸ€“

Priyanka Gupta pgupta56

πŸ€“
View GitHub Profile
const express = require('express');
const cors = require('cors');
const { google } = require('googleapis');
const { auth } = require('google-auth-library');
const fs = require('fs');
const dotenv = require('dotenv');
'use strict';
function BinarySearchTree() {
this.root = null;
}
BinarySearchTree.prototype.insertNode = function (val) {
var node = {
data : val,
@pgupta56
pgupta56 / enzyme_render_diffs.md
Created June 7, 2020 07:47 β€” forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@pgupta56
pgupta56 / .babelrc
Created June 6, 2020 12:21 β€” forked from AudreyHal/.babelrc
{
"env": {
"development": {
"plugins": ["transform-es2015-modules-commonjs"]
},
"test": {
"plugins": ["transform-es2015-modules-commonjs", "@babel/plugin-proposal-class-properties"],
"presets": [
"@babel/preset-react"
]
When submitting a pull request to WP Rig, we ask that you squash your commits before we merge.
Some applications that interact with git repos will provide a user interface for squashing. Refer to your application's document for more information.
If you're using the Terminal, you can do the following:
Make sure your branch is up to date with the master branch.
Run git rebase -i master.
You should see a list of commits, each commit starting with the word "pick".
Make sure the first commit says "pick" and change the rest from "pick" to "squash". -- This will squash each commit into the previous commit, which will continue until every commit is squashed into the first commit.
@pgupta56
pgupta56 / App.js
Created May 31, 2020 06:43 β€” forked from hswolff/App.js
React Hooks: A Complete Introduction Source Code. Just use create-react-app!
import React from 'react';
import UseStateDemo from './UseStateDemo';
import UseEffectDemo from './UseEffectDemo';
import './App.css';
export default () => (
<div style={{ margin: '20px auto', padding: '20px', width: 200 }}>
<UseStateDemo />
<UseEffectDemo />
</div>
@pgupta56
pgupta56 / index.md
Created May 23, 2020 16:04 β€” forked from bvaughn/index.md
Interaction tracing with React

Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

This Gist provides some high-level docum

@pgupta56
pgupta56 / index.md
Created May 23, 2020 15:24 β€” forked from bvaughn/index.md
How to use profiling in production mode for react-dom
@pgupta56
pgupta56 / modern_js.md
Created May 22, 2020 15:53 β€” forked from gaearon/modern_js.md
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@pgupta56
pgupta56 / minification.md
Created May 22, 2020 15:21 β€” forked from gaearon/minification.md
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal: