An introduction to concatting items via the formal Semi-group interface. Semi-groups are simply a type with a concat method that are associative. We define three semigroup instances and see them in action.   A semigroup is a type with a concat method…
A module in Node.js is a logical encapsulation of code in a single unit. It's always a good programming practice to always segregate code in such a way that makes it more manageable and maintainable for future purposes. That's where modules in Node.j…
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 working with the various container-style types. At first, might not be comforable with 'Box' or 'Contai…
故事背景 Ref: 你不知道的javascript之Object.create 和new区别 var Base = function () {} (1) var o1 = new Base(); (2) var o2 = Object.create(Base); // <----推荐 (1) 使用的是__proto__ // var o1 = new Object(); o1.__proto__ = Base.prototype; Base.call(o1); (2) 使用的是prototype…
Object.create()方法是ECMAScript 5中新增的方法,这个方法用于创建一个新对象.被创建的对象继承另一个对象的原型,在创建新对象时可以指定一些属性. 语法: Object.create(proto[,propertiesObject]) proto: 对象,要继承的原型 propertiesObject: 对象,可选参数,为新创建的对象指定属性对象.该属性对象可能包含以下值: 属性 说明 configurable 表示新创建的对象是否是可配置的,即对象的属性是否可以被删除或修…
We use the traversable instance on List to reimplement Promise.all() type functionality. For example we want to conver: [Task] => Task([]) Conver array of Task, into Task of array value. To do that we can use traverse. Noraml Javascript array doesn't…
monoids is a semi-group with a neutral element. A semigroup, it does not have an element to return so it's not a safe operation, whereas with the monoids we could take as many as we possibly want, even none, and still return us back something. It's a…
We refactor a function that uses try/catch to a single composed expression using Either. We then introduce the chain function to deal with nested Eithers resulting from two try/catch calls. For example we have this code using try & catch: const getPo…
We define the Either type and see how it works. Then try it out to enforce a null check and branch our code. Now, we try to make Box more useful. We want to do a force null check by define "Right" and "Left" tow boxes. What "Right…
After understanding how Box is, then we are going to see how to use Box to refacotr code, to un-nested expression. For example, we have code: const moneyToFloat = str => { const cost = str.replace(/\$/g, ''); return parseFloat(cost); } const percentT…
Let's we want to combine two account accidently have the same name. , friends: ['Franklin'] } , friends: ['Gatsby'] } So, here we can use Semi-group to combine them, because the semi-group have the knowledge how to combine for each type of object. So…
how to create a style element in js (many ways) create style in js Constructed StyleSheets CSSStyleSheet adoptedStyleSheets Shadow Roots (Shadow DOM) Documents demo // Create our shared stylesheet: const sheet = new CSSStyleSheet(); sheet.replaceSync…
Compose是Docker官方的开源项目,可以实现对Docker容器集群的快速编排.Compose 中有两个重要的概念:服务(service):一个应用的容器,实际上可以包括若干运行相同镜像的容器实例.项目(project):由一组关联的应用容器组成的一个完整业务单元,在 docker-compose.yml 文件中定义. 一.安装Compose Compose由python编写,因此可以使用pip方式进行安装. # pip install -U docker-compose 安装成功后可以查…
大神的node书,免费 视频:https://node.university/courses/short-lectures/lectures/3949510 另一本书:全栈JavaScript,学习backbone.js node.js and MongoDB. 1,2章: Setting up Node.js and Other Essentials [2nd Edition] Using Express.js 4 to Create Node.js Web Apps [2nd Edition…
Enabling JavaScript Access on the Server Drop the JavaScriptHttpDispatcher component onto the server form or data module and connect its Server property to your server channel component. Please pay attention to the default values of its properties: t…
原文:https://stackabuse.com/how-to-start-a-node-server-examples-with-the-most-popular-frameworks/#:~:text=To%20use%20http%2Dserver%20%2C%20install,install%20http%2Dserver%20%2Dg%20.&text=Visit%20http%3A%2F%2Flocalhost%3A8081,does%20mainly%20front%2Dend…
目录 前期准备 Docker Compose是什么 为什么要用Docker Compose Docker Compose使用场景 Docker Compose安装 Compose Yaml文件结构 Compose 基本操作命令 Docker Compose实战 实战目标 实战步骤 清理旧配置 搭建环境 验证环境 Compose弹性扩容初体验 附录 引用 Q&A Docker已经上市很多年,不是什么新鲜事物了,很多企业或者开发同学以前也不多不少有所接触,但是有实操经验的人不多,本系列教程主要偏重实…
Electron: 使用 JavaScript, HTML 和 CSS 等 Web 技术创建原生程序的框架 Vue.js: Web 前端用于构建用户界面的渐进式框架 Vuetify: Vue.js 的 Material Design 组件框架 看完以上介绍,也明白了本文要做的事:用 Vue.js 与 Vuetify 组件,基于 Electron 来创建原生桌面应用. 环境准备 Visual Studio Code Node.js Yarn Vue CLI 创建 Vue.js 应用 添加 Vuet…
Compose是Docker的服务编排工具,主要用来构建基于Docker的复杂应用,Compose 通过一个配置文件来管理多个Docker容器,非常适合组合使用多个容器进行开发的场景. 说明:Compose是Fig的升级版,Fig已经不再维护.Compose向下兼容Fig,所有fig.yml只需要更名为docker-compose.yml即可被Compose使用. 服务编排工具使得Docker应用管理更为方便快捷. Compose网站:https://docs.docker.com/compos…
JavaScript不需要编译即可运行,这让JavaScript构建的应用程序可以变得很灵活.我们可以根据需要动态从服务器加载JavaScript脚本来创建和控制UI来与用户交互.下面结合Ext JS来说明如何从服务器上动态加载JS脚本来动态创建窗体. 1 项目结构: 项目结构如下:其中GetJSUI一般处理程序用来从数据库表中抓取UI配置,并返回到客户端:Contents文件夹下用HTML文件和JS库等. 2 数据库表结构 可以用下面的SQL在MSSQL中创建表,其中JavaScriptCon…
<!DOCTYPE html> <html> <head> <title>Example 01.03 - Materials and light</title> <script type="text/javascript" src="../libs/three.js"></script> <script type="text/javascript" src=…
<!DOCTYPE html> <html> <head> <title>Example 01.02 - First Scene</title> <script type="text/javascript" src="../libs/three.js"></script> <script type="text/javascript" src="..…
In this post, we’re going to be creating a sample comments system using Node, Express and Mongoose. Mongoose provides an object oriented interface for using MongoDB in Node. Everything in Mongoose starts with a Schema. Each schema maps to a MongoDB c…
Browserify is a tool that brings node.js style development to the browser. The thing you can see on the node.js cmd line can also be broung up to the broswer. What you need to do is: Install the browserify: npm install -g browserify Now, for example,…
第一章 用three.js创建你的第一个3D场景 到官网下载three.js的源码和示例. 创建HTML框架界面 第一个示例的代码如下: 01-basic-skeleton.html 位于 Learning Three.js- The JavaScript 3D Library for WebGL\chapter-01 <!DOCTYPE html> <html> <head> <title>Example 01.01 - Basic skeleton<…
Analytics.js简介   analytics.js JavaScript代码段是一种可用于衡量用户与您网站的互动情况的全新方式.它与之前的跟踪代码ga.js类似,但为开发者自定义实现方案提供了更大的灵活性. analytics.js代码段是Universal Analytics(目前处于公测阶段)的一部分.新用户应使用analytics.js.现有的ga.js用户应为analytics.js创建新的网络媒体资源并在他们的网站中进行两次代码实现.在同一页面上添加ga.js和analytic…
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css"> <script type='text/javascript' src…
转自:https://www.cnblogs.com/52fhy/p/5991344.html Compose是Docker的服务编排工具,主要用来构建基于Docker的复杂应用,Compose 通过一个配置文件来管理多个Docker容器,非常适合组合使用多个容器进行开发的场景. 说明:Compose是Fig的升级版,Fig已经不再维护.Compose向下兼容Fig,所有fig.yml只需要更名为docker-compose.yml即可被Compose使用. 服务编排工具使得Docker应用管理…
https://github.com/WQTeam/web-storage-cache 使用WebStorageCache,只要在页面上引入下面代码即可. <script src="src/web-storage-cache.js"></script><script src="~/scripts/AjaxCache/ajax-cache.js"></script> <script> // create We…
一.安装docker compose 二进制包安装 1.安装 Docker Compose 从 官方 GitHub Release 处直接下载编译好的二进制文件即可 # curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose [root@bogon ~]# curl -L https:…