Skip to content

Instantly share code, notes, and snippets.

View lelinhtinh's full-sized avatar
🤤
Slimming failure

Thành Thân Thiện lelinhtinh

🤤
Slimming failure
  • Da nang, Vietnam
  • 19:50 (UTC +07:00)
View GitHub Profile
@ShogunPanda
ShogunPanda / ESM in CJS.md
Created November 16, 2021 14:09
Usage of ESM modules in CommonJS world.

Import ESM module in a CommonJS module

Do not use requires or top-level imports (if you're transpiling server side code). Replace all occurrences with await import and wrap your code in a async function.

Example

If your original code was:

@bilelz
bilelz / pkce-generator_vanilla.js
Last active September 21, 2021 04:30
PKCE Code Verifier and Code Challenge Generator without externals libs (vanilla js). Demo : https://codepen.io/bilelz/full/YzNozBe
function generateCodeVerifier() {
return Array(128)
.fill('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~')
.map(x => x[Math.floor(crypto.getRandomValues(new Uint32Array(1))[0] / (0xffffffff + 1) * x.length)])
.join('');
}
async function generateCodeChallenge(code_verifier) {
const encoder = new TextEncoder();
const data = encoder.encode(code_verifier);
@harrytran998
harrytran998 / react-rendering.md
Created March 23, 2021 13:33 — forked from tuhuynh27/react-rendering.md
A (Mostly) Complete Guide to React Rendering Behavior

Translated from https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/, author: Mark Erikson (from Redux team)

A (Mostly) Complete Guide to React Rendering Behavior

Bài viết cung cấp chi tiết về cách mà React render hoạt động, và việc sử dụng Context và Redux ảnh hưởng thế nào tới quá trình render của React.

"Render" là gì

Rendering is the process of React asking your components to describe what they want their section of the UI to look like, now, based on the current combination of props and state.

// WARNING: There's much more to know/do around hooks, and
// this is just a simplification of how these work.
// shared references, updated
// per each hook invoke
let execution = null;
let current = null;
let context = null;
let args = null;
@tobywf
tobywf / save-gists.py
Created April 7, 2020 03:33
Save all gists from GitHub, including comments
"""
Save all gists from GitHub, including comments.
Requires the PyGithub library (``pip install PyGithub>=1.47``).
Pass a personal access token with the scope "gist" as the first
argument.
This probably won't work for large files (+10MiB), since they aren't
returned by the GitHub API, and must be cloned instead.
@emabrey
emabrey / wsl_copy_ssh_keys.sh
Last active August 31, 2024 15:55
WSL SSH Key Copier
#!/bin/bash
#enable nullglob on startup if not enabled
shopt -q nullglob || shopt -s nullglob;
# Turns the given value into an array and verifies that the array has more than zero elements
# to check if the globbed file directory given exists
# requires nullglob to be or it will enable/disable during the function execution
glob_exists() {
shopt -q nullglob || (echo "nullglob must be enabled for glob_exists to work." && return 1);
@johndavedecano
johndavedecano / .gitlab-ci.yml
Last active April 26, 2024 09:32
CI/CD for ReactJS Application using GITLAB
cache:
paths:
- node_modules/
- .yarn
stages:
- build
- test
- deploy
build:
image: node:10
@lelinhtinh
lelinhtinh / lamp-win.md
Last active March 15, 2020 08:23
Cài đặt LAMP server trong WSL

Cài đặt LAMP server trong WSL

Cài đặt Ubuntu

Kích hoạt WSL (Windows Subsystem for Linux) bằng cách mở PowerShell với quyền Admin (Run as administrator), và chạy lệnh:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Khởi động lại máy.

@lelinhtinh
lelinhtinh / del-ubuntu.md
Last active September 13, 2024 02:21
Những tùy chỉnh và ứng dụng Ubuntu mình đang dùng
@lelinhtinh
lelinhtinh / crontab-wsl.md
Created August 25, 2019 16:32
Sử dụng Crontab trong WSL (Windows Subsystem for Linux)

Crontab trong WSL

Hướng dẫn cài đặt và sử dụng Crontab của Ubuntu trong Windows 10.

Cài đặt Ubuntu

Kích hoạt WSL bằng cách mở PowerShell (Admin) và chạy lệnh:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux