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
<?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
// 对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
server { | |
listen 80; | |
server_name www.site.dev site.dev; | |
root /webroot/static; | |
index index.html index.htm; | |
error_log logs/site.dev.error.log; | |
access_log logs/site.dev.access.log; | |
##### 第一个必选规则: 匹配首页 |
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
# link https://github.com/humbug/box/blob/master/Makefile | |
#SHELL = /bin/sh | |
.DEFAULT_GOAL := help | |
# 每行命令之前必须有一个tab键。如果想用其他键,可以用内置变量.RECIPEPREFIX 声明 | |
# mac 下这条声明 没起作用 !! | |
.RECIPEPREFIX = > | |
.PHONY: all usage help clean | |
# 需要注意的是,每行命令在一个单独的shell中执行。这些Shell之间没有继承关系。 | |
# - 解决办法是将两行命令写在一行,中间用分号分隔。 |
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
"scripts": { | |
"analyze": [ | |
"@cs:check", | |
"@phpstan", | |
"@composer validate --strict" | |
], | |
"phpstan": [ | |
"wget -nc https://github.com/phpstan/phpstan/releases/download/0.9.1/phpstan.phar", | |
"chmod a+x phpstan.phar", | |
"./phpstan.phar analyse src tests --level=2 -c phpstan.neon --no-interaction --no-progress" |
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
<style> | |
[data-anchor-icon]::after { | |
content: attr(data-anchor-icon); | |
} | |
</style> | |
<div id="content-toc-box"> | |
<div class="title"><i class="fa fa-list"></i> 内容结构</div> | |
<div id="content-toc"></div> | |
</div> |
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
const baseUrl = 'xx.com/' | |
export default async(url = '', data = {}, type = 'GET', method = 'fetch') => { | |
type = type.toUpperCase(); | |
url = baseUrl + url; | |
if (type == 'GET') { | |
let dataStr = ''; //数据拼接字符串 | |
Object.keys(data).forEach(key => { | |
dataStr += key + '=' + data[key] + '&'; |
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
// @from http://www.cnblogs.com/kazetotori/p/6037940.html | |
// ajax函数的默认参数 | |
var ajaxOptions = { | |
url: '#', | |
method: 'GET', | |
async: true, | |
timeout: 0, | |
data: null, | |
dataType: 'text', | |
headers: {}, |
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
const extra = {} | |
// 密码检测密码强度 | |
extra.checkStrength = function (sValue) { | |
let modes = 0 | |
if (sValue.length < 1) return modes | |
// 正则表达式验证符合要求的 |