Skip to content

Instantly share code, notes, and snippets.

View yuezk's full-sized avatar
πŸ’­
I may be slow to respond.

Kevin Yue yuezk

πŸ’­
I may be slow to respond.
View GitHub Profile
const MODULE_DIR = /(.*([\/\\]node_modules|\.\.)[\/\\](@[^\/\\]+[\/\\])?[^\/\\]+)([\/\\].*)?$/g;
{
loader: 'babel-loader',
test: /\.jsx?$/,
include(filepath) {
if (filepath.split(/[/\\]/).indexOf('node_modules')===-1) return true;
let pkg, manifest = path.resolve(filepath.replace(MODULE_DIR, '$1'), 'package.json');
try { pkg = JSON.parse(fs.readFileSync(manifest)); } catch (e) {}
return !!(pkg.module || pkg['jsnext:main']);
@yuezk
yuezk / numeric_literal_regexp.js
Last active August 7, 2019 05:22
[ECMAScript] Regexp to match the JavaScript numberic literal value (Supports number seprator)
// Reference: http://www.ecma-international.org/ecma-262/10.0/index.html#prod-NumericLiteral
(function () {
const regexp = /^[+-]?(?:0b[01]+|0o[0-7]+|0x[0-9a-f]+|(?:(?:(?:0|[1-9]\d*)\.\d*|\.\d+|(?:0|[1-9]\d*))(?:e[+-]?\d+)?))$/i;
// RegExp below also supports number spearator: https://github.com/tc39/proposal-numeric-separator
// const regexp = /^[+-]?(?:0b[01](_?[01])*|0o[0-7](_?[0-7])*|0x[0-9a-f](_?[0-9a-f])*|(?:(?:(?:0|[1-9](_?\d(_?\d)*)?)\.(\d(_?\d)*)?|\.\d(_?\d)*|(?:0|[1-9](_?\d(_?\d)*)?))(?:e[+-]?\d(_?\d)*)?))$/i;
const testCases = [
'0.', '0.E1', '0.e-1','0.e0', '0.1', '0.12', '0.12e2', '0.12e-2','0.12E0','0.0e1', '0.0e-1', '0.0E0',
'1.', '1.E1', '1.e-1','1.e0', '1.1', '1.12', '1.12e2', '1.12e-2','1.12E0','1.0e1', '1.0e-1', '1.0E0',
'1_0.', '1_0_0.', '1_0.0_1_2', '1_0_0', '100_000', '1e1_2', '1e+12_0', '.1_2_3', '.000_111', '10_1.1_2_3', '0.000_111', '0e0', '1_2e10',
@gengwg
gengwg / deepin20.md
Last active March 23, 2024 21:06
Upgrade to deepin 20 from deepin 15.11
  1. Change the source in /etc/apt/sources.list to
    deb [by-hash=force] https://community-packages.deepin.com/deepin/ apricot main contrib non-free
  1. Add the official source for app store in /etc/apt/sources.list.d/appstore.list. If no such a list file, please create one there and add below source:
@jv-k
jv-k / bump-version.sh
Last active January 15, 2024 02:49
This script automates bumping the git software project's version using automation ⚠️ For an updated version, please see https://github.com/jv-k/ver-bump β€” a CLI module you can use with your projects ⚠️
#!/bin/bash
#
# β–ˆβ–„β–„ β–ˆβ–‘β–ˆ β–ˆβ–€β–„β–€β–ˆ β–ˆβ–€β–ˆ β–„β–„ β–ˆβ–‘β–ˆ β–ˆβ–€β–€ β–ˆβ–€β–ˆ β–ˆβ–€ β–ˆ β–ˆβ–€β–ˆ β–ˆβ–„β–‘β–ˆ
# β–ˆβ–„β–ˆ β–ˆβ–„β–ˆ β–ˆβ–‘β–€β–‘β–ˆ β–ˆβ–€β–€ β–‘β–‘ β–€β–„β–€ β–ˆβ–ˆβ–„ β–ˆβ–€β–„ β–„β–ˆ β–ˆ β–ˆβ–„β–ˆ β–ˆβ–‘β–€β–ˆ
#
# Description:
# - This script automates bumping the git software project's version using automation.
# - It does several things that are typically required for releasing a Git repository, like git tagging,
# automatic updating of CHANGELOG.md, and incrementing the version number in various JSON files.