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
| const compose = (...args) => initData => args.reduceRight((value,item) => item(value), initData); |
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
| const memoize = function(f) { | |
| const cache = {}; | |
| return (...arg) => { | |
| const arg_str = JSON.stringify(arg); | |
| cache[arg_str] = cache[arg_str] || f(...arg); | |
| return cache[arg_str]; | |
| }; | |
| }; |
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
| <html> | |
| <body> | |
| <script> | |
| // @author: ideawu | |
| // @link: http://www.ideawu.net/blog/archives/1021.html | |
| var swap_count = 0; | |
| var cmp_count = 0; | |
| // https://gist.github.com/wintercn/c30464ed3732ee839c3eeed316d73253 | |
| function wintercn_qsort(arr, start, end){ |
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 arr=["www.ifeng.com/index","news.ifeng.com/index","news.ifeng.com/mainland/index","ent.ifeng.com","news.ifeng.com/mil/index","news.ifeng.com/mil/","news.ifeng.com/mil/special/fzlfm/index"]; | |
| var item; | |
| var result = []; | |
| var current; | |
| var path; | |
| var hasIt; | |
| var index; | |
| current = result; | |
| for (var i = 0, iLen = arr.length; i < iLen; i++) { |
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
| // method of getCookie | |
| function getCookie( name ) { | |
| var parts = document.cookie.split(name + "="); | |
| if (parts.length == 2) return parts.pop().split(";").shift(); | |
| } | |
| function expireCookie( cName ) { | |
| document.cookie = | |
| encodeURIComponent( cName ) + | |
| "=deleted; expires=" + |
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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <!--允许全屏--> | |
| <meta content="yes" name="apple-mobile-web-app-capable"/> | |
| <meta content="yes" name="apple-touch-fullscreen"/> | |
| <!--禁止电话号码和邮箱识别--> |
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:utf-8 -*- | |
| '写了一个简单的支持中文的正向最大匹配的机械分词,其它不用解释了,就几十行代码' | |
| '搜狗词库下载地址:http://vdisk.weibo.com/s/7RlE5' | |
| import string | |
| __dict = {} | |
| def load_dict(dict_file='words.dic'): | |
| '加载词库,把词库加载成一个key为首字符,value为相关词的列表的字典' |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>JSON-P Example</title> | |
| <script src="jsonp.js"></script> | |
| </head> | |
| <body> | |
| <h1>A simple JSON-P example</h1> | |
| <p>This is a Google Image Search.</p> | |
| <input id="q" /> |