Skip to content

Instantly share code, notes, and snippets.

View tientq64's full-sized avatar
🧋
Chill with code

Tran Quang Tien tientq64

🧋
Chill with code
View GitHub Profile
@tientq64
tientq64 / gist:b4497616b07e5e6298b499aa5f73d6de
Created March 11, 2024 13:29
Disabled HTML input autocomplete.
"aria-autocomplete": "both"
@tientq64
tientq64 / add.js
Last active October 22, 2023 14:57
Add 2 numbers, fix floating point problem, example: 0.1 + 0.2, not support Node.js :Đ
function add(a, b) {
if (a === 0) return b;
if (b === 0) return a;
let sign = 1;
if (a < 0 && b < 0) {
a = -a;
b = -b;
sign = -1;
}
if (b < 0) {
@cloorc
cloorc / vscode-customize-css.css
Last active February 19, 2025 02:35
vscode-customize-css
/*
* A simple vscode style customization for https://github.com/be5invis/vscode-custom-css
* Just put this file into anywhere and refer it from your vscode `settings.json` under `vscode_custom_css.imports` as following:
* "vscode_custom_css.imports": [
* "file:///c:/Users/anyone/vscode.css"
* ]
**/
a.label-name,
p.subtitle.description,
h1.product-name.caption,
min + Math.floor(Math.random() * (max - min + 1))
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active April 12, 2025 00:19
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

_
..;/
@
0
00
01
02
03
04
05
@MichaelCurrin
MichaelCurrin / README.md
Last active April 6, 2025 18:23
GitHub GraphQL - Get files in a repository

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query

@andriyudatama
andriyudatama / VS Code Disable GPU Acceleration
Last active April 21, 2025 14:51
Disable Hardware Acceleration (GPU) on Visual Studio Code
Visual Studio Code frequently crashes linux. Using NVIDIA GPU
1. Open command pallete (Ctrl + Shift + P)
2. Enter "Preferences: Configure Runtime Arguments"
3. Add config: "disable-hardware-acceleration": true
4. Restart VS Code
@tanaikech
tanaikech / submit.md
Last active January 5, 2025 06:09
Simple Script of Resumable Upload with Google Drive API for Node.js

Simple Script of Resumable Upload with Google Drive API for Node.js

This is a simple sample script for achieving the resumable upload to Google Drive using Node.js. In order to achieve the resumable upload, at first, it is required to retrieve the location, which is the endpoint of upload. The location is included in the response headers. After the location was retrieved, the file can be uploaded to the location URL.

In this sample, a PNG file is uploaded with the resumable upload using a single chunk.

Sample script

Before you use this, please set the variables.

@mdciotti
mdciotti / encodeURIComplete.js
Last active August 1, 2022 03:26
Completely encode all characters of a string into a URL escape sequence.
// NOTE: This is overkill. I wrote this and then quickly realized there is a better way to do it. See below.
/**
* https://tc39.es/ecma262/#leading-surrogate
* @param {number} codeUnit
*/
function isLeadingSurrogate(codeUnit) {
return 0xD800 <= codeUnit && codeUnit <=0xDBFF;
}