Skip to content

Instantly share code, notes, and snippets.

View g8up's full-sized avatar
💭
Stay Hungry

g8up g8up

💭
Stay Hungry
View GitHub Profile
@g8up
g8up / waitForElement.js
Last active August 28, 2023 11:40
轮询检测页面节点
<!DOCTYPE html>
<html lang="zh-cmn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>死宅程序员</title>
<!-- 配套视频讲解:https://www.bilibili.com/video/BV1b94y1z74s/ -->
</head>
<body>
<script>
@g8up
g8up / forEachAsync.js
Created August 18, 2023 17:40
async run forEach and get results
const forEachAsync = async (arr, handler, isSerial = true) => {
if( isSerial ) {
const result = [];
return arr.reduce((acc, val) => {
return acc.then(()=>handler(val))
.then(ret=>{
result.push(ret);
return ret;
});
/**
* chrome-extension://aimiinbnnkboelefkjlenlgimcabobli/assets/css-editor.html
*/
body {
background: #3c4c55; /* VSCode bg color*/
color: #ddd;
white-space: pre;
font-family: monospace;
}
@g8up
g8up / plist2json.py
Created July 21, 2017 05:18
convert plist to json
# @file plist2json.py
# @desc convert plist to json
# @usage >python plist2json.py FILE_NAME
# @test under python v2.7
# @author g8up
# @date 2017.7.21
import sys
import json
from plistlib import readPlist
@g8up
g8up / go_to_file.py
Created June 3, 2017 07:05
SublimeText3 增强:自动填充已选文本到`Ctrl + P`面板
# 增强 Ctrl + P 快捷键功能
# 当选择一个资源路径,并按 Ctrl + P 时,可自动将选择文本填充到面板,
# 你只需回车即可直接跳转到文件
# 配置:
# 1、Preferences -> Key Bindings 添加:
#
# [{
# "keys": ["ctrl+p"],
# "command": "show_goto_overlay_with_selection"
# }]
@g8up
g8up / GoToFisProjectRoot.py
Created June 3, 2017 06:48
FIS 工程周边 SublimeText3 插件
# SublimeText3 Plugin Doc:http://www.sublimetext.com/docs/3/api_reference.html
# python doc: http://www.runoob.com/python/python-tutorial.html
# 给右键菜单提供一个命令,点击弹出 cmd 并切换目录到 fis 工程根目录
# 配合描述文件 Context.sublime-menu,内容如下
# [{
# "caption": "FisProjectRoot",
# "command": "go_to_fis_project_root"
# }]
@g8up
g8up / Hex2Float.js
Created February 14, 2017 04:20
把一个 8位 HEX 字符串转换为浮点数
// 解码:把一个 8位 HEX 字符串转换为浮点数
function Hex2Float( numStr ) {
return new Float32Array(new Uint8Array( numStr.match(/.{1,2}/g).map( function( num ) {
return parseInt( num, 16 );
}).reverse() ).buffer )[0];
};
// test
Hex2Float("BB4E28DE");//-0.003145746421068907
@g8up
g8up / Douyu.welcome-reminding.js
Last active December 31, 2018 09:02
自动语音提醒进入斗鱼房间的观众
javascript: void ((function () {
/**
* 功能:斗鱼自动弹幕语音朗读
* 用法:需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)
* 版本:v2.0.0
* 日期:2017年12月30日 17:28:17
* 更新:2018年12月31日 16:32:25
*/
const speaker = (word, rate = 1) => {
if (word !== '') {
@g8up
g8up / Sortor.js
Last active September 25, 2019 18:39
让直播房间页面按访问量降序排列(目前支持斗鱼、熊猫、战旗)
javascript: void ((function () {
/*
* 直播房间排序 V2.1.1
* 功能:让直播房间页面按访问量降序排列(目前支持斗鱼、熊猫、战旗)
* 需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)
* 更新时间:2019年9月26日02:38:23,修复斗鱼平台
*/
function Sortor($container, getPeopleNumFn) {
this.$container = $container;
this.rooms = $container.find('li');
@g8up
g8up / panda.sort.js
Last active December 19, 2016 15:00
熊猫找福利 V1.0.0
javascript: void((function () {
/**
* 熊猫找福利 V1.0.1
* 日期:2016-12-19 22:59:24
* 用途:让熊猫 TV 房间列表页面按在线人数降序排列
* 需要[制作成 Chrome 书签](http://pan.baidu.com/s/1skgEosX)。
*/
if (window.location.host.indexOf('panda') < 0) {
window.location.href = 'http://www.panda.tv/cate/lol';
}