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 | |
# A lightweight file system lib in php | |
# by @leaskh | |
class libFileSystem { | |
public function checkPath($path) { | |
return $path === '/' || $path === '~'; | |
} |
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
#!/usr/bin/env php | |
<?php | |
// by @leaskh | |
// config | |
error_reporting(E_ALL ^ E_NOTICE); | |
$binFolder = 'bin'; |
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 | |
/** | |
* Get either a Gravatar URL or complete image tag for a specified email address. | |
* | |
* @param string $email The email address | |
* @param string $s Size in pixels, defaults to 80px [ 1 - 2048 ] | |
* @param string $d Default imageset to use [ 404 | mm | identicon | monsterid | wavatar ] | |
* @param string $r Maximum rating (inclusive) [ g | pg | r | x ] | |
* @param boole $img True to return a complete IMG tag False for just the URL |
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
<a href="<?php echo preg_match('/Macintosh/', $_SERVER['HTTP_USER_AGENT']) ? 'imessage' : 'sms'; ?>:[email protected]">iMessage me!</a> |
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 | |
/** | |
* Replacing URLs | |
* @param: string. | |
* @return: string. | |
*/ | |
function ParseURL($str) { | |
return preg_replace([ | |
"/(?<=[^\]A-Za-z0-9-=\"'\\/])(https?|ftp|gopher|news|telnet|mms){1}:\/\/([A-Za-z0-9\/\-_+=.~!%@?#%&;:$\\()|]+)/is", |
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 | |
/** | |
* 常规遍历方法 | |
* 常规遍历方法是指从PHP4开始就可以使用的方法,它是结合使用opendir()函数和readdir()函数,通过打开目录,读取目录和关闭目录,逐一判断列出所有的文件。 | |
* @param string $dir 路径名 | |
* @return array 所有文件的路径数组 | |
*/ | |
function get_files1($dir) { | |
$files = array(); |
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
(* | |
* Safari View Source in TextMate - v1.0 - 2/21/2010 | |
* http://benalman.com/projects/safari-view-source-in-textmate/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*) | |
tell application "Safari" |
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 | |
/* | |
@ PHP阳历到农历转换的一个类 | |
@ Cal函数 将阳历日期转换成阴历日期 | |
@ returnInput 返回输入的日期 | |
@ Recoded By Androidyue | |
*/ | |
class Calendar | |
{ | |
#农历每月的天数 |
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
set currentUser to long user name of (get system info) | |
set firstName to first word of currentUser | |
set lastName to last word of currentUser | |
set noteValues to {56, 56, 58, 56, 61, 60, 50, 56, 56, 58, 56, 63, 61, 50, 56, 56, 68, 65, 61, 60, 58, 50, 66, 66, 65, 61, 63, 61} -- F | |
-- set noteValues to {65, 65, 67, 65, 70, 69, 60, 65, 65, 67, 65, 72, 70, 60, 65, 65, 77, 74, 70, 69, 67, 60, 75, 75, 74, 70, 72, 70} -- D | |
-- set noteValues to {55, 55, 57, 55, 60, 59, 50, 55, 55, 57, 55, 62, 60, 50, 55, 55, 67, 64, 60, 59, 57, 50, 65, 65, 64, 60, 62, 60} -- E | |
set syllables to {"hap", "p", "birth", "day", "to", "you", "[[slnc 500]]", "hap", "p", "birth", "day", "to", "you", "[[slnc 500]]", "hap", "p", "birth", "day", "dear", firstName, lastName, "[[slnc 500]]", "hap", "p", "birth", "day", "to", "you"} |
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
// | |
// Suffix tree creation | |
// | |
// Mark Nelson, updated December, 2006 | |
// | |
// This code has been tested with Borland C++ and | |
// Microsoft Visual C++. | |
// | |
// This program asks you for a line of input, then | |
// creates the suffix tree corresponding to the given |