Skip to content

Instantly share code, notes, and snippets.

View JLHwung's full-sized avatar

Huáng Jùnliàng JLHwung

  • Waterloo, ON, Canada
View GitHub Profile
@JLHwung
JLHwung / wavy-dot-representation.md
Created May 5, 2020 20:21
A wavy-dot AST representation

Extend from the ChainingExpression approach.

Expressions

ChainingExpression

extend interface Chain <: Node {
    eventual: boolean
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = normalizeFile;
function _fs() {
const data = _interopRequireDefault(require("fs"));
@JLHwung
JLHwung / stat-inlined-helper-calls.sh
Last active November 6, 2019 20:42
A shell script to stat the number of inlined _interopRequireDefault helpers
#!/bin/sh
# @babel/standalone 7.7.1
wget -qO- https://unpkg.com/@babel/[email protected]/babel.js | grep -Ec "^function \_interopRequireDefault\(obj\)"
# @babel/standalone develop
cat packages/babel-standalone/babel.js | grep -Ec "^function \_interopRequireDefault\(obj\)"
# @babel/preset-env-standalone 7.7.1
wget -qO- https://unpkg.com/@babel/[email protected]/babel-preset-env.js | grep -Ec "^function \_interopRequireDefault\(obj\)"
@JLHwung
JLHwung / test.spec.ts
Created December 5, 2018 01:44
A test snippet for testing jest-zone-patch
require("jest-preset-angular");
test.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
'.add(%i, %i)',
(a, b, expected) => {
expect(a + b).toBe(expected);
},
);
describe.each([[1, 1, 2], [1, 2, 3], [2, 1, 3]])(
{"sig":"a5a638c14ba35a75f201dfb094a56c1927af11eec7f82910def125d098d7b3e236475a15475ac159d127fad468499ff2335de5cd61a6c785059f89fee83a0d790","msghash":"7e85b2fe5994bd57d9557aad4b766abb72f8648ce27893c63c71a5b5094794fe"}
@JLHwung
JLHwung / get-macos-installed-applicatioin-version.sh
Created February 8, 2018 02:28
Get macOS Installed Application version
# $1: The application name
echo `system_profiler -xml SPApplicationsDataType | xmllint --xpath \
"//dict[string='$1']/key[.='version']/following-sibling::*[1]/text()" -`
@JLHwung
JLHwung / README.md
Last active January 11, 2018 10:44
integration issue with jest and mock-require

Usage

npm install
npx jest
@JLHwung
JLHwung / compile-nginx.sh
Created December 24, 2017 06:44
compile nginx + brotli
#!/bin/sh
openssl_version=1.1.0g
nginx_version=1.12.2
zlib_version=1.2.11
pcre_version=8.41
wget -O- https://ftp.pcre.org/pub/pcre/pcre-$pcre_version.tar.bz2 | tar -xjvf -
@JLHwung
JLHwung / Poorman-通用规范汉字表-unicode码位.md
Last active August 7, 2022 01:08
The Poorman's Unicode Map of 通用规范汉字表

Add Unicode Codepoint mapping alongside the ideograph in Table of General Standard Chinese Characters (通用规范汉字表)

Run the snippet in the console when opening 通用规范汉字表.

$(".mw-parser-output dl dd").each(function(){$(this).append(`<small style="margin-left:1rem"><code>U+${$(this).text().replace(/[\d\s]+/i, "").codePointAt(0).toString(16).toUpperCase()}</code></small>`)})
@JLHwung
JLHwung / homebrew-postgresql-upgrade-10.sh
Last active October 18, 2017 05:52
homebrew-postgresql-upgrade-10
# install postgresql 10
brew upgrade postgresql
# Check version by `brew list --versions postgres`
export OLD_POSTGRES_VERSION=9.6.5;
export NEW_POSTGRES_VERSION=10.0;
# Stop postgresql service
brew services stop postgresql