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
import urllib2 | |
def xiami_decode(s): | |
s = s.strip() | |
if not s: | |
return False | |
result = [] | |
line = int(s[0]) | |
rows = len(s[1:]) / line | |
extra = len(s[1:]) % line |
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 decode(loca) { | |
var result = [], url = ""; | |
var line, rows, extra; | |
loca = loca.trim(); | |
if(loca === "") { | |
return ""; | |
} | |
line = Number(loca[0]); | |
rows = Math.floor((loca.length - 1) / line); | |
extra = (loca.length - 1) % line; |
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
storm-contrib | |
https://github.com/nathanmarz/storm-contrib | |
java doc | |
http://nathanmarz.github.com/storm/doc-0.8.1/index.html | |
implemention doc | |
https://github.com/nathanmarz/storm/wiki/Implementation-docs | |
trident | |
https://github.com/nathanmarz/storm/wiki/Trident-tutorial | |
使用者:支付宝、淘宝、阿里巴巴、twitter、groupon |
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 throttle( fn, time ) { | |
var t = 0; | |
return function() { | |
var args = arguments, ctx = this; | |
clearTimeout(t); | |
t = setTimeout( function() { | |
fn.apply( ctx, args ); | |
}, time ); | |
}; |
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
$filename = "myfile"; | |
if (file_exists($filename) && is_readable ($filename)) { | |
$fh= fopen($filename, "r"); | |
while (!feof($fh)) { | |
$line = fgets($fh); | |
echo $line; | |
} | |
fclose($fh); | |
} |
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
date('Y-m-d', strtotime("-2 weeks")) |
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
//exit program normally | |
exit; | |
exit(); | |
exit(0); | |
//exit with an error code | |
exit(1); | |
exit(0376); //octal | |
// 错误则退出 |
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__ 为函数名称 | |
function shutdown() { | |
echo 'Shutdown: ' . __FUNCTION__ . '()' . PHP_EOL; | |
} |
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
echo htmlentities($str); // 会将中文字符也转义 | |
echo htmlspecialchars($str); // 只转换一些特殊的html代码 | |
一般最好使用htmlspecialchars($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
empty($x) 等于 !isset($x) || !$x | |
!empty($x) 等于 isset($x) && $x |
OlderNewer