Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lmj01 committed Aug 18, 2023
1 parent d631da7 commit b07d9b2
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 37 deletions.
1 change: 1 addition & 0 deletions cpl/ECMAScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,6 @@ try...catch...不能捕获异步操作
## 参考
- [Standard ECMA-262 6th Edition / June 2015 ECMAScript® 2015 Language Specification ](https://262.ecma-international.org/6.0/)
- [RxMarbles](https://rxmarbles.com/)
- [github](https://github.com/staltz/rxmarbles)
32 changes: 3 additions & 29 deletions cpl/cplusplus.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,5 @@
# C
# Cplusplus

## 参考
- [What a C programmer should know about memory](https://marek.vavrusa.com/memory/)
## TMP(template metaprogramming)

## 面向对象编程
重载
比较通用的做法是利用C的可变参数va_args,也可以利用宏和预处理、函数指针来实现,不过需要编写很多额外的代码来管理这些重载函数的管理。
C语言实现继承有很多中方式,
```c
struct base_s {
int id;
};
struct parent_s {
int id;
int grade;
};
struct child_s {
int id;
int grade;
int math;
};
child_s child;
parent_s *parent = (child_s*)child;
base_s *base = (base_s*)parent;
```
可以看到在保持内存布局一致的情况下,就可以直接进行重新对内存块进行解析,而在更高级的语言中就是通过语言内部的机制来完成这种内存布局上的特定格式。高级语言就是固定某种数据结构模式来形成一个更严格的编程语言模型。这种模式在大量优秀软件中底层都是如此处理的,使用C语言作为底层数据形式,在使用中间层来完成与C语言的数据交互,这就是其他语言模型在特定场合有一定市场的根本原因。如TCP协议的实现使用scheme的函数式语言来处理,就是因为TCP协议的本身特性非常适合它。

linux内核中使用的C语言的面向对象的设计思考参考
- [Object-oriented design patterns in the kernel, part 1](https://lwn.net/Articles/444910/)
- [Object-oriented design patterns in the kernel, part 2](https://lwn.net/Articles/446317/)
C++ allows template metaprogramming (TMP), a technique in which so-called templates are used by a compiler to generate temporary source code that is merged with the rest of the source code and then compiled
42 changes: 42 additions & 0 deletions cpl/programming.paradigm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Programming Paradigm

## The Functional Programming Paradigm
函数式编程

编程语言有一种分类为
- Imperative命令式, 更关注具体,更关注于行为的细枝末节,强调过程,偏于微观
- Declarative声明式,更关注抽象,用起来更简洁,更专注于问题的解决步骤,强调结果,偏于宏观

### Cplusplus
范式最多的语言,从面向过程、面向对象、泛型编程、函数式编程,本质就是编程范式的转变,也就是越现代化的Modern C++

**Monads**,概念来自范畴论,称为单子,函数式编程当中使用Monads表示一个抽象数据类型,其目的在于表示计算过程。

>> A monad is just a monoid in the category of endoffunctors
C++中定义为class来,语法上与Functor仿函数有点像,如果只有一个成员函数就是Functor,多个成员函数就是Monad。
从范畴论术语,称为函子,在范畴论中,输入的数据和输出的数据称为范畴,将一个范畴转换为另一个范畴方式,是一种比Function更高阶的函数。

若输入和输出类型相同,即源范畴和目的范畴相同,称为幺元,此时函子称为自函子endofunctors,是end of functors的组合词。幺元够了一个幺半群,就是Monad,类型满足这些约束就是一个Monad。
```c++
template<typename A>
struct Functor {
template<typename B>
Functor<B> transform(std::function<B(A)>);
}
```
```c++
template<typename A>
struct Monad {
template<typename B>
Monad<B> transform(std::function<B(A)>);
template<typename B>
Monad<B> and_then(std::function<B(A)>);
}
```
注意函数名称不是随便起的,一般不同语言有共识的,C++中是transform和and_then,Haskell则是map和fmap。
[std::optional中的monadic operations](https://en.cppreference.com/w/cpp/utility/optional)

### 参考
- [Monads in Modern C++, What, Why, and How](https://www.cppmore.com/2023/08/14/monads-in-modern-c-what-why-and-how/)
3 changes: 2 additions & 1 deletion dev-note/cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ MSBuild.exe INSTALL.vcxproj /p:Configuration=release
- [tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/index.html)
- [cmake常用命令](https://zhuanlan.zhihu.com/p/315768216)
- [CMake-tutorial中文教程](https://www.cnblogs.com/lnlin/p/16576418.html)
- [CMake入门笔记系列(一):CMake编译过程详解 | Micro CMake for C++](https://zhuanlan.zhihu.com/p/620839692)
- [CMake入门笔记系列(一):CMake编译过程详解 | Micro CMake for C++](https://zhuanlan.zhihu.com/p/620839692)
- [一个简单例子,完全入门CMake语法与CMakeList编写](https://zhuanlan.zhihu.com/p/630144233)
3 changes: 3 additions & 0 deletions index/computerScience.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
- [Vulkan Guide](https://github.com/KhronosGroup/Vulkan-Guide)
- [Vulkan Tutorial ](https://vulkan-tutorial.com/)
- [vulkan-renderer,Inexor is an open-source project which combines modern C++ with Vulkan API.](https://github.com/inexorgame/vulkan-renderer)
- [vulkan with pbrt](https://github.com/Lachei/VulkanPBRT/tree/master/shaders)

### UI

Expand All @@ -77,11 +78,13 @@
- [3D Grafik - WebGL mit three.js](https://xprofan.net/intl/de/php,html,js/3d-grafik-webgl-mit-three-js/)
- [use your mouse to control the camera and build an andorid](https://hofk.de/main/threejs/raycaster/raycaster.html)
- [webgl examples](https://alteredqualia.com/)
- [](https://github.com/brunosimon/folio-2019)

### Tool

- [PAG Portable Animated Graphics](https://pag.art/)
- [3d model file](../cg/modelFile.md)
- [Effekseer特效编辑器](https://github.com/effekseer/Effekseer)

### paper

Expand Down
1 change: 1 addition & 0 deletions index/online.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@
- [Daniel Holden](https://theorangeduck.com/page/all)
- [BimAnt](http://www.bimant.com/blog/)
- [云风的BLOG](https://blog.codingnow.com/)
- [cppmore](https://www.cppmore.com/)
37 changes: 31 additions & 6 deletions web/css.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@

# Cascading Style Sheets

css本身就集成了非常丰富的功能,使用好CSS做出艺术级别的

## meta
```html
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
```
bootstrap-vue上看到的,让网页宽度自动适应手机屏幕

## 布局

- [参考1](https://www.jianshu.com/p/5c6f761ff769)

### 标准文档流

### 浮动布局

### 定位布局

### flex

####

- 主轴main axis
- 交叉轴cross axis

#### 容器

父容器可以统一设置子容器的排列方式,子容器可以单独设置自身的排列方式,如果两者同时设置,以子容器的设置为准。

- 父容器container
- justify-content
- 位置排列 flex-start flex-end center
- 分步排列 space-between space-around
- 子容器item
- align-items
- 位置排列 flex-start flex-end center
- 基线排列 baseline
- 拉伸排列 stretch

## effect

### scroll
Expand Down Expand Up @@ -173,11 +203,6 @@ div {
```


## [Tailwind](https://tailwindcss.com/)

npm install tailwindcss
node_modules\.bin\tailwind init

## BEM
Block Element Modifier is a methodology that helps you to create reusable components and code sharing in front-end development.是由Yandex团队提出的一种CSS Class的命名方法

Expand Down
9 changes: 8 additions & 1 deletion web/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@
- [CKEditor 5 is an ultra-modern JavaScript rich-text editor with MVC architecture, a custom data model, and virtual DOM](https://github.com/ckeditor/ckeditor5)

- [Your powerful rich text editor.](https://quilljs.com/)
- [github](https://github.com/quilljs/quill)
- [github](https://github.com/quilljs/quill)

### PDF

- [PDF-LIB可写可修改](https://pdf-lib.js.org/) 字体必须内嵌,这样文件非常大,拷贝合并pdf时,内嵌字体还没法删除
- [github](https://github.com/Hopding/pdf-lib)

- [jspdf只能写](https://github.com/parallax/jsPDF)

0 comments on commit b07d9b2

Please sign in to comment.