CentOS 7 32bit 下载

没错,虽然RHEL7只有64位,但CentOS 7还编译了一份32位的版本,但不在通常的镜像站,只能从官方的altarch目录下载:

http://mirror.centos.org/altarch/7/isos/i386/

JavaScript获取函数参数列表

参考了网上别人写的代码,大致是这样的:

function getArgNames(fn) {
    if (typeof(fn)==='function') {
        return fn.toString().match(/function\s*\w+\(\s*([^)]*)\)/)[1].replace(/\/\*.*?\*\/|\/\/[^\r\n]*(?:[\r\n]+|$)|\s+$/g,'').split(/\s*,\s*/);
    }
}

主要思路是调用Function.prototype.toString()获取函数的定义字符串,然后提取其中的参数列表,去除其中的注释和多余的空白,最后将他们按逗号分隔到数组里。

批量对某个目录下的git版本库执行相同操作

使用脚本git-each-repo很容易做到,它是基于bash的脚本
例如,要pull目录下的所有repo的版本库,只需

cd /path/to/base/dir
git-each-repo pull
#或者
git-each-repo -d /path/to/base/dir pull

获取最新版本:

国外

https://github.com/mjpclab/Shell-Utility/blob/master/bin/git-each-repo

国内:

https://gitee.com/mjpclab/Shell-Utility/blob/master/bin/git-each-repo

Google Chrome Stable for Windows最新版本下载

注意下载地址长期不变,但下到的始终是当前最新的Stable版。

32位:

https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BCEC27557-0338-A6BE-F10F-A625517C44BB%7D%26lang%3Dzh-CN%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue/update2/installers/ChromeStandaloneSetup.exe

64位:

https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BCEC27557-0338-A6BE-F10F-A625517C44BB%7D%26lang%3Dzh-CN%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue%26ap%3Dx64-stable%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeStandaloneSetup64.exe

wget https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BCEC27557-0338-A6BE-F10F-A625517C44BB%7D%26lang%3Dzh-CN%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue%26ap%3Dx64-stable%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeStandaloneSetup64.exe https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7BCEC27557-0338-A6BE-F10F-A625517C44BB%7D%26lang%3Dzh-CN%26browser%3D3%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue/update2/installers/ChromeStandaloneSetup.exe

PHP:支持中文(非英文)的basename()函数

查了下原生php的basename()好像并不能处理中文文件名,所以查到网上有人给出了如下自定义函数:

function get_basename($filename){
    return preg_replace('/^.+[\\\\\\/]/', '', $filename);   //我觉得正则可以写为'/^.+[\\/]/'
}

对于该函数有3点需要说明:
1. 不能处理以”/”结尾的目录名;
2. 不支持第二个参数suffix;
3. 正则表达式比较消耗系统资源。
因此,我给出了仅使用字符串处理函数的版本,弥补以上3点缺陷:

function get_basename($filename,$suffix='') {
    $f=$filename;
    $f=rtrim($f,'/');

    $startPos=strrpos($f,'/');
    $startPos=($startPos !== FALSE) ? $startPos+1 : 0;
    $f=substr($f, $startPos);

    if(!empty($suffix)) {
        $filenameLen=strlen($f);
        $checkEndPos=$filenameLen-strlen($suffix);
        if(substr($f,$checkEndPos)===$suffix) {
            $f=substr($f,0,$checkEndPos);
        }   
    }   

    return $f; 
}

[转发+推荐]深入图解字符集与字符集编码

深入图解字符集与字符集编码(一)——charset vs encoding

http://my.oschina.net/goldenshaw/blog/304493

深入图解字符集与字符集编码(二)——字符集及其编号

http://my.oschina.net/goldenshaw/blog/305805

深入图解字符集与字符集编码(三)——定长与变长

http://my.oschina.net/goldenshaw/blog/307708

深入图解字符集与字符集编码(四)

http://my.oschina.net/goldenshaw/blog/310331

深入图解字符集与字符集编码(五)——Unicode的代码单元

http://my.oschina.net/goldenshaw/blog/311848