Skip to content

Instantly share code, notes, and snippets.

View LishuGupta652's full-sized avatar
🎯
Focusing

Lishu Gupta LishuGupta652

🎯
Focusing
View GitHub Profile
async function getUser(url) {
try {
const response = await fetch(url, {
method: 'GET',
headers: {
accept: 'application/json',
},
});
if (!response.ok) {
ssh-keygen -t rsa -C "[email protected]"
$ ssh-add ~/.ssh/id_firstkey
$ ssh-add ~/.ssh/id_secondkey
$ ssh-add -D
$ ssh-add -l
import React, { createContext } from "react";
export type RejectedFileType = {
rejectedFiles: any[];
currentPage: number;
totalRecords: number;
sortByObject: Record<string, string>
loading: boolean;
error: string,
@LishuGupta652
LishuGupta652 / css
Created September 26, 2022 17:31
100 Bytes of CSS to look great everywhere
html {
max-width: 70ch;
padding: 3em 1em;
margin: auto;
line-height: 1.75;
font-size: 1.25em;
}
h1,h2,h3,h4,h5,h6 {
@LishuGupta652
LishuGupta652 / ++index.css
Created December 28, 2021 19:22
gradient and glassmorphism
.gradient-bg-welcome {
background-color: #0f0e13;
background-image: radial-gradient(
at 0% 0%,
hsla(253, 16%, 7%, 1) 0,
transparent 50%
),
radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
}
@LishuGupta652
LishuGupta652 / useElementPosition.js
Created December 27, 2021 08:36
use Element Position React gist
import { useEffect } from "react";
import { useState } from "react";
export default function useElementPosition(el) {
function getElement(x, y) {
return {
x,
y,
};
}
@LishuGupta652
LishuGupta652 / GlobalContext.js
Last active December 27, 2021 08:34
Global Reducer + context
import React, { createContext, useReducer, useContext } from "react";
// Define the context
const GlobalStateContext = createContext();
const GlobalDispatchContext = createContext();
// Reducer
const globalReducer = (state, action) => {
switch (action.type) {
case "TOGGLE_THEME": {
const filename = 'data.json';
const jsonStr = JSON.stringify(JsonExport);
let element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(jsonStr));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
scripts: {
"build": "GENERATE_SOURCEMAP=false react-scripts build"
}
# Netlify
CI=false npm run build
[build]
command = "CI=false npm run build"
publish = "/build"
base = "/"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200