Skip to content

Instantly share code, notes, and snippets.

View gongpeione's full-sized avatar

Geeku gongpeione

View GitHub Profile
@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
<style>
header, footer, main {
display: block;
}
header {
position: fixed;
height: 50px;
left: 0;
right: 0;
@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,可适当增加延长时间
});
}
@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 / githubOAuth.php
Last active May 26, 2017 08:51
Github OAuth PHP
<?php
// error_reporting(E_ALL);
$code = $_GET['code'];
$token = $_COOKIE['access_token'];
if (!empty($code)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://github.com/login/oauth/access_token");
curl_setopt($ch, CURLOPT_POST, 1);
https://gist.github.com/gongpeione.atom
@gongpeione
gongpeione / gist.js
Created July 18, 2016 08:26
event trigger
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
@gongpeione
gongpeione / broswerFontOptimize
Created December 3, 2015 06:34
broswerFontOptimize
html {
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
@gongpeione
gongpeione / pointer-events
Last active August 29, 2015 14:27
pointer-events
pointer-events: none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='your_transparent.png', sizingMethod='scale');
background: none !important;
@gongpeione
gongpeione / tempTable
Created July 14, 2015 10:02
create temporary table with tables name
SELECT *
FROM
(
SELECT *, 'cdk_record_07' as tableName FROM cdk_record_07
UNION ALL
SELECT *, 'cdk_record_01' as tableName FROM cdk_record_01
) s