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 / ManualDecisionTree.lua
Created December 7, 2021 10:37
Lua 决策树
-- @author: yangfch3
-- @date: 2020/09/27 15:20
------------------------------------------
-- Node 基类
local DTNode = BaseClass("DTNode")
function DTNode:ctor() end
function DTNode:Eval(decisionTree, context) end
function DTNode:SetChildren()
assert(false)
@yangfch3
yangfch3 / lua_http.lua
Created September 27, 2021 08:04
Lua simple http server | Lua 简易 HTTP 服务器
--[[
A simple HTTP server
If a request is not a HEAD method, then reply with "Hello world!"
Usage: lua examples/server_hello.lua [<port>]
]]
local MyLog = require "AIServer/MyLog"
local http_server = require "http.server"
local http_headers = require "http.headers"
local json = require "3rds/json"
@yangfch3
yangfch3 / simp_http_serv.py
Last active September 27, 2021 08:01
Python Simple HTTP Server | Python 简易 HTTP 服务器
from argparse import Namespace
import traceback
import json
import urllib
import simp_http_serv_helper as helper
from http.server import HTTPServer, BaseHTTPRequestHandler
@yangfch3
yangfch3 / multi_async_proc.py
Last active September 27, 2021 07:51
python 系统任务多线程案例(以做过的某个卡牌游戏多进程跑牌为例)
import json
import os
import sys
import time
import base64
from subprocess import DEVNULL, STDOUT, Popen, PIPE
import merge_data
conf_file = "run.conf.json"
@yangfch3
yangfch3 / BaseClass.lua
Created September 6, 2021 01:56
Lua ATS, Action Tree Lua version.
function BaseClass(classname, super)
local cls
if super then
cls = {}
setmetatable(cls, {__index = super})
cls.super = super
else
cls = {ctor = function() end}
end
@yangfch3
yangfch3 / SAT.lua
Last active November 21, 2023 02:17
2D SAT 碰撞的 Lua 实现
local MathUtil = {}
---获取两点的距离
function MathUtil.GetDis(vec1, vec2)
local x1 = vec1.x or vec1[1]
local y1 = vec1.y or vec1[2]
local x2 = vec2.x or vec2[1]
local y2 = vec2.y or vec2[2]
local disX = x1 - x2
@yangfch3
yangfch3 / .eslintrc.vscode-plugin-global.js
Last active July 23, 2020 07:59
[eslint vscode 插件全局配置] #eslint #vscode
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
extends: ['eslint:recommended'],
globals: {
Atomics: 'readonly',
@yangfch3
yangfch3 / Layer.ts
Created November 8, 2018 13:30
[白鹭 Layer 管理组件] 用于方便地对进行 Layer 的管理 #白鹭 #游戏开发
class Layer extends egret.Sprite {
private mountTo: egret.DisplayObjectContainer
constructor(mountTo: LayersDisplayObjectContainer) {
super()
// Layer 挂载到的 UI
this.mountTo = mountTo
}
}
@yangfch3
yangfch3 / memoize.js
Last active November 2, 2018 04:19
[简易缓存机] 对一些方法/函数传参-返回值进行缓存 #设计模式 #utils
// 对一个对象的方法做缓存
function Memoize(func, obj) {
obj = obj || window
func = obj[func]
let cache = {}
return function () {
let key = Array.prototype.join.call(arguments, '_')
if (!(key in cache)) {
// console.log('缓存未命中')
cache[key] = func.apply(obj, arguments)
@yangfch3
yangfch3 / bash-help.sh
Created October 10, 2018 02:48
[bash 速查手册] #bash #cheatsheets
##############################################################################
# BASH CHEATSHEET (中文速查表) - by skywind (created on 2018/02/14)
# Version: 43, Last Modified: 2018/04/02 17:00
# https://github.com/skywind3000/awesome-cheatsheets
##############################################################################
##############################################################################
# 常用快捷键(默认使用 Emacs 键位)
##############################################################################