Skip to content

Instantly share code, notes, and snippets.

@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 May 13, 2024 06:29
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 July 12, 2024 23:04
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 July 13, 2024 16:06
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

@tanaikech
tanaikech / submit.md
Last active September 2, 2022 18:28
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;
}
@JerryLokjianming
JerryLokjianming / Crack Sublime Text Windows and Linux.md
Last active July 20, 2024 18:39
Crack Sublime Text 3.2.2 Build 3211 and Sublime Text 4 Alpha 4098 with Hex

How to Crack Sublime Text 3.2.2 Build 3211 with Hex Editor (Windows | Without License) ↓

  1. Download & Install Sublime Text 3.2.2 Build 3211
  2. Visit https://hexed.it/
  3. Open file select sublime_text.exe
  4. Offset 0x8545: Original 84 -> 85
  5. Offset 0x08FF19: Original 75 -> EB
  6. Offset 0x1932C7: Original 75 -> 74 (remove UNREGISTERED in title bar, so no need to use a license)