Skip to content

Instantly share code, notes, and snippets.

@bianle
bianle / git-override.sh
Created June 6, 2016 04:06
git 覆盖更新
git fetch --all
git reset --hard origin/master
  • 安装
wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod a+rx speedtest_cli.py
sudo mv speedtest_cli.py /usr/local/bin/speedtest-cli
sudo chown root:root /usr/local/bin/speedtest-cli
  • 使用
speedtest-cli
@bianle
bianle / list2Tree.md
Created May 25, 2016 01:32
list封装成树形Bean

原理很简单:人群(list)中每个人依次在该人群中找爹(for嵌套),找到为止(break)。

list 形如 :

|id  |pid  |name  |
|1   |     |1     |
|11  |1    |1-1   |
|111 |11   |1-1-1 |
|2   |     |2     |
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
// http://ejohn.org/blog/javascript-micro-templating/
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
@bianle
bianle / compare-version.js
Created March 11, 2016 01:24
比较版本号js
function cmpVersions (a, b) { var i, l, diff, segmentsA, segmentsB; segmentsA = a.replace(/(\.0+)+$/, '').split('.'); segmentsB = b.replace(/(\.0+)+$/, '').split('.'); l = Math.min(segmentsA.length, segmentsB.length); for (i = 0; i < l; i++) { diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10); if (diff !== 0) { return diff; } } return segmentsA.length - segmentsB.length; }
@bianle
bianle / share.html
Created February 24, 2016 01:22
html
QQ空间分享代码如下:
<a href="javascript:void(0);" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent('http://baidu.com'));return false;" title="分享到QQ空间"><img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/app_share/qz_logo.png" alt="分享到QQ空间" /></a>
新浪微博分享代码如下:
1.
<iframe frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?url=http%3A%2F%2Fbaidu.com&appkey=&type=3" width="16" height="16"></iframe>
2.
<a href="http://v.t.sina.com.cn/share/share.php?title=%E4%BD%A0%E5%A5%BD%20hello%20world" target="_blank">分享到微博</a>
腾讯微博分享代码如下:
@bianle
bianle / share.html
Created February 24, 2016 01:20
html
QQ空间分享代码如下:
<a href="javascript:void(0);" onclick="window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent('http://baidu.com'));return false;" title="分享到QQ空间"><img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/app_share/qz_logo.png" alt="分享到QQ空间" /></a>
新浪微博分享代码如下:
1.
<iframe frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?url=http%3A%2F%2Fbaidu.com&appkey=&type=3" width="16" height="16"></iframe>
2.
<a href="http://v.t.sina.com.cn/share/share.php?title=%E4%BD%A0%E5%A5%BD%20hello%20world" target="_blank">分享到微博</a>
腾讯微博分享代码如下:
@bianle
bianle / mybatis.pom.xml
Last active January 29, 2016 08:10
pom.xml
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.2</version>
</dependency>
<!-- ***可选***:集成spring需要 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
@bianle
bianle / hotkey.md
Last active May 27, 2016 03:55
eclipse 快捷键
  • Alt+Shift+a //矩形选框
  • Alt+Shift+r //批量修改变量
@bianle
bianle / spring.web.xml
Last active January 29, 2016 08:01
web.xml
<!-- spring -->
<!--contextConfigLocation在 ContextLoaderListener类中的默认值是 /WEB-INF/applicationContext.xml -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
<!-- <param-value>classpath:applicationContext*.xml</param-value> -->
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener