Skip to content

Instantly share code, notes, and snippets.

@rming
rming / jQuery-plugin-authoring.md
Created May 23, 2018 07:03 — forked from quexer/jQuery-plugin-authoring.md
如何编写 jQuery 插件

创建插件


看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。

开始

@rming
rming / dau.sh
Last active January 24, 2018 05:19
#!/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=""
@rming
rming / Unicode中文和特殊字符的编码范围
Created October 25, 2017 10:32 — forked from shingchi/Unicode中文和特殊字符的编码范围
Unicode中文和特殊字符的编码范围
根据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
@rming
rming / centos-6-chinese-shell
Created August 9, 2017 10:51
centos-6-chinese-shell
1.查看系统支持的字符集
# locale -a
2.更改系统支持的字符集支持
# vi /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SUPPORTED="zh_CN.UTF-8:zh_CN:zh"
@rming
rming / How-to-clear-the-local-DNS-cache
Last active August 4, 2017 07:47
How to clear the local DNS cache
#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
@rming
rming / 1) Install
Created July 31, 2017 08:27 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
// --- 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
@rming
rming / Singleton.php
Created July 21, 2017 02:38
php Singleton
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();
}
<?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;
<?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;
}
@rming
rming / whoami
Created June 9, 2017 07:24
php后期静态绑定
<?php
class A {
public static $name = null;
public static function whoami() {
if (!static::$name) {
static::$name = get_called_class();
}
return static::$name;
}
}