This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detect URLs in plain text and active them as HTML links | |
// created by Mindon <mindon@gmail.com> | |
// from <http://mindon.github.io> | |
// | |
// usage example: | |
// document.write( activateLinks("mindon@gmail.com from mindon.github.io") ); | |
// document.write(activateLinks('skip <a href="http://mindon.github.io">Mindon.IDEA</a>')) | |
(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var s = "a b c"; | |
s = s.replace(/ /g, ' '); // keep the text wrappable | |
// s = s.replace(/ /g, ' '); // failed to wrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.replaceAll = function(s, t) {return this.split(s).join(t)}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// usage | |
// var s = "This is a 非常长的字符串This is a 非常长的字符串This is a 非常长的字符串This is a 非常长的字符串"; | |
// document.write(s.limit(20)); | |
// character length | |
String.prototype.size = function() { | |
var s = this, n = 0; // [u4e00-u9fa5] chinese | |
if(s) n = s.replace(/[^\x00-\xff]/g, "**").length; | |
return n; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome://predictors - omnibox predictor stats (check 'Filter zero confidences') | |
chrome://net-internals#sockets - current socket pool status | |
chrome://net-internals#dns - Chrome's in-memory DNS cache | |
chrome://histograms/DNS - histograms of your DNS performance | |
chrome://dns - startup prefetch list and subresource host cache | |
http://www.igvita.com/2012/06/04/chrome-networking-dns-prefetch-and-tcp-preconnect/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ----------- simple sub/pub -------------- | |
* -- Author: Mindon Feng http://mindon.github.com | |
* -- Usage: | |
* BuPS.subscribe("event-string", function(data, cmd){}); | |
* BuPS.publish("event-string", data); | |
*/ | |
var BuPS={}, _DEBUG=false; | |
;(function(){ | |
var cmds = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(e,t,r,b){function n(){for(;d[0]&&"loaded"==d[0][f];)b&&b(d[0].src),c=d.shift(),c[o]=!i.parentNode.insertBefore(c,i)}for(var s,a,c,d=[],i=e.scripts[0],o="onreadystatechange",f="readyState";s=r.shift();)a=e.createElement(t),'async'in i?(a.async=!1,(b?a.onload=b:!0),e.head.appendChild(a)):i[f]?(d.push(a),a[o]=n):(window._j$c=b,e.write("<"+t+' src="'+s+'" defer'+(b?' onload="_j$c(this.src)"':'')+'></'+t+">")),a.src=s}(document,"script",[ | |
"http://code.jquery.com/jquery-1.9.1.min.js", | |
"http://www.slidesjs.com/js/jquery.slides.min.js" | |
], function(e){ | |
var src = typeof e=='string'? e: this.src; | |
console.log(src); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> | |
<meta name="Author" content="mindon@gmail.com"> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | |
<meta name="format-detection" content="telphone=no, email=no" /> | |
<meta name="HandheldFriendly" content="true"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;// to launch mobile app | |
var insideWeChat = typeof window.WeixinJSBridge == "object"; | |
var isMobileDevice = 'ontouchstart' in window || /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB10|IEMobile|Opera Mini/i.test(navigator.userAgent); | |
;(function(document, window){ // | |
var ua = navigator.userAgent; | |
var tid, callfn, duration = 1300; | |
function bind(el, en, fn, useCapture){ | |
el.addEventListener ? el.addEventListener(en, fn, useCapture||false): (el.attachEvent ? el.attachEvent('on'+en, fn) : el['on'+en]=fn); | |
} | |
function unbind(el, en, fn, useCapture){ |
OlderNewer