批量对某个目录下的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

js分享到微博的简单URL

var title='分享标题'

var url=location.href;

var site = "示例网站";

var picUrls=['图片URL1', '图片URL2', '图片URL3'];



var sina_weibo = "http://v.t.sina.com.cn/share/share.php?title=" + encodeURIComponent(title) + "&url=" + url + "&pic=" + picUrls.join("||") + "&source=bookmark&appkey=&ralateUid=";


var tentcent_weibo = "http://share.v.t.qq.com/index.php?c=share&a=index&title=" + encodeURIComponent(title) + "&url=" + url + "&pic=" + picUrls.join("|") + "&site=" + site + "&appkey=";

var qzone = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=" + encodeURIComponent(title) + "&url=" + url + "&pics=" + picUrls.join("|") + "&summary=";

Google Chrome Stable for Linux最新版本下载

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

DEB包 RPM包
~~32位~~ ~~https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb~~ ~~https://dl.google.com/linux/direct/google-chrome-stable_current_i386.rpm~~
64位 https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

浏览器和元素的尺寸、位置有关的属性和方法

学习笔记,写的不是很全,兼容性尚未测试。

属性 作用 兼容性
screen.width
screen.heihgt
   
   
screen.availWidth
screen.availHeight
   
   
window.innerWidth
window.innerHeight
浏览器视口尺寸,去除浏览器菜单栏、工具栏、状态栏,但包含滚动条的尺寸,  
window.outerWidth
window.outerHeight
 浏览器窗口外边框尺寸  
 浏览器窗口外边框尺寸  
window.screenX
window.screenY
window.screenTop
window.screenLeft
窗口在屏幕中的位置  
window.scrollX
window.pageXOffset
window.scrollY
window.pageYOffset
文档滚动位置  
   
Element.getBoundingClientRect() 返回元素对应border-box方框到视口的偏移坐标,  
Element.getClientRects() 返回类数组,对以inline方式显示的元素来说,每行行框都是一个方框,返回所有这些方框到视口的偏移坐标,对显示为块级的元素来说,效果同getBoundingClientRect()  
document.elementFromPoint()  指定相对于视口的坐标,返回该坐标处的元素。如果有定位元素,返回z-index最大(最上层)的,否则返回该处在文档树中最深的节点元素。  
Element.offsetWidth
Element.offsetHeight
Element.offsetLeft
Element.offsetTop
元素滚动可见部分内容border-box的尺寸。offsetLeft, offsetTop返回到offsetParent的距离  
Element.offsetParent 偏移的上级参照元素  
Element.clientWidth
Element.clientHeight
Element.clientLeft
Element.clientTop
元素滚动可见部分内容padding-box(不含滚动条)的尺寸,对显示为inline的元素来说,始终返回0。clientLeft,
clientTop返回padding-box外边缘到border-box外边缘的距离,通常来说就是边框宽度。但对于从右到左书写的语言来说,垂直滚动条出现在padding-box左侧,所以client-left还包括了滚动条的宽度。
 
Element.scrollWidth
Element.scrollHeight
Element.scrollLeft
Element.scrollTop
padding-box滚动整体的尺寸。在没有内容溢出时,scrollWidth, scrollHeight和clientWidth, clientHeight是相等的。 scrollLeft, scrollTop为视口相对元素左上角的滚动偏移量,且为可写属性。  
window.scroll()
window.scrollTo()
   
window.scrollBy()    
Element.scrollIntoView()