Skip to content

Instantly share code, notes, and snippets.

View e7h4n's full-sized avatar
🎯
Focusing

Ethan Zhang e7h4n

🎯
Focusing
View GitHub Profile
@e7h4n
e7h4n / README.md
Created November 3, 2023 02:49
管理 Beancount 的 Receivables 账户

基本规则

  • Receivable 账户意味着别人应该给你钱,比如购物退货之后等待退款、借给别人钱等等。例如
2023-10-31 * "淘宝" “[退货] 表带"
    Liabilities:CreditCard:CMB                                 -83.00 CNY
    Assets:Receivables
@e7h4n
e7h4n / motiff.md
Created August 5, 2023 12:06
研发 Motiff 这一年多的碎碎念

做了快两年的项目终于发布了。这不是我做的第一个项目,却是我想进行总结的第一个项目。

Motiff 是在 21 年十月底立项的。那年发生了一些事儿,公司需要在一些新的业务方向上进行探索。快到年底的时候,元祖突然叫上和我分享了他关于协同与 AI 的设想,然后这个项目就定下来了。

猿辅导(现在的看云控股)的风格一向是慢决策快执行。在决定做这个事情的第一周,我们就拉上了公司内最豪华的客户端 / 前端开发阵容来搞这个事情。基于对团队能力的自信,当时定了个非常激进的计划,期望在一个非常短的时间内让 Motiff 团队可以自举,让 Motiff 的产品、UI 迭代可以在 Motiff 上进行。

事实证明我们还是太年轻了,尽管我们有最一流的人,但缺少对于复杂客户端软件的研发经验还是让团队兜兜转转重构了很多次,有几次大规模的重构基本就是核心代码重写。

刚开始项目时那种“获得新玩具”的兴奋感很快就被拉垮的性能和改不完的 bug 冲淡了,我们很快就发现,要把这个项目做起来,我们没有任何一个成熟的架构模式可以参考。在过去成功帮助我们解决问题的 MVC/MVVM/MVP 根本搞不定百万级别的状态,团队必须自己想出一个框架来解决问题。

@e7h4n
e7h4n / warning-alerter.md
Last active January 14, 2022 09:51
Warning Alerter

注意

  • 这个题目不是算法题,不要陷入复杂的算法细节,往简单了去想
  • 可读性很重要,确保其他人可以在很短的时间内通过直接阅读代码搞懂你在做什么
  • 尽可能地多次提交你的代码,最好 2-10 分钟提交一次,这会帮助面试官来理解你的构建思路
  • 测试很重要,确保你的代码和测试一起提交。测试要可靠,以确保其他人可以只阅读测试就可以确认你的逻辑实现是没有问题的

Warning Alerter

在我们团队的开发过程中,我们的工程师注意到项目在构建时会出现一些编译警告。 尽管这些警告不会导致编译失败,但这些警告降低了我们的代码质量,所以我们决定清理它。

⚠️ ⚠️ ⚠️ Warning [1/50] ⚠️ ⚠️ ⚠️
📌 Location: ../src/control/PlaceImageControl.h:16:1
🔎 Message: class 'ControlManager' was previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
📝 Detail:
class ControlManager;
^
/Users/pw/workspace/wukong/wukong-editor/test/../src/control/DrawControl.h:10:8: note: previous use is here
struct ControlManager;
rm -rf out/protobuf/CMakeCache.txt;
cmake -GNinja -S./third-party/protobuf/cmake -Bout/protobuf \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-Dprotobuf_BUILD_TESTS=OFF
--
-- 3.17.3.0
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
@e7h4n
e7h4n / gist:6f4b90614af4505f803c7f27d3d08469
Last active November 16, 2021 10:29
股债比回归验证
import tushare as ts
import numpy as np
import pandas as pd
from datetime import datetime, date
from matplotlib import pyplot as plt
start_date = date(2015, 1, 1)
hs300 = 0
start_amount = 10000000
start_index = 0
@e7h4n
e7h4n / gist:2926bec64ba040c3bad78e54a9e3e3da
Created March 30, 2020 15:53
ytk.yuanfudao.com testssl
###########################################################
testssl.sh 3.1dev from https://testssl.sh/dev/
(8ff4520 2020-03-25 18:28:03 -- )
This program is free software. Distribution and
modification under GPLv2 permitted.
USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!
Please file bugs @ https://testssl.sh/bugs/
// 业务方法定义
const getA = function(cb) {
cb(a);
}
const getB = function(a, cb) {
cb(b);
}
const getC = function(a, b, cb) {
@e7h4n
e7h4n / loading.pipe.ts
Created March 24, 2017 13:22
Get a loading state of a Observable or Promise
import { ChangeDetectorRef, OnDestroy, Pipe, PipeTransform, ɵisObservable, ɵisPromise } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Observer } from 'rxjs/Observer';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
interface SubscriptionStrategy {
createSubscription(async: any, updateLatestValue: any): any;
dispose(subscription: any): void;

title: Node Web 服务平滑升级 date: 2014-06-22 11:33:12 tags: node

用 Node 搭建一个 Web 服务是一件很轻松的事情,例如经典的 Hello World 例子,三行代码实现一个 Web 服务:

require('http').createServer(function (req, res) {
 res.end('Hello World');