Skip to content

Instantly share code, notes, and snippets.

View xiaoxiangmoe's full-sized avatar
🐰
busy

ZHAO Jin-Xiang xiaoxiangmoe

🐰
busy
View GitHub Profile
@xiaoxiangmoe
xiaoxiangmoe / # nginx-full - 2022-03-02_15-52-11.txt
Created March 2, 2022 08:26
nginx-full (denji/nginx/nginx-full) on macOS 12 - Homebrew build logs
Homebrew build logs for denji/nginx/nginx-full on macOS 12
Build date: 2022-03-02 15:52:11
@xiaoxiangmoe
xiaoxiangmoe / .zsh_cn-nodejs-env-setup.sh
Last active February 18, 2022 08:47
.zsh_cn-nodejs-env-setup.sh
function cn-nodejs-env-setup() {
local script='
const https = require("https");
const { exit } = require("process");
const url = "https://raw.githubusercontent.com/cnpm/binary-mirror-config/master/package.json";
https
.get(url, (res) => {
let body = "";
@xiaoxiangmoe
xiaoxiangmoe / lambda_cube.lean
Last active May 8, 2021 03:55
lambda_cube.lean
-- PTS-style First-order dependent types
-- usage examples
--------------------------------------------------------------------------------
-- λ→
def plus_1_of_nat : Π _ : ℕ, ℕ := λ x : ℕ, x + 1
#check plus_1_of_nat
#reduce Π _ : ℕ, ℕ
@xiaoxiangmoe
xiaoxiangmoe / 记数学公式.md
Created April 22, 2021 09:07
记数学公式

记数学公式

[TOC]

简介

leanote的markdown编辑器支持基于MathJax编写LaTeX数学公式。

@xiaoxiangmoe
xiaoxiangmoe / t.js
Created May 18, 2020 17:28
问题:用此API打印出从1到30的十进制转十六制的对应表(最好按顺序打印)
// https://coolshell.cn/t.html
const scan = (xs, func, init) =>
xs.reduce(
(accu, curr, i, arr) => [
...accu,
func(accu[accu.length - 1], curr, i, arr),
],
[init],
);
// tslint:disable
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {}
type DeepReadonlyObject<T> = T extends Function
? T
: { readonly [P in keyof T]: DeepReadonly<T[P]> };
export type DeepReadonly<T> = T extends any[]
? DeepReadonlyArray<T[number]>
: T extends object
@xiaoxiangmoe
xiaoxiangmoe / genOpaqueType.js
Last active July 13, 2019 04:41
genOpaqueType
const genOpaqueType = x => "namespace _opaque{"+Array(x).fill().map((v,x)=>`declare const opaque_key_${x}:unique symbol;export interface t${x}{[opaque_key_${x}]:0}`).join(';')+"} /* prettier-ignore */ // tslint:disable-line"
@xiaoxiangmoe
xiaoxiangmoe / react-16-6.d.ts
Last active March 14, 2022 01:58
DefinitelyTyped @types/react
import * as React from "react";
declare module "react" {
function memo<P>(
Component:React.SFC<P>,
propsAreEqual?:((
prevProps: Readonly<P & { children?: ReactNode }>,
nextProps: Readonly<P & { children?: ReactNode }>
)=>boolean
@xiaoxiangmoe
xiaoxiangmoe / 前端业务代码的书写注意点.md
Last active May 8, 2018 13:49
前端业务代码的书写注意点

前端业务代码的书写注意点

变量,常量

几乎所有的 var,let,都可以用const代替,比如常见的写法:

交换两个数:

@xiaoxiangmoe
xiaoxiangmoe / config-overrides.js
Created November 5, 2017 10:27
react-app-rewired with css-modules and scss
/* config-overrides.js */
const rewired = require('react-app-rewired');
function contailCSSLoader(obj) {
const reg = /css-loader/;
if (typeof obj === 'string') {
return reg.test(obj);
}