Skip to content

Instantly share code, notes, and snippets.

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

Dipesh KC dipeshhkc

🏠
Working from home
View GitHub Profile
export const App = () => {
const [toastVisible, setToastVisible] = useState(false);
const [toastError, setToastError] = useState("");
const [authState, setAuthState] = React.useState<AuthState>();
const [user, setUser] = React.useState<object | undefined>();
useEffect(() => {
Hub.listen("auth", (res) => {
const errorMsg = res.payload.data?.message
import { createUseStyles } from 'react-jss';
const useStyles = createUseStyles(() => ({
middle: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
},
heading: ({ color, fontSize }) => ({
extend: 'middle',
import Document, { Html, Head, Main, NextScript } from "next/document";
import { SheetsRegistry, JssProvider, createGenerateId } from "react-jss";
class MyDocument extends Document {
static async getInitialProps(ctx) {
const registry = new SheetsRegistry();
const generateId = createGenerateId();
const originalRenderPage = ctx.renderPage;
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => (props) => (
import { ThemeProvider } from "react-jss"
const theme = {
black: "#000000",
primary: "#0c0c0c",
secondary: "#898880",
secondaryLight: "#C5C3BC",
accent: "#80722A",
accentMid: "#E9E7DE"
}
import Document, { Html, Head, Main, NextScript } from "next/document";
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<link rel="icon" href="link to favicon" />
<link href="link to font" rel="stylesheet">
@dipeshhkc
dipeshhkc / minimize.js
Created August 27, 2020 13:28 — forked from dipeshdulal/minimize.js
Minimize Number into K, M, G, T, P, E
var minimizeNumber = (num) => {
if(!Number.isFinite(num)) return "";
const minimizeMap = ["K", "M", "G", "T", "P", "E"];
if(num < 1000) return num.toString();
const exp = Math.floor(Math.log(num)/ Math.log(1000));
const minimized = Number((num / Math.pow(1000, exp)).toFixed(2));
return minimized+minimizeMap[exp-1];
}
git config core.sparsecheckout true
echo [dirname] >> .git/info/sparse-checkout
git remote add -f origin [main-github-repo-url]
git pull origin master

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

for entry in *.png
do
convert $entry -quality 60 $entry
done
@dipeshhkc
dipeshhkc / Instructions.MD
Last active October 9, 2020 14:14 — forked from dipeshdulal/RepoAddInstructions.MD
Get a list of created PR's today.

Instructions

  1. Go to github profile page.
  2. Click on today's or some days contribution
  3. Open Inspector Window
  4. Pase the following code
let rollupWrapper = document.querySelectorAll('.profile-rollup-wrapper');