function parseURI(url) {
var m = String(url).replace(/^\s+|\s+$/g, ‘’).match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
// authority = ‘//‘ + user + ‘:’ + pass ‘@‘ + hostname + ‘:’ port
return (m ? {
href: m[0] || ‘’,
protocol: m[1] || ‘’,
authority: m[2] || ‘’,
host: m[3] || ‘’,
hostname: m[4] || ‘’,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
一、为Create-react-app项目配置支持绝对路径引入模块 | |
Messing around I just found one setting that works without craco for the absolute paths: | |
1 - Update .env file to NODE_PATH=./; | |
2 - Create one tsconfig.paths.json: | |
{ | |
"compilerOptions": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @export generateUUID | |
* @returns {String} | |
* @description RFC4122 version 4 compliant solution | |
* @link | |
* https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | |
*/ | |
export function generateUUID () { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( | |
/[xy]/g, function(c: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"extends": ["tslint-react"], | |
"rules": { | |
"ban": false, | |
"class-name": true, | |
"comment-format": [ | |
true, | |
"check-space" | |
], | |
"curly": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git filter-branch --env-filter ' | |
OLD_EMAIL="旧的Email地址" | |
CORRECT_NAME="正确的用户名" | |
CORRECT_EMAIL="正确的邮件地址" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# create self-signed server certificate: | |
read -p "Enter your domain [www.example.com]: " DOMAIN | |
echo "Create server key..." | |
openssl genrsa -des3 -out $DOMAIN.key 1024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @copyright ydhao 2018 Clustertech Limited. All rights reserved. | |
* @author YanDong Hao (377868419@qq.com) | |
* | |
* @file Type definitions for AMap | |
*/ | |
declare module AMap { | |
/** | |
* 此对象用于表示地图、覆盖物、叠加层上的各种鼠标事件返回,包含以下字段: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin | |
export PATH | |
#=================================================================# | |
# System Required: CentOS, Debian, Ubuntu # | |
# Description: One click Install Shadowsocks-go server # | |
# Author: Teddysun <i@teddysun.com> # | |
# Thanks: @cyfdecyf <https://twitter.com/cyfdecyf> # | |
# Intro: https://teddysun.com/392.html # | |
#================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS | |
# This script will work on Debian, Ubuntu, CentOS and probably other distros | |
# of the same families, although no support is offered for them. It isn't | |
# bulletproof but it will probably work if you simply want to setup a VPN on | |
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and | |
# universal as possible. | |
参考文档:https://nodejs.org/zh-cn/
使用nvm作为node.js版本管理工具
NewerOlder