This file contains hidden or 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
// 对Date的扩展,将 Date 转化为指定格式的String | |
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, | |
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) | |
// 例子: | |
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 | |
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 | |
Date.prototype.Format = function (fmt) { //author: meizz | |
var o = { | |
"M+": this.getMonth() + 1, //月份 | |
"d+": this.getDate(), //日 |
This file contains hidden or 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
upstream frontends { | |
server 127.0.0.1:8088; # server 监听的ip:port | |
} | |
server { | |
listen 80; | |
server_name xxx.com www.xxx.com; | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; |
This file contains hidden or 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 compare_speed(callable $sample1, callable $sample2, int $times = 1000, array $args = []) | |
{ | |
if ($times < 1000) { | |
$times = 1000; | |
} | |
$start1 = microtime(1); |
This file contains hidden or 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
upstream io_nodes { | |
ip_hash; | |
server 127.0.0.1:6001; | |
server 127.0.0.1:6002; | |
server 127.0.0.1:6003; | |
server 127.0.0.1:6004; | |
} | |
server { | |
listen 3000; |
This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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 hidden or 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
// var temp2 = $0.children | |
var temp2 = document.getElementsByTagName('tbody')[0].children | |
var arr1 = [] | |
for (t in temp2) { | |
if (t == 0) { | |
continue | |
} |
This file contains hidden or 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 hidden or 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" ]] |