Skip to content

Instantly share code, notes, and snippets.

View jainvishal520's full-sized avatar
🏠
Working from home

Vishal Jain jainvishal520

🏠
Working from home
View GitHub Profile
@jainvishal520
jainvishal520 / Chat.after.js
Created November 25, 2020 16:44 — forked from elijahmanor/Chat.after.js
Code from Migrating from Unsafe React Lifecycle Hooks https://www.youtube.com/watch?v=G9S1IghlkCI
import React, { Component } from "react";
import Button from "./Button";
import Message from "./Message";
import { getMessage } from "./utils";
export default class Chat extends Component {
state = {
isStreaming: this.props.isStreaming,
messages: [getMessage()]
};
@jainvishal520
jainvishal520 / vanilla-js-cheatsheet.md
Created November 21, 2020 18:49 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@jainvishal520
jainvishal520 / Searching and Sorting
Created October 16, 2020 09:16
Various searching and sorting using JS
// 1. bubble sort
let swap = (arr, idx1, idx2) => {
let temp = arr[idx1];
arr[idx1] = arr[idx2];
arr[idx2] = temp;
};
let bubbleSort = (arr) => {
for (let i = arr.length; i > 0; i--) {
for (let j = 0; j < i - 1; j++) {
@jainvishal520
jainvishal520 / Singly Linked List
Created October 16, 2020 08:57
Singly Linked List implementation in Javascript
class Node{
constructor(val){
this.val = val;
this.next = null;
}
}
class SinglyLinkedList{
constructor(){
this.head = null;
@jainvishal520
jainvishal520 / Binary Search Tree
Created October 16, 2020 08:56
Binary Search Tree implemetation in Javascript
class Node {
constructor(value){
this.value = value;
this.left = null;
this.right = null;
}
}
class BinarySearchTree {
constructor(){
@jainvishal520
jainvishal520 / css-media-queries-cheat-sheet.css
Created July 18, 2017 11:33 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@jainvishal520
jainvishal520 / test.html
Last active March 25, 2020 12:59
React search and filter docs example
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
@jainvishal520
jainvishal520 / index.js
Last active June 15, 2017 12:05
React documentation examples
// const user = {
// fname:'vishal',
// lname:'jain'
// }
// function formatName(user){
// return user.fname +' '+user.lname;
// }
// const element = (<h1>