From b07d9b23541bc10a6fd7e1dd5df230d129b6180c Mon Sep 17 00:00:00 2001 From: lmj01 Date: Fri, 18 Aug 2023 17:30:55 +0800 Subject: [PATCH] update --- cpl/ECMAScript.md | 1 + cpl/cplusplus.md | 32 +++------------------------- cpl/programming.paradigm.md | 42 +++++++++++++++++++++++++++++++++++++ dev-note/cmake.md | 3 ++- index/computerScience.md | 3 +++ index/online.md | 1 + web/css.md | 37 ++++++++++++++++++++++++++------ web/index.md | 9 +++++++- 8 files changed, 91 insertions(+), 37 deletions(-) create mode 100644 cpl/programming.paradigm.md diff --git a/cpl/ECMAScript.md b/cpl/ECMAScript.md index b49858b..b86b8de 100644 --- a/cpl/ECMAScript.md +++ b/cpl/ECMAScript.md @@ -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) \ No newline at end of file diff --git a/cpl/cplusplus.md b/cpl/cplusplus.md index 014e19f..0783076 100644 --- a/cpl/cplusplus.md +++ b/cpl/cplusplus.md @@ -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/) \ No newline at end of file +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 \ No newline at end of file diff --git a/cpl/programming.paradigm.md b/cpl/programming.paradigm.md new file mode 100644 index 0000000..b402e5b --- /dev/null +++ b/cpl/programming.paradigm.md @@ -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 +struct Functor { + template + Functor transform(std::function); +} +``` +```c++ +template +struct Monad { + template + Monad transform(std::function); + + template + Monad and_then(std::function); +} +``` +注意函数名称不是随便起的,一般不同语言有共识的,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/) \ No newline at end of file diff --git a/dev-note/cmake.md b/dev-note/cmake.md index 1fda14b..871031f 100644 --- a/dev-note/cmake.md +++ b/dev-note/cmake.md @@ -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) \ No newline at end of file +- [CMake入门笔记系列(一):CMake编译过程详解 | Micro CMake for C++](https://zhuanlan.zhihu.com/p/620839692) +- [一个简单例子,完全入门CMake语法与CMakeList编写](https://zhuanlan.zhihu.com/p/630144233) \ No newline at end of file diff --git a/index/computerScience.md b/index/computerScience.md index 13e7c9e..2cb181d 100644 --- a/index/computerScience.md +++ b/index/computerScience.md @@ -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 @@ -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 diff --git a/index/online.md b/index/online.md index e8f482d..d1d7958 100644 --- a/index/online.md +++ b/index/online.md @@ -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/) diff --git a/web/css.md b/web/css.md index 13eac59..f66f0ff 100644 --- a/web/css.md +++ b/web/css.md @@ -1,7 +1,6 @@ # Cascading Style Sheets -css本身就集成了非常丰富的功能,使用好CSS做出艺术级别的 ## meta ```html @@ -9,6 +8,37 @@ css本身就集成了非常丰富的功能,使用好CSS做出艺术级别的 ``` 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 @@ -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的命名方法 diff --git a/web/index.md b/web/index.md index ca990bc..f6a1e0e 100644 --- a/web/index.md +++ b/web/index.md @@ -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) \ No newline at end of file + - [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) \ No newline at end of file