摘要: Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code. Factory method: Provides an interface for 阅读全文
posted @ 2024-01-23 15:11 Zhentiw 阅读(8) 评论(0) 推荐(0)
摘要: Just for fun... Given a number (always positive) as a type. Your type should return the number decreased by one. For example: type Zero = MinusOne<1> 阅读全文
posted @ 2022-10-07 22:57 Zhentiw 阅读(51) 评论(0) 推荐(0)
摘要: Blog: https://www.geeksforgeeks.org/es6-trampoline-function/ Stackoverflow problem for recursion: const sumBelow = (number, sum = 0) => ( number 0 ? s 阅读全文
posted @ 2022-08-18 14:32 Zhentiw 阅读(41) 评论(0) 推荐(0)
摘要: Serverless framework with AWS Link to each sections Table of Content: Part 0: Serverless Project structure Part 1: DynamoDB & ApiGateway Part 2: Event 阅读全文
posted @ 2021-05-17 15:15 Zhentiw 阅读(156) 评论(0) 推荐(0)
摘要: Storage Services: S3 Glacier CloudFront Elastic Block Store (EBS) Storage Gateway Snow family Database Overview Block storage: Used on local networks 阅读全文
posted @ 2021-03-15 03:06 Zhentiw 阅读(152) 评论(0) 推荐(0)
摘要: S3 Features Prefiees and delimiters For example: the file name in S3 can be: `marking/plans/kpi_2021_1.pdf`. The point is make it looks like a folder 阅读全文
posted @ 2021-03-12 17:34 Zhentiw 阅读(146) 评论(0) 推荐(0)
摘要: In our previous code, we have seen this partten for operators: // #region operators const concat = curry((broadcaster, listener) => { let string = ''; 阅读全文
posted @ 2020-10-25 21:54 Zhentiw 阅读(155) 评论(0) 推荐(0)
该文被密码保护。 阅读全文
posted @ 2020-05-07 18:22 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: Generators can yield promises which can work with the "for await of" loop syntax. This lesson shows how all the pieces fit together and explains why t 阅读全文
posted @ 2020-03-22 02:59 Zhentiw 阅读(166) 评论(0) 推荐(0)
摘要: In this post, we are going to see how to use Ramda Lens. For example, we have data: R.lens: R.lens takes a getter and a setter: R.lensProp: There is a 阅读全文
posted @ 2019-02-24 20:12 Zhentiw 阅读(712) 评论(0) 推荐(0)
摘要: Just like the State ADT an Array is also an Applicative Functor. That means we can do the same tricks with liftA2 with Array that we have been doing w 阅读全文
posted @ 2019-01-16 16:30 Zhentiw 阅读(712) 评论(0) 推荐(0)
摘要: Use custom Cypress command for reusable assertions We’re duplicating quite a few commands between the registration and login of our user for assertion 阅读全文
posted @ 2018-12-06 21:13 Zhentiw 阅读(433) 评论(0) 推荐(0)
摘要: Use Cypress to test user registration Let’s write a test to fill out our registration form. Because we’ll be running this against a live backend, we n 阅读全文
posted @ 2018-12-05 15:54 Zhentiw 阅读(358) 评论(0) 推荐(0)
摘要: Despite the fact that Cypress is an application that runs natively on your machine, you can install it and add it as a dependency just like all other 阅读全文
posted @ 2018-12-05 02:38 Zhentiw 阅读(569) 评论(0) 推荐(0)
摘要: Ensure Functions are Called Correctly with JavaScript Mocks Often when writing JavaScript tests and mocking dependencies, you’ll want to verify that t 阅读全文
posted @ 2018-11-06 04:25 Zhentiw 阅读(431) 评论(0) 推荐(0)
摘要: 1. Color Picker (Chrome) You might know how to use color picker in Chrome, recently there is a feature inside color picker which is "Contrast Ratio", 阅读全文
posted @ 2018-07-15 18:41 Zhentiw 阅读(239) 评论(0) 推荐(0)
摘要: We'll examine how to unnest function calls, capture assignment, and create a linear data flow with a type we call Box. This is our introduction to wor 阅读全文
posted @ 2016-12-11 21:47 Zhentiw 阅读(330) 评论(0) 推荐(0)
摘要: Well, this stuff will be a little bit strange if you deal with it first time. Container Object: Just a wrapper / contianer for values No Method No Nou 阅读全文
posted @ 2016-09-06 04:23 Zhentiw 阅读(341) 评论(0) 推荐(0)
摘要: First, what is 'High Order function', basic just a function, inside the function return another fuction. For example: Decorators is a subset of high o 阅读全文
posted @ 2016-06-14 03:10 Zhentiw 阅读(379) 评论(0) 推荐(0)
摘要: Somehow it looks like reflect in Java. For example: We define an mothod on the Object, it called defineMethod(). It accepts two arguements, one is met 阅读全文
posted @ 2016-05-02 03:06 Zhentiw 阅读(381) 评论(0) 推荐(0)
摘要: import { ollama } from "ollama-ai-provider"; import { generateObject, generateText } from "ai"; import { z } from "zod"; import { globby } from "globb 阅读全文
posted @ 2025-07-05 19:06 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: import { ollama } from "ollama-ai-provider"; import { generateObject } from "ai"; import { z } from "zod"; import { globby } from "globby"; import { p 阅读全文
posted @ 2025-07-05 18:55 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: import { ollama } from "ollama-ai-provider"; import { generateObject } from "ai"; import { z } from "zod"; import { parseArgs } from "node:util"; cons 阅读全文
posted @ 2025-07-05 18:40 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: Run: ollama run gemma3 import { ollama } from "ollama-ai-provider"; import { generateObject } from "ai"; import { z } from "zod"; const model = ollama 阅读全文
posted @ 2025-07-05 18:37 Zhentiw 阅读(1) 评论(0) 推荐(0)
摘要: LLM,Large Language Model,大语言模型。 🤔思考: LLM 和 AI 这个词是完全等价的?或者说 AI 就是 LLM 么? LLM 仅仅是 AI 的一个分支。 任何能够使机器模仿人类行为的技术,都可以称之为人工智能技术。 人工智能下面有很多的分支,其中一个就是机器学习。 人类 阅读全文
posted @ 2025-07-05 18:20 Zhentiw 阅读(1) 评论(0) 推荐(0)
摘要: 准备工作 本地模型 模型分为两种: 1.专有模型:闭源模型 OpenAI GPT4 Cluade 优点:强大的商业支持 缺点:付费、数据的隐私 2.开源模型(学习阶段) 微软:Phi Meta:Llama deepseek 不需要联网 安装Ollama Ollama:模型平台,可以安装各种模型:Qw 阅读全文
posted @ 2025-07-05 18:18 Zhentiw 阅读(0) 评论(0) 推荐(0)
摘要: 通过前面的代码,其实我们已经完成了从模板AST到Javascript AST的转换 const ast = parse(template); transform(ast); 那接下来,我们只需要再根据Javascript AST生成具体的js代码就行了,比如再执行下面的函数: generate(as 阅读全文
posted @ 2025-06-27 13:41 Zhentiw 阅读(5) 评论(0) 推荐(0)
摘要: 我们现在已经有了模板AST,那么根据之前的顺序,我们现在需要把模板AST转化为JSAST。 要知道,模板AST是对模板的描述,那么JSAST就是对JS代码的描述。 也就是说,我们最终希望得到的代码是下面这样的: function render(){ return h('div',[ h('p','V 阅读全文
posted @ 2025-06-27 13:34 Zhentiw 阅读(4) 评论(0) 推荐(0)
摘要: 在转换AST节点的过程中,往往需要根据其子节点的情况来决定如何对当前节点进行转换,这就要求父节点的转换操作必须等待其所有子节点全部转换完毕之后再执行。 但是我们现在设计的转换流程并不支持这个能力,我们是从根节点开始,顺序往下执行的流程,如下图: 当一个节点被处理时,意味着它的子节点已经被处理完毕了, 阅读全文
posted @ 2025-06-26 13:51 Zhentiw 阅读(2) 评论(0) 推荐(0)
摘要: For example, we have following code doing AST transform from templateAST to Javascript AST function traverseNode(ast) { const currentNode = ast; // If 阅读全文
posted @ 2025-06-26 13:50 Zhentiw 阅读(3) 评论(0) 推荐(0)