Skip to content

Instantly share code, notes, and snippets.

View heyitsarpit's full-sized avatar
👑
Hi, I'm Arpit

arpit heyitsarpit

👑
Hi, I'm Arpit
View GitHub Profile
@heyitsarpit
heyitsarpit / git_name_update.sh
Created June 3, 2022 11:44
Update name / email of all commits.
git filter-branch --env-filter '
OLD_EMAIL="old@email.com"
CORRECT_NAME="new_name"
CORRECT_EMAIL="new@email.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
​// base is milliseconds
​const​ ​second​ ​=​ ​1000
​const​ ​minute​ ​=​ ​60​ ​*​ ​second
​const​ ​hour​ ​=​ ​60​ ​*​ ​minute
​const​ ​day​ ​=​ ​24​ ​*​ ​hour
​const​ ​week​ ​=​ ​7​ ​*​ ​day
​const​ ​month​ ​=​ ​4​ ​*​ ​week
​const​ ​year​ ​=​ ​12​ ​*​ ​month
@heyitsarpit
heyitsarpit / Dialog.tsx
Created February 21, 2022 14:35
Custom Dialog built with Radix UI
import * as RadixDialog from '@radix-ui/react-dialog'
import { keyframes, styled } from '@stitches/react'
import clsx from 'clsx'
import { forwardRef } from 'react'
/**
* This is a custom dialog component that has tailwind classes and and some structure pre built.
*
* Example:
* ```tsx
import produce from 'immer';
import create, { GetState, SetState, State, StoreApi, UseStore } from 'zustand';
type StateCreator<T extends State, CustomSetState = SetState<T>, U extends State = T> = (
set: CustomSetState,
get: GetState<T>,
api: StoreApi<T>
) => U;
const immer = <T extends State, U extends State>(
@heyitsarpit
heyitsarpit / .eslintignore
Created June 28, 2020 07:13
ESlint and Prettier for React apps (Bonus - Next.js and TypeScript)
node_modules
// write a funcction which will find the number of time
// a character is repeated in a string
// input: aabbcccddefb
// output: { a: 2, b: 3,c: 3, d: 2, e: 1,f:1}
export function charOccurance(string: string) {
let freq: Record<string, number> = {};
const strArr = Array.from(string);
strArr.forEach(char => {
if (freq[char]) {

Arpit Bharti - GSoC 2019 Progress Report

Project - Ship the Public Suffix List (PSL) over Remote Settings

Organization - Mozilla

Project Mentor - Mathieu Leplatre

Summary