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
//调用idIncrement(“quizForm.quiz.questions[0].options[0].textContent” , "questions")的时候返回 | |
// quizForm.quiz.questions[1].options[0].textContent | |
//调用idIncrement(“quizForm.quiz.questions[0].options[0].textContent” , "options")的时候返回 | |
// quizForm.quiz.questions[0].options[1].textContent | |
function idIncrement(s,p){ | |
return s.replace(new RegExp('(' + p + '\\[)(\\d+)\\]'), function($a,$1,$2){ | |
return $1 + ((parseInt($2, 10) || 0) + 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
local function base (digit_list) | |
local b = #digit_list | |
if b == 0 then | |
return function(number) return "" end | |
elseif b == 1 then | |
local mark = digit_list[1] | |
return function(number) | |
return string.rep(mark, number) | |
end | |
else |
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
"abc" | |
<?= 124 ?> | |
<?= a ?> | |
<? local x = 12 | |
if math.random(1, 5) > 1 then ?> | |
xxx | |
<? else ?> | |
yyy | |
<? end ?> |
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 args = {}; | |
(location.search || '').replace(/^\?/, '').replace(/([^&=]*)(?:=([^&]*))?/g, function(m, k, v) { | |
if (v) { | |
args[k] = decodeURIComponent(v); | |
} | |
return ''; | |
}); |
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
# convert datetime to unix_timestamp | |
import datetime, time | |
now = datetime.datetime.now() | |
ts = time.mktime(time.strptime(now.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) | |
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
events { | |
worker_connections 1024; | |
} | |
http { | |
upstream xx { | |
server 127.0.0.1:8003; | |
server 127.0.0.1:8003; | |
} | |
server { |
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
" mysql中增加一数据库,名为nginx,编码为utf8 | |
" 增加一表,名为 uploadfile 结构为 | |
CREATE TABLE `uploadfile` ( | |
`id` int(20) NOT NULL AUTO_INCREMENT, | |
`filehash` varchar(50) DEFAULT NULL, | |
`filename` varchar(100) DEFAULT NULL, | |
`filelen` varchar(50) DEFAULT NULL, | |
`contenthash` varchar(80) DEFAULT NULL, | |
PRIMARY KEY (`id`) |
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
# default to '~' | |
xconf { | |
echo '[~~['; | |
echo \[~~[''xx; | |
content_by_lua [~~[ | |
ngx.say'hello!' | |
]~~]; |
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
# http://douban.fm/ 边听边寸,这样下次可以本机听了。 | |
# nginx.conf | |
server { | |
listen 80; | |
server_name .douban.com; | |
root /mp3_douban; | |
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
upstream cluster { | |
# simple round-robin | |
server 127.0.0.1:10002; | |
server 127.0.0.1:10003; | |
check interval=1000 rise=2 fall=5 timeout=500 type=http; | |
check_http_send "GET /status HTTP/1.0\r\n\r\n"; | |
check_http_expect_alive http_2xx http_3xx; | |
} | |
server { |
OlderNewer