View reactive.js
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 compose (...funcs) { | |
if (funcs.length <= 0) { | |
return x => x | |
} | |
if (funcs.length === 1) { | |
return funcs[0] | |
} | |
const innerFunc = funcs[funcs.length - 1] | |
const restFunc = funcs.slice(0, -1) |
View countries.json
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
[ | |
{ | |
"ISO2": "AD", | |
"ISO3": "AND", | |
"DIGITS": "20", | |
"ISO-3166-2": "ISO 3166-2:AD", | |
"English": " Andorra", | |
"China": "安道尔", | |
"Taiwan": "安道爾", | |
"Hongkong": "安道爾", |
View promise-more.js
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
/** | |
* Like Promise.all but is always successful. | |
* @param {Array|Object} iterable | |
* @returns {Promise} A promise with an array of all the resolved/rejected results. null for rejection. | |
*/ | |
export const reflect = function reflect (iterable) { | |
if (!Array.isArray(iterable)) { | |
iterable = Array.from(iterable) | |
} |
View Drag&Drop.cmd
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
node %~dp0\index.js %* |
View mofun.js
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
$("#user_photo_upload").upload("/index.php?act=upload&mdl=upload&is_temp=1", function(ret) { | |
var ret_url = ret.url.replace('/', '\/'); | |
if (ret.status === 'ok') { | |
$.ajax({ | |
type: 'POST', | |
url: "/index.php?act=ajax&mdl=user_photo&func=user_photo_save", | |
data: { | |
"photo": { | |
"240x240_f": ret.filename, | |
"240x240_url": ret_url, |
View singletonify.js
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 singletonify(_Class) { | |
if (typeof singletonify.prototype._singletonifyInstances === 'undefined') { | |
singletonify.prototype._singletonifyInstances = []; | |
} | |
var _instances = singletonify.prototype._singletonifyInstances; | |
var _index = _instances.push(void(0)) - 1; | |
function genSingleton() { | |
if (typeof _instances[_index] !== 'undefined') { | |
return _instances[_index]; | |
} else { |
View weibo-hide.js
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() { | |
var mids = []; | |
var pageRecord = []; | |
var oldSearch = window.location.search; | |
var page = getPage(); | |
// 获得当前页码 | |
function getPage() { | |
return parseSearch().page; |
View count-letters.js
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 count(s) { | |
var r = s.split('') | |
.sort() | |
.join('') | |
.match(/(\w)\1*/g) | |
.sort(function(a,b) { | |
return a.length < b.length | |
}); | |
return { | |
letter: r[0], |
View lcstr.js
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
/** | |
* Bottom-up DP for longest common substring (not subsequence). | |
* Time: O(m*n) | |
* Space: O(min(m,n)) | |
* @author Jesse Wong (@straybugs) | |
*/ | |
function lcstr(sstr, lstr) { | |
'use strict'; |
View parseQueryString.js
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 parseQueryString(str){ | |
var pairs = str.replace(/^.*\?/, '').split('&'), | |
res = {}; | |
for (var i = pairs.length - 1; i > 0; i -= 1) { | |
var p = pairs[i].split('='); | |
res[p[0]] = p[1]; | |
} | |
return res; | |
} |
NewerOlder