Skip to content

Instantly share code, notes, and snippets.

@aweffr
aweffr / System Design.md
Created February 15, 2019 09:38 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@aweffr
aweffr / formik-mobx.js
Created March 12, 2021 06:02 — forked from danielkcz/formik-mobx.js
Formik with MobX
function useFormik(props) {
// useState to keep the same observable around without recreating it on each render
const [formik] = React.useState(() =>
mobx.observable({
values: props.initialValues || {},
touched: {}
})
)
// just mutate state, this function itself can be considered an action+reducer
@aweffr
aweffr / nginx.conf
Created April 29, 2021 01:35 — forked from fotock/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
@aweffr
aweffr / index.js
Created April 3, 2022 08:52 — forked from davx1992/index.js
/** UI element heights which used in message height calculation */
textPaddingVertical: number = 7;
textPaddingHorizontal: number = 10;
timeHeight: number = 12;
timeTopMargin: number = 5;
messageContainerVerticalMargin: number = 7;
dateSeperatorVerticalMargin: number = 20;
dateSeperatorHeight: number = 15;
imageHeight: number = 170;
imageBottomMargin: number = 10;
@aweffr
aweffr / .gitlab-ci.yml
Created May 25, 2022 07:24 — forked from zerda/.gitlab-ci.yml
Gitlab CI for front-end project
image: node:6-alpine
cache:
key: "$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"
paths:
- node_modules/
- yarn_cache/
stages:
- setup