Skip to content

Instantly share code, notes, and snippets.

View quoctruongdev's full-sized avatar
💭
Good luck!

quoctruongdev

💭
Good luck!
View GitHub Profile
@quoctruongdev
quoctruongdev / .md
Created November 19, 2025 17:51 — forked from lucas-barake/.md
i18n with Zod Example

Input schema:

import { z } from "zod";
import { DateTime } from "luxon";
import { type TranslationValues } from "next-intl";

export const createDebtRecurrentOptions = ["WEEKLY", "BIWEEKLY", "MONTHLY"] as const;
export const createDebtTypeOptions = ["SINGLE", "RECURRENT"] as const;
@quoctruongdev
quoctruongdev / codeReview.md
Created November 3, 2025 03:30 — forked from ritikbanger/codeReview.md
React Frontend Code Review- Checklist (Master Code Review)

React Frontend Code Review- Checklist (Master Code Review)

  • Keep the components small, If the size exceeds 200-300 lines then create child components.
  • JSX markup should be no more than 50 lines.
  • Every function should have comments over it describing what it do.
  • Code has no linter errors.
  • If there are any React warnings reported in console, please solve that for example, Provide a key prop with a unique value for each element in array.
  • Do not repeat your code (DRY).
  • Code is in sync with existing code patterns.
  • No unused props are being passed.
@quoctruongdev
quoctruongdev / example.ts
Created April 30, 2025 08:24 — forked from gpichot/example.ts
Tanstack React Query pattern matching
export default function SessionsList() {
const sessionsQuery = useSessionsListQuery();
return (
<PageLayout title="My sessions">
{matchQueryStatus(sessionsQuery, {
Loading: (
<>
<Skeleton height={70} mt={6} />
<Skeleton height={70} mt={6} />
@quoctruongdev
quoctruongdev / google-analytics-node.js
Created October 24, 2024 17:32 — forked from kortenu/google-analytics-node.js
An example of how to generate Google Analytics reports from node.js (with custom dimensions).
var GA = require('googleanalytics'),
Table = require('cli-table'),
util = require('util');
// API client.
// You may need to enable API access to analytics for your account
// here: https://code.google.com/apis/console
var ga = new GA.GA({
"user": "myaccount@gmail.com",
@quoctruongdev
quoctruongdev / copy_files.gs
Created August 16, 2024 06:10 — forked from KenjiOhtsuka/copy_files.gs
Google Apps Script to Copy Folder Recursively
/**
This is a code of Google Apps Script for copying google drive folder content to other folder.
## Which situation the code resolve.
Google doesn't allow to move folder content to other folder which is managed by
other organization according to the policy of the GSUITE organization.
And, Google doesn't allow to change the content owner to the user in other
organizations.
@quoctruongdev
quoctruongdev / System Design.md
Created August 2, 2024 15:44 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?

How to get Telegram Bot Chat ID

Create a Telegram Bot and get a Bot Token

  1. Open Telegram application then search for @BotFather
  2. Click Start
  3. Click Menu -> /newbot or type /newbot and hit Send
  4. Follow the instruction until we get message like so
    Done! Congratulations on your new bot. You will find it at t.me/new_bot.
    
@quoctruongdev
quoctruongdev / seo-meta-in-spa.md
Created July 2, 2024 05:03 — forked from RakaDoank/seo-meta-in-spa.md
How do i achieve SEO Meta in Server While The Web Project is Single Page Application (SPA)?

Are you having a trouble about SEO Meta in server while your project is SPA only like React Router or Vue Router?

Can i guess you also don't have so much time for migration on the new framework that can handle server side rendering out of the box like Next.js, Nuxt.js, Gatsby, etc.

Setting the SEO meta in server like <title>, <meta name="description"/> are actually useful for search engine, and also good for showing your summary content in social media app by pasted the full url in Whatsapp, IG, Twitter, etc.

Enough the intermezzo, here we go.

The concept is actually simple, modify the index.html (from bundled source) before it served to the client.

@quoctruongdev
quoctruongdev / Cursor.tsx
Created May 27, 2024 08:09 — forked from fibonacid/Cursor.tsx
Mouse Cursor (React + GSAP)
import { Container } from "./styles";
import {
forwardRef,
PropsWithChildren,
useImperativeHandle,
useRef,
} from "react";
export type CursorProps = PropsWithChildren<{
className?: string;
@quoctruongdev
quoctruongdev / gardientUtility.ts
Created March 29, 2024 07:42 — forked from apirak/gardientUtility.ts
Convert Figma Gradient to CSS Gradient
import { colorToRgb, rgbToHex } from "./colorUtility";
function convertToDegree(matrix:Transform):number {
const values = [...matrix[0], ...matrix[1]];
const a = values[0];
const b = values[1];
const angle = Number(((Math.atan2(b, a) * (180 / Math.PI)) + 90).toFixed(2));
return angle <= 0 ? angle + 360 : angle;
}