Skip to content

Instantly share code, notes, and snippets.

View trinhvanminh's full-sized avatar
🎲
haha

Minh trinhvanminh

🎲
haha
View GitHub Profile
@trinhvanminh
trinhvanminh / generateRoutes.js
Created July 23, 2025 08:48
Nextjs app router -> generate routes scripts (not handle dynamic route yet)
// generateRoutes.js
const fs = require('fs');
const path = require('path');
// the app folder path
const appDir = path.join(__dirname, 'src/app');
// the output path
const routeFile = path.join(__dirname, 'src/routes.ts');
function toCamelCase(str) {
@trinhvanminh
trinhvanminh / Microsoft.PowerShell_profile.ps1
Created July 21, 2025 03:57
git aliases for powsershell profile
// notepad $profile
function cm { git commit @args }
function ad { git add @args }
function st { git status }
function pl { git pull }
function pu { git push }
function lg { git log --oneline --graph --all }
function co { git checkout @args }
function br { git branch }
@trinhvanminh
trinhvanminh / what-forces-layout.md
Created July 3, 2025 04:29 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
import { defineConfig, loadEnv } from '@rsbuild/core';
// import { pluginEslint } from '@rsbuild/plugin-eslint';
import { pluginReact } from '@rsbuild/plugin-react';
import { pluginSass } from '@rsbuild/plugin-sass';
import { pluginSvgr } from '@rsbuild/plugin-svgr';
import { pluginTypeCheck } from '@rsbuild/plugin-type-check';
const { publicVars, rawPublicVars } = loadEnv({ prefixes: ['REACT_APP_'] });
export default defineConfig({
@trinhvanminh
trinhvanminh / README.md
Last active September 18, 2025 03:53
Mocks Server
  1. Install npm i -D @mocks-server/main

  2. Add script

"scripts": {
    "mocks": "mocks-server",
},
@trinhvanminh
trinhvanminh / README.md
Created December 9, 2024 04:12 — forked from addyosmani/README.md
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@trinhvanminh
trinhvanminh / isEllipsisActive.js
Created November 20, 2024 02:51
Detect CSS Ellipsis in JavaScript and add a title. https://jsfiddle.net/tzi/qtqnqomL/
// https://jsfiddle.net/tzi/qtqnqomL/
function isEllipsisActive(element) {
return element.offsetWidth < element.scrollWidth;
}
Array.from(document.querySelectorAll('.ellipsis'))
.forEach(element => {
if (isEllipsisActive(element)) {
element.title = element.innerText;
@trinhvanminh
trinhvanminh / Container.module.scss
Last active December 9, 2024 03:55
Auto Grid with props xs, ... as a List. GridLayout, GridContainer, GridItem, Container (based on Mui Grid v2, Mui Container)
// Import the variables file to access the breakpoints and other variables
@import './variables';
/* Base container styles */
.root {
width: 100%;
margin-left: auto;
margin-right: auto;
padding-left: $container-padding-x;
padding-right: $container-padding-x;
@trinhvanminh
trinhvanminh / tinh_lai_suat_kep.py
Last active August 14, 2024 15:17
Tính lãi suất kép
import matplotlib.pyplot as plt
lai_suat_theo_ky_han = [
{
"ky_han": 1,
"lai_suat": 0.037
},
{
"ky_han": 2,
"lai_suat": 0.038
@trinhvanminh
trinhvanminh / removeHolaVPNOverlay.js
Last active June 5, 2024 08:10
remove Hola VPN extension loading time overlay, without need to wait
// ==UserScript==
// @name remove Hola VPN overlay
// @namespace http://tampermonkey.net/
// @version 2024-06-05
// @description try to take over the world!
// @author You
// @match https://*.medium.com/*
// @match *://*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=medium.com
// @grant none