Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Fucheng Yang yangfch3

🎯
Focusing
  • NetEase
  • Internet
View GitHub Profile
View ManualDecisionTree.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 Sep 27, 2021
Lua simple http server | Lua 简易 HTTP 服务器
View lua_http.lua
--[[
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 Sep 27, 2021
Python Simple HTTP Server | Python 简易 HTTP 服务器
View simp_http_serv.py
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 Sep 27, 2021
python 系统任务多线程案例(以做过的某个卡牌游戏多进程跑牌为例)
View multi_async_proc.py
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 Sep 6, 2021
Lua ATS, Action Tree Lua version.
View BaseClass.lua
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 Sep 27, 2021
2D SAT 碰撞的 Lua 实现
View 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 Jul 23, 2020
[eslint vscode 插件全局配置] #eslint #vscode
View .eslintrc.vscode-plugin-global.js
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
},
extends: ['eslint:recommended'],
globals: {
Atomics: 'readonly',
@yangfch3
yangfch3 / Layer.ts
Created Nov 8, 2018
[白鹭 Layer 管理组件] 用于方便地对进行 Layer 的管理 #白鹭 #游戏开发
View Layer.ts
class Layer extends egret.Sprite {
private mountTo: egret.DisplayObjectContainer
constructor(mountTo: LayersDisplayObjectContainer) {
super()
// Layer 挂载到的 UI
this.mountTo = mountTo
}
}
@yangfch3
yangfch3 / memoize.js
Last active Nov 2, 2018
[简易缓存机] 对一些方法/函数传参-返回值进行缓存 #设计模式 #utils
View memoize.js
// 对一个对象的方法做缓存
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 Oct 10, 2018
[bash 速查手册] #bash #cheatsheets
View bash-help.sh
##############################################################################
# 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 键位)
##############################################################################