看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。
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
#!/bin/bash | |
LOG_DIR=/mnt/nas/backup_nginx_log/ | |
YMD=$1 | |
if [ ! -n "$YMD" -o ${#YMD} -ne 8 ]; then | |
echo -e "Usage:\n $0 [YMD] \n\n参数\n YMD 时间日期必须为 8 位数字\n\neg:\n $0 20180123" | |
exit | |
fi | |
FILES="" |
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
根据Unicode5.0整理如下: | |
1)标准CJK文字 | |
http://www.unicode.org/Public/UNIDATA/Unihan.html | |
2)全角ASCII、全角中英文标点、半宽片假名、半宽平假名、半宽韩文字母:FF00-FFEF | |
http://www.unicode.org/charts/PDF/UFF00.pdf | |
3)CJK部首补充:2E80-2EFF | |
http://www.unicode.org/charts/PDF/U2E80.pdf |
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.查看系统支持的字符集 | |
# locale -a | |
2.更改系统支持的字符集支持 | |
# vi /etc/sysconfig/i18n | |
LANG="en_US.UTF-8" | |
SUPPORTED="zh_CN.UTF-8:zh_CN:zh" |
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
#How to clear the local DNS cache | |
#macOS Sierra 10.12.0 | |
sudo killall -HUP mDNSResponder | |
#OSX 10.11.0 | |
sudo killall -HUP mDNSResponder | |
#OSX 10.10.4 | |
sudo killall -HUP mDNSResponder |
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
// --- Compiling --- | |
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
$ tar xzvf redis-2.8.3.tar.gz | |
$ cd redis-2.8.3 | |
$ make | |
$ make install | |
// --- or using yum --- | |
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |
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
abstract class Singleton | |
{ | |
private static $instances = array(); | |
protected function __construct() {} | |
public static function getInstance() | |
{ | |
$class = get_called_class(); | |
if (!isset(self::$instances[$class])) { | |
self::$instances[$class] = new static(); | |
} |
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 | |
class redisFileCacheHandler | |
{ | |
private static $_instance = null; | |
private static $cacheDir = "filecache:"; | |
protected $redisWrite = null; | |
public static function getInstance() | |
{ | |
if (!static::$_instance) { | |
static::$_instance = new static; |
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 | |
class fileCacheHandler | |
{ | |
private static $_instance = null; | |
private static $cacheDir = "/dev/shm/cache_file/"; | |
public static function getInstance() | |
{ | |
if (!static::$_instance) { | |
static::$_instance = new static; | |
} |
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 | |
class A { | |
public static $name = null; | |
public static function whoami() { | |
if (!static::$name) { | |
static::$name = get_called_class(); | |
} | |
return static::$name; | |
} | |
} |