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 | |
# backup the PATH | |
pathBak="$PATH" | |
# echo "$BASH_VERSION" | |
# 声明关联数组(bash > 4.2 版本) | |
declare -A env_paths=( | |
[node20]="/c/Users/inhere/workspace/env/node-sdk/node-v20.16.0-win-x64" | |
[node16]="/c/Users/inhere/workspace/env/node-sdk/node-v16.16.0-win-x64" |
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
# link https://github.com/humbug/box/blob/master/Makefile | |
#SHELL = /bin/sh | |
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明 | |
# mac 下这条声明 没起作用 !! | |
.RECIPEPREFIX = > | |
.PHONY: all usage help clean | |
# 需要注意的是,每行命令在一个单独的shell中执行。这些Shell之间没有继承关系。 | |
# - 解决办法是将两行命令写在一行,中间用分号分隔。 | |
# - 或者在换行符前加反斜杠转义 \ |
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
<?php | |
function format_mdtable2sql(string $mdStr): string | |
{ | |
$lines = array_values( | |
array_filter( | |
explode("\n", trim($mdStr)) | |
) | |
); |
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
<?php declare(strict_types=1); | |
namespace App\Common; | |
use ReflectionException; | |
use Swoft\Bean\Annotation\Mapping\Bean; | |
use Swoft\Bean\Annotation\Mapping\Inject; | |
use Swoft\Bean\Exception\ContainerException; | |
use Swoft\Consul\Agent; | |
use Swoft\Consul\Exception\ClientException; |
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 | |
# some common functions | |
# Usage: | |
# user_confirm | |
# user_confirm "custom question" | |
function user_confirm() { | |
local yes=0 | |
local msg="Confirm continue" |
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 | |
#set -e | |
# import common functions | |
source "$(dirname $0)/common-func.sh" | |
binName="bash $(basename $0)" | |
if [[ -z "$1" ]] |
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 | |
# | |
# TODO with release message | |
set -e | |
binName="bash $(basename $0)" | |
if [[ -z "$1" ]] | |
then |
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
<?php | |
$libDir = __DIR__ . '/'; | |
$npMap = [ | |
'SwoftTool\\' => $libDir, | |
// 'Inhere\\ValidateTest\\' => $libDir . '/test/', | |
]; | |
spl_autoload_register(function ($class) use ($npMap) { | |
foreach ($npMap as $np => $dir) { | |
if (strpos($class, $np) !== 0) { |
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
root = true | |
# 对所有文件生效 | |
[*] | |
charset = utf-8 | |
indent_style = space | |
indent_size = 4 | |
end_of_line = lf | |
insert_final_newline = true | |
trim_trailing_whitespace = 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
# | |
# @build-example build . -f Dockerfile -t myapp:test | |
# | |
################################################################################ | |
### builder image | |
################################################################################ | |
FROM golang:1.10-alpine as Builder | |
# Recompile the standard library without CGO |
NewerOlder