Skip to content

Instantly share code, notes, and snippets.

View yangfch3's full-sized avatar
🎯
Focusing

Fucheng Yang yangfch3

🎯
Focusing
  • NetEase
  • Internet
View GitHub Profile
@yangfch3
yangfch3 / crawlDoubanBookInfo.js
Created September 13, 2018 01:13
[Chromeless 豆瓣数据抓取脚本] 以抓取一本书的猜你喜欢书籍列表信息为例 #crawl #douban
const {
Chromeless
} = require('chromeless')
const fs = require('fs')
const myConsole = console
const bookName = process.argv[2]
const bookInfoList = []
@yangfch3
yangfch3 / SoundManager.ts
Last active November 8, 2018 13:32
[白鹭声音管理器] 白鹭音频接口的封装 #白鹭 #游戏开发
class SoundManager {
private static instance: SoundManager
private static IS_MUTE_SYMBOL = 'isMute'
private static BGM_VOLUME = 'bgmVolume'
private static EFFECT_VOLUME = 'effectVolume'
static getInstance() {
if (!SoundManager.instance) {
new SoundManager()
@yangfch3
yangfch3 / cycle-await.js
Created August 18, 2018 03:17
循环与 async-await 搭配使用
/**
* 并行阻塞:
* 一同等待
* 一起爆发式
*/
var arr = [1,2,3]
arr.forEach(async function (value, index) {
await new Promise((resolve, reject) => {
setTimeout(function () {
resolve(true)
@yangfch3
yangfch3 / SceneManager.ts
Last active December 30, 2019 14:08
[白鹭场景管理] 快捷有序地进行白鹭场景的管理 #白鹭 #游戏开发
///<reference path="./utils/array.ts" />
/**
* 控制场景的切换
* 与 Main 协同工作
*/
class SceneManager {
private static instance: SceneManager = null
static getInstance() {
@yangfch3
yangfch3 / del-mess-mails.js
Last active July 20, 2018 01:59
快速删除QQ邮箱、QQ企业邮箱邮件
/**
* 点击收件箱,控制台运行代码,删除所有收件箱邮件
* 删除与某个账号的往来邮件:找到并打开与该账号的一封邮件,鼠标 hover 到收件人,点击往来邮件,然后运行下面的代码
*
* 根据网络情况,可以调节下方定时器的间隔
* (顺便发现一个 Bug: Chrome 67.0.3396.99 下 setTimeout 与 setInterval 内无法正常使用便捷选择器 $)
*/
setInterval(function () {
document.getElementById('mainFrame').contentDocument.getElementsByClassName('o_title2')[0].previousSibling.children[0].click();
document.getElementById('mainFrame').contentDocument.getElementById('quick_completelydel').click();
@yangfch3
yangfch3 / xmxx-algorithm.js
Created June 23, 2018 05:37
消灭星星类游戏核心算法
const GAME_CONSTS = {
BOARD_WIDTH: 10,
BOARD_HEIGHT: 10,
STAR_COLOR_CODE_START: 1,
STAR_COLOR_CODE_END: 4,
scoreCounter (starNum) {
return starNum * starNum * 5
},
remainScoreCounter (remainNum) {
return remainNum * 20
@yangfch3
yangfch3 / vhost.conf
Last active August 23, 2018 01:32
Nginx 为 Node.js 反向代理
upstream nodejs8000 {
server 127.0.0.1:8000;
keepalive 64;
}
server {
listen 80;
listen 443;
server_name web-dev.youguogame.com;
ssl on;
@yangfch3
yangfch3 / angular-core.html
Last active August 23, 2018 01:22
Angular核心实现讲解代码
<!DOCTYPE html>
<html lang="zh_CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Angular Core Implementation</title>
</head>
@yangfch3
yangfch3 / repl-curl.js
Last active August 23, 2018 01:57 — forked from TooTallNate/bbs.js
使用 repl 模块搭建一个面向 curl 的 SREPL
/**
* Requires node v0.7.7 or greater.
*
* To connect: $ curl -sSNT. localhost:8000
*/
var http = require('http')
, repl = require('repl')
, buf0 = new Buffer([0])
@yangfch3
yangfch3 / repl-client.js
Last active August 23, 2018 01:43 — forked from TooTallNate/repl-client.js
最简单 REPL WebShell Node.js 实现 - 基于 net 与 repl 模块
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)