Skip to content

Instantly share code, notes, and snippets.

View gongpeione's full-sized avatar

Geeku gongpeione

View GitHub Profile
@gongpeione
gongpeione / AllSets.js
Last active March 6, 2018 07:30
AllSets
function allSets (arr) {
const target = Math.pow(2, arr.length) - 1;
const all = [];
for (let i = 1; i <= target; i++) {
all.push(Array.from({length: arr.length}, (v, index) => i & (1 << index) ? arr[index] : null).filter(v => arr.indexOf(v) > -1));
}
console.log(all);
}
function allSetsRec (arr, index, set, all) {
@gongpeione
gongpeione / getWeiboDataBack.js
Last active April 4, 2024 07:51
微博炸号找回部分内容
/**
* 1 打开 https://m.weibo.cn/beta 登陆你被炸的账号
* 2 打开浏览器控制台
**/
function delay (time) {
return new Promise(r => {
setTimeout(() => r(), time || 1000); // 延时 1s,可适当增加延长时间
});
}
<style>
header, footer, main {
display: block;
}
header {
position: fixed;
height: 50px;
left: 0;
right: 0;
@gongpeione
gongpeione / getStringTemplateVariables.ts
Last active May 4, 2022 09:27
Get string template variables
// if you have a object like this
// {
// tpl1: `Hello {name}, welcome to {location}`,
// tpl2: `yo {bro}`,
// }
// and you wanna get a type like this
// {
// name: string,
// location: string,
// bro: string