Skip to content

Instantly share code, notes, and snippets.

@laomo
laomo / Share.java
Last active December 11, 2015 22:39
完美实现同时分享图片和文字(Intent.ACTION_SEND)
private void share(String content, Uri uri){
Intent shareIntent = new Intent(Intent.ACTION_SEND);
if(uri!=null){
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/*");
//当用户选择短信时使用sms_body取得文字
shareIntent.putExtra("sms_body", content);
}else{
shareIntent.setType("text/plain");
}
@laomo
laomo / configvimforpython.sh
Last active December 16, 2015 03:38
auto config vim for python
#!/bin/bash
#######################################################################################
# auto config vim for python
# author : laomo(lmbj.net)
# date : 2013-4-12
# form https://github.com/gmarik/vundle and https://github.com/fisadev/fisa-vim-config
#######################################################################################
# get vim plugin manager Vundle
// ==UserScript==
// @name Search BaiduYun for Douban
// @namespace http://lmbj.net
// @description 在豆瓣页面右上角显示百度云中相关的资源,修改自Chrome插件豆瓣+百度网盘™:http://t.cn/z8XPRJh
// @include http://*.douban.com/subject/*
// @grant GM_xmlhttpRequest
// @updateURL https://userscripts.org/scripts/source/177423.meta.js
// @downloadURL https://userscripts.org/scripts/source/177423.user.js
// @version 0.2
// ==/UserScript==
@laomo
laomo / baidu-suixin-huantai.user.js
Last active December 22, 2015 15:49
百度随心听的换台太恶心了,能换的台都是一个大类,当我想听Ta的电台时,比如“董贞”~~!必须去百度音乐里搜索,然后点击“收听Ta的电台”,这个脚本就是要解决这个问题,可以在 http://fm.baidu.com/ 页面直接换台,输入想听的电台,回车或点击随心换台即可
// ==UserScript==
// @name 百度随心换台
// @namespace http://lmbj.net
// @description 百度随心听的换台太恶心了,能换的台都是一个大类,当我想听Ta的电台时,比如“董贞”~~!必须去百度音乐里搜索,然后点击“收听Ta的电台”,这个脚本就是要解决这个问题,可以在http://fm.baidu.com/页面直接换台,输入想听的电台回车或点击随心换台即可
// @include http://fm.baidu.com/
// @grant GM_xmlhttpRequest
// @updateURL https://userscripts.org/scripts/source/177480.meta.js
// @downloadURL https://userscripts.org/scripts/source/177480.user.js
// @version 0.3
// ==/UserScript==
@laomo
laomo / v2ex-reply-helper.user.js
Created September 25, 2013 02:15
V2EX回复@助手 输入@即可自动提示可以回复的ID,方向键可以选择,回车即完成输入
// ==UserScript==
// @name V2EX回复@助手
// @namespace http://lmbj.net
// @description V2EX回复@助手 输入@即可自动提示可以回复的ID,方向键可以选择,回车即完成输入
// @include http://www.v2ex.com/t/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require http://jquery-sew.s3-website-us-east-1.amazonaws.com/jquery.sew.js
// @require http://jquery-sew.s3-website-us-east-1.amazonaws.com/jquery.caretposition.js
// @updateURL https://userscripts.org/scripts/source/178530.meta.js
// @downloadURL https://userscripts.org/scripts/source/178530.user.js
@laomo
laomo / shorten.js
Created November 27, 2013 07:43
新浪短链接生成js版
var url_shorten = "http://api.weibo.com/2/short_url/shorten.json";
function ltrim(str){ //删除左边的空格
return str.replace(/(^\s*)/g,"");
}
function rtrim(str){ //删除右边的空格
return str.replace(/(\s*$)/g,"");
}
function trim(str){ //删除左右两端的空格
@laomo
laomo / V2EXSearch.user.js
Last active December 29, 2015 12:49
V2EX搜索 当前的搜索基于v2ex.com,所以由于子域名比较多,搜索记录会有很多重复。修改搜索基于当前访问的子域名,保证不重复。
// ==UserScript==
// @name V2EX搜索
// @namespace http://lmbj.net
// @description 当前的搜索基于v2ex.com,所以由于子域名比较多,搜索记录会有很多重复。修改搜索基于当前访问的子域名,保证不重复。
// @include http://www.v2ex.com/*
// @version 0.2
// ==/UserScript==
dispatch = function() {
var q = document.getElementById("q");
if (q.value != "") {
data:text/html,<body contenteditable style=font-family:monospace>
@laomo
laomo / boinc_for_wcg.sh
Last active December 31, 2015 11:59
为WCG做贡献(攒Ripple的XRP)自动化脚本
#/bin/bash
# Author : laomo
# Donate Address : https://ripple.com//send?to=rQKFznLaiyT55YXSS33fE6NgTjKbrnN4gT
sudo apt-get update
sudo apt-get install libxss1 libstdc++5 ia32-libs freeglut3
#optional(for see the tasks)
sudo apt-get install htop
wget http://boinc.berkeley.edu/dl/boinc_7.2.33_x86_64-pc-linux-gnu.sh
@laomo
laomo / jquery.min.js
Last active June 8, 2016 12:42
生成当前页面url的二维码,供手机扫描访问或分享
/*! jQuery v2.1.1-rc2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1-rc2",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a