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 | |
/** | |
* | |
* @authors imzhi (yxz_blue@126.com) | |
* @date 2015-08-18 19:35:20 | |
* @version $Id$ | |
*/ | |
function test($n = 0) { | |
$arr = []; |
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 | |
// UUID百度百科<http://baike.baidu.com/view/1052579.htm> | |
// 8-4-4-4-12 | |
function create_uuid() | |
{ | |
$str = md5(uniqid('', true)); | |
return preg_replace('/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/', '$1-$2-$3-$4-$5', $str); | |
} |
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
# Preview: http://jsbin.com/bijag | |
c = document.getElementById('c') | |
ctx = c.getContext('2d') | |
# full screen | |
c.height = window.innerHeight | |
c.width = window.innerWidth | |
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
(function(exports) { | |
'use strict'; | |
var Slider = React.createClass({ | |
getDefaultProps: function() { | |
return { | |
redVal: '', | |
greenVal: '', | |
blueVal: '' |
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
<html> | |
<head> | |
<title>Test</title> | |
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
<script src="http://fb.me/react-0.5.1.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script> | |
</head> |
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
function ajax(opts) { | |
var options = { | |
type: opts.type || 'get', | |
url: opts.url, | |
data: opts.data || '', | |
success: opts.success | |
}; | |
if (!options.url) { | |
alert('报错'); |
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
DROP FUNCTION `test`.`rand_str`; | |
SET GLOBAL log_bin_trust_function_creators=TRUE; | |
DELIMITER $$ | |
CREATE | |
/*[DEFINER = { user | CURRENT_USER }]*/ | |
FUNCTION `test`.`rand_str`(n INT UNSIGNED) | |
RETURNS VARCHAR(2000) |
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
var pad_str = (function(arr) { // 数组缓存补齐的0个数,空间换时间 <http://www.cnblogs.com/bluedream2009/archive/2009/09/08/1562910.html> | |
// num 要补0的数字 n 需补齐到多少位 | |
return function(num, n) { | |
var pad_len = (n - ('' + num).length); | |
return pad_len > 0 ? (arr[pad_len] || ( arr[pad_len] = Array(pad_len+1).join('0') )) + num | |
: num; | |
}; | |
})([]); |
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
1 普通匹配,遵循最长匹配规则,假设一个请求匹配到了两个普通规则,则选择匹配长度大的那个 | |
例如: | |
location /{ | |
[matches] | |
} | |
location /test{ | |
[matches] | |
} | |
2 精确匹配 | |
location = /{ |
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
// ==UserScript== | |
// @name 复制替换空格 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1.0 | |
// @description Hello World! | |
// @author Xiaozhi | |
// @match http://*/* | |
// @grant none | |
// @require http://cdn.bootcss.com/jquery/2.2.3/jquery.js | |
// ==/UserScript== |