Skip to content

Instantly share code, notes, and snippets.

View kirandash's full-sized avatar

Kiran Dash kirandash

View GitHub Profile
- How to rebase when there is only two commits?
- `git rebase -i --root`
- `git push -f`
@kirandash
kirandash / remix-cheat-sheet.mdx
Last active March 16, 2023 15:10
Remix Project cheat sheet

npx remix routes: to check all the routes

playwright installation: npm init playwright@latest --yes -- --quiet --browser=chromium --gha

Fly io

  • flyctl auth token to get token and set FLY_API_TOKEN in actions setting for project
  • fly deploy to deploy app
  • flyctl login
@kirandash
kirandash / commands.sh
Last active March 9, 2023 03:39
Create multiple files with pbpaste
pbpaste > ./app/routes/users.\$username.tsx
pbpaste > ./app/routes/users.\$username.posts.tsx
pbpaste > ./app/routes/users.\$username.edit.tsx
pbpaste > ./app/routes/posts.tsx
pbpaste > ./app/routes/posts.new.tsx
pbpaste > ./app/routes/posts.\$postId.tsx
pbpaste > ./app/routes/posts.\$postId.edit.tsx
pbpaste > ./app/routes/search.tsx
pbpaste > ./app/routes/login.tsx
pbpaste > ./app/routes/signup.tsx
@kirandash
kirandash / README.MD
Created January 14, 2023 05:12
AI Projects
@kirandash
kirandash / LazyRetryUsage.tsx
Last active November 17, 2022 03:07
How to fix ChunkLoadError in your ReactJS application - with typescript
const LazyLoaderMyOrder =
lazyRetry(
() => import(/*webpackChunkName: "myorders" */ "pages/myOrders/MyOrders"),
"myorders",
);
@kirandash
kirandash / authStorage.ts
Created February 3, 2021 07:02
AWS Amplify Custom LocalStorage
import Amplify, { Auth } from "aws-amplify";
const MEMORY_KEY_PREFIX = "@kdAuth:";
let dataMemory = {};
/**
* This is used to set a specific item in storage
*/
function setItem(key, value) {
localStorage.setItem(MEMORY_KEY_PREFIX + key, value);
@kirandash
kirandash / react_tips.js
Last active January 13, 2021 09:36
React Tips
// React: how to update state.item[1] in state using setState?
this.setState(({items}) => ({
items: [
...items.slice(0,1),
{
...items[1],
name: 'newName',
},
...items.slice(2)
]
/* 1. Display Flex not working on Safari */
.row {
display: -ms-flexbox;
display: flex;
display: -webkit-box;
}
/* 2. Height Issue for Flex Items */
Don't use percentage heights for flex items or child. Use height auto.
https://stackoverflow.com/questions/33636796/chrome-safari-not-filling-100-height-of-flex-parent
/* Copy Text to Clipboard */
import React from 'react';
class CopyExample extends React.Component {
constructor(props) {
super(props);
this.state = { copySuccess: '' }
}
// 1. Track API calls in network for React Native Application
// Add the below code to App.js file:
XMLHttpRequest = GLOBAL.originalXMLHttpRequest ?
GLOBAL.originalXMLHttpRequest : GLOBAL.XMLHttpRequest;
// 2. React Native Vertically aligning Content
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'