This file contains hidden or 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 debug = config.debug ? console.log.bind(console) : function() {}; | |
/** | |
* 简易模板 | |
* @param {String} tpl 包含 {name} 的数据 | |
* @param {Object} data 包含 name 的对象 | |
* @return {String} 替换后的字符串 | |
*/ | |
function nano(tpl, data) { | |
return tpl.replace(/\{([\w\.]*)\}/g, function(str, key) { |
This file contains hidden or 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 startDownload = function(data, filename) { | |
var blob = new Blob([data], { | |
type: 'application/octet-stream' | |
}); | |
var url = window.URL.createObjectURL(blob); | |
var saveas = document.createElement('a'); | |
saveas.href = url; | |
saveas.style.display = 'none'; | |
document.body.appendChild(saveas); | |
saveas.download = filename; |
This file contains hidden or 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
/*jslint undef: true, nomen: true, eqeqeq: true, plusplus: true, newcap: true, immed: true, browser: true, devel: true, passfail: false */ | |
/*global window: false, readConvertLinksToFootnotes: false, readStyle: false, readSize: false, readMargin: false, Typekit: false, ActiveXObject: false */ | |
var dbg = (typeof console !== 'undefined') ? function(s) { | |
console.log("Readability: " + s); | |
} : function() {}; | |
/* | |
* Readability. An Arc90 Lab Experiment. | |
* Website: http://lab.arc90.com/experiments/readability |
This file contains hidden or 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
# -*- coding: gbk -*- | |
# 2.如遇到 UnicodeEncodeError: 'ascii' codec can't encode characters in position 22-25: ordinal not in range(128) | |
# 增加如下3行 | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
from pyquery import PyQuery as pq | |
This file contains hidden or 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
def getPinyinFirst(str): | |
pyt = "ydkqsx wzssxjbymgcczqpssqbycdscdqldylybssjgyqzjjfgcclzz wdwzjljpfyyn jjtmy zwzhflzppqhgccyy mjqyxxgd s sjnj s ml rxyfsng qzggllyjl yzssecykyyhqwjssggyxyqyjtwktjhychm xjtlhjyqbyxdldwrrj wysrldzjpcbzjjbrcfsl czstzfxxchtrqggddlyccssymmrjcyqzpwwjjyfcrwfdfzqpyddwyxkyjawjffxjbcftzyhhycyswzcyxsclcxxwzcxnbgnnxbxlzsqsbsjpysazdhmdzbqbscwdzzyytzhbtsyyfzgntnxjywq k phhlxgybfmjnbjhhgqtjcysxstkzglyckglysmzxyalmeldccxgzyrjxjzl jzcqkcnnjwhjczccqljststbnhbtyxceqxkkwjyflzqlyhjxspsfxlmpbysxxxytcc ylllsjxfhjxpjbtffyabyxbcczbzyclwlczggbtssmdtjcxpthyqtgjjxcjfzkjzjqnlzwlslhdzbwjncjzyzsq ycqynzcjjwybrtwpyftwexcskdzctbyhyzqyyjxzcfbzzmjyxxsdczottbzljwfckscsxfyrlrygmbdthjxsqjccsbxyytswfbjdzt bcnzlcyzzpsacyzzsqqcshzqydxlbpjllmqxqydzxsqjtzpxlcglqdcwzfhctdjjsfxjejjtlbgxsxjmyjjqpfzasyjnsydjxkjcdjsz bartcclnjqmwnqnclllkbdbzzsyhqcltwlccrshllzntylnewyzyxczxxgdkdmtcedejtsyyssdqdfmxdbjlkrwnqlybglx lgtgxbqjdz yjsjyjcjmrnymgrcjczgjmzmgxmmryxkjnymsgmzzymk fxmbdtgfbhcjhkylpfmdxlxjjsmsqgzsjlqdldgjycalcmzcsdjl |