Skip to content

Instantly share code, notes, and snippets.

View LishuGupta652's full-sized avatar
🎯
Focusing

Lishu Gupta LishuGupta652

🎯
Focusing
View GitHub Profile
@bradtraversy
bradtraversy / ssh.md
Last active October 22, 2024 15:35
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh [email protected]

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@joshuacerbito
joshuacerbito / useLocalStorage.js
Last active April 16, 2020 20:26
Custom React Hook for handling local storage
import { useState } from 'react';
export default function useLocalStorage(key, initialValue) {
const [item, setInnerValue] = useState(() => {
try {
return window.localStorage.getItem(key)
? JSON.parse(window.localStorage.getItem(key))
: initialValue;
} catch (error) {
return initialValue;
@joshuacerbito
joshuacerbito / useScroll.js
Last active January 8, 2024 13:44
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);