Skip to content

Instantly share code, notes, and snippets.

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

Sadaf Siddiqui halfbug

🏠
Working from home
View GitHub Profile
flowchart TD
    A[User Prompt] --> B[Gather Context]
    B --> C[Read Files]
    B --> D[Run Commands]
    B --> E[Use Tools & MCP]
    C --> F[Take Action]
    D --> F
    E --> F
 F --> G[Verify Results]
Tool Why It’s Useful
Vite Lightning-fast frontend development
React + TypeScript Reliable and scalable UI
Tailwind CSS Fast styling without CSS headaches
TanStack Router Clean protected route handling
TanStack Table Production-ready table system
Better Auth Modern authentication without auth fatigue
MongoDB Easy persistence and local setup
Express Lightweight backend for auth endpoints
flowchart TD
    A["CLIENT (browser, app, curl)"] -->|HTTPS| B["API GATEWAY"]

    B -->|Auth, Routing, Logging| C1["Lambda 1 (Chat)"]
    B -->|Auth, Routing, Logging| C2["Lambda 2 (Search)"]

    C1 --> D["DynamoDB (Cache)"]
 C1 --> E["MongoDB (History)"]
@halfbug
halfbug / pagination.input.ts
Last active April 18, 2023 07:16
Define a pagination input type:
@InputType()
export class Pagination {
@Field(() => Int, { defaultValue: 0 })
skip: number;
@Field(() => Int, { defaultValue: 10 })
take: number;
}
@halfbug
halfbug / terminal
Created October 18, 2022 12:01
open vscode as editor in git cmd
git config --global core.editor "code --wait"
@halfbug
halfbug / productGrid.jsx
Created September 29, 2022 12:43
usePagination Custom hook to create pagination in any grid.
....
import usePagination from 'hooks/usePagination';
import Pagination from 'react-bootstrap/Pagination';
....
const ProductGrid = ({
...props
}: ProductGridProps) => {
....
const {
screens, breakPoint, pageSize,
@halfbug
halfbug / gist:53135621f609e87d1be22598c80775a7
Created November 18, 2020 12:32
How to make Sitemap.xml public in React Js
1. Add sitemap.xml to public folder.
2. Import sitemap.xml in main app.js file ( you need to add it inside src folder too )
3. Update Rewrites and redirects with xml
</^[^.]+$|\.(?!(css|json|gif|ico|jpg|js|png|xml|txt|svg|woff|ttf)$)([^.]+$)/>
@halfbug
halfbug / hook
Last active September 29, 2022 12:12
Create a custom hook in react and write its unit test.
import { useSelector, useDispatch } from 'react-redux';
import { isEmpty } from 'lodash';
import lastPropertyIdSelector from 'selectors/lastPropertyId';
import { setLastPropertyId } from 'slices/lastPropertyId';
import propertySelector from 'selectors/properties';
export default function useLastProperty() {
const dispatch = useDispatch();
const { properties } = useSelector(propertySelector);
import { createSlice } from '@reduxjs/toolkit';
export const initialState = {};
const slice = createSlice({
name: 'lastPropertyId',
initialState,
reducers: {
store(state, action) {
const { payload } = action;
@halfbug
halfbug / gist:8f729c5730f08b00f8043b0ff64b4fc7
Created October 25, 2020 07:31
Take check out from remote origin's branch on local
- First fetch remote
git fetch origin
- then take the checkout for the branch
git checkout task2