Adding line number in pre using pure CSS
use counter-reset and counter-increment. 2. HTML OL tag can also add numbers before <li></li> elements. But start attribute does not work normally. coffee milk tea coffee milk tea
use counter-reset and counter-increment. 2. HTML OL tag can also add numbers before <li></li> elements. But start attribute does not work normally. coffee milk tea coffee milk tea
File API: https://developer.mozilla.org/en-US/docs/Web/API/File/Using_files_from_web_applications File Reader: https://developer.mozilla.org/en-US/docs/Web/API/FileReader FormData: https://developer.mozilla.org/en-US/docs/Web/API/FormData Useage in Angular: https://www.cnblogs.com/zero-zm/p/9859171.html
请求拦截器 (Request Interceptor) 如果我们想要注册新的拦截器 (interceptor),我们需要实现 HttpInterceptor 接口,然后实现该接口中的 intercept 方法。 需要注意的是,请求对象和响应对象必须是不可修改的 (immutable)。因此,我们在返回请求对象前,我们需要克隆原始的请求对象。 next.handle(req) 方法使用新的请求对象,调用底层的 XHR 对象,并返回响应事件流。 响应拦截器 (Response Interceptor) 响应拦截器可以通过在 next.handle(req) 返回的流对象 (即 Observable 对象) 上应用附加的 Rx 操作符来转换响应事件流对象。 接下来要应用 JWTInterceptor 响应拦截器的最后一件事是注册该拦截器,即使用 HTTP_INTERCEPTORS 作为 token,注册 multi Provider: More examples: For Angular6+ and RXJS6+:
Laravel 多个中间件的执行顺序 问题 一个路由需要用到多个中间件,其中一个是 Laravel 自带的 auth 中间件。 发现这个中间件不管放在哪里,总是在自定义中间件之前执行。 如果业务需要自定义中间在 auth 之前执行,还是有办法的。 解决方案 观察定义中间件的 app\Http\Kernel 类,是继承的 Illuminate\Foundation\Http\Kernel 类。 再打开 Illuminate\Foundation\Http\Kernel ,发现有这样一个数组 注释里写得比较清楚了:列表中的中间件会按照顺序优先在其他中间件之前执行。 那么需要自定义中间件在 auth 之前执行,只需要在 app\Http\Kernel 重载这个数组就行了。 auth 中间件对应的类 \Illuminate\Auth\Middleware\Authenticate,…
在 Angular 中有三种方式来生成单例服务: 把 @Injectable() 的 providedIn 属性声明为 root。 把该服务包含在 AppModule 或某个只会被 AppModule 导入的模块中。 1. 使用 providedIn 从 Angular 6.0 开始,创建单例服务的首选方式就是在那个服务类的 @Injectable 装饰器上把 providedIn 设置为 root。这会告诉 Angular 在应用的根上提供此服务。src/app/user.service.ts content_copyimport { Injectable } from ‘@angular/core’; @Injectable({ providedIn: ‘root’, }) export class UserService { } 2. NgModule…
Angular 中注入器是有层级结构的,即创建完注入器,我们可以基于它创建它的子注入器。 resolveAndCreate() – 根据设置的 provider 数组创建注入器 resolveAndCreateChild() – 调用已有注入器对象上的该方法,创建子注入器 当调用注入器 get() 方法,获取 token 对应的对象时,默认的查找方式是,优先从本级注入级获取,如果未找到,则往上一级查找,直到根级注入器。若未找到对应的依赖对象,默认会抛出异常。 使用示例 通过分析源码,我们也发现如果两个服务提供商 (Provider) 使用同一个 Token,却没有声明为 multiprovider,那么后面的会把前面的覆盖掉。此外需要注意的是,multiprovider 不能与普通的 provider 混用。 @Self()、@SkipSelf()、@Optional() 等装饰器有什么作用? @Self() – 表示只在本级注入器查找依赖对象 @SkipSelf() – 表示不从本级注入器获取依赖对象…
NgZone的简单使用 在Angular4中,如果模板中有一些变量在组件中经常变动,比如变量foo。 <div> 我经常变动: {{ foo }} </div> 在组件中它的初始值为0。 foo = 0; 假设在组件中有个循环,不断更新foo的值。 for (let i = 0; i < 100; i++) { setInterval(() => this.counter++, 10); } 那么频繁的变动将造成性能损耗。 Angular为我们提供了NgZone服务,对于一些频繁的操作,可以不去触发变更检测。…
Here comes a type alias definition in typescript: What does the type alias HandleError mean? What we usually see is type alias definitions with just one fat arrow like =>…
When I was migrating an old web site written in PHP from under Apache2 to Nginx I met a strange problem that the site worked perfectly under Apache2 but crashed…
How it works Here’s how form validation works with Bootstrap: HTML form validation is applied via CSS’s two pseudo-classes, :invalid and :valid. It applies to <input>, <select>, and <textarea> elements. Bootstrap scopes the :invalid and :valid styles to parent .was-validated class, usually applied…
The JS code that relates to selectors of data-toggle is as below: Here data-toggle=”collapse” can be used with href or data-target. One the element with element.id, an initial class=”collapse” should…
Noticeably, Card component uses flex and CSS grid.
Here’s the typical error: curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs After checking the Internet for quite a while I’ve got no idea at all. The…
vertical-align: baseline; Check vertical-align in depth. @at-root a#{&} @at-root means the selector definition is valid outside of .badge at the root of CSS. a#{&} = a .badge. &:empty means .badge:empty…
I’ve got my old ubuntu computer’s hard disk retired and I’d like to copy some data to my MacOS. Unfortunately Mac does not support linux filesystem access originally. There’re oxsfuse…
See how flex relected layout directives are defined in Bootstrap4.
When requesting for Restful APIs of backend, somtimes OPTION request is sent prior to a POST request to inquire http method support abilities of the backend server. When if the…
I had a look at Bootstrap 4.2 SCSS source code and I can tell that it has been written quite clean and clear. Let’s quote spacing part( Margin and padding)…
By default, laradock uses mysql latest image to build mysql service. As a result, mysql 8.0 is used and caching_sha2_password authentication plugin is the default configuration. When phpmyadmin tries to…
When building Laradock’s nginx image I met a prolbem like: group “www-data” in use . This is because the group www-data is already created in the default base image nginx:alpine….
hokhykdeMacBook-Pro:~ hok$ docker-compose -h Define and run multi-container applications with Docker. Usage: docker-compose [-f <arg>…] [options] [COMMAND] [ARGS…] docker-compose -h|–help Options: -f, –file FILE …
When I was debugging a CI/CD open source project called piplin(http://piplin.com), I failed setting up a web socket connection between node.js server and the browser. The browser is using cocket.io-client…
In the near future my department will move to a new office area. I’m thinking of designing a smart office. After searching for a while on Internet and I come…
install pyenvbrew install pyenv 2. Configure shell echo ‘export PATH=~/.pyenv/bin:$PATH’ >> ~/.bashrc echo ‘export PYENV_ROOT=~/.pyenv’ >> ~/.bashrc echo ‘eval “$(pyenv init -)”‘ >> ~/.bashrc 3. activate pyenv source ~/.bashrc(或zsh的~/.zshrc) Commonly…
When setting up a laravel project I came across this problem: Google search for this problem and I solved it by generating APP_key parameter. This problem happens when the APP_KEY…
origin: https://blog.csdn.net/m_nanle_xiaobudiu/article/details/80466702 一 Beanstalkd 是什么 Beanstalkd,一个高性能、轻量级的分布式内存队列系统 二 Beanstalkd 特性 优先级(priority) 注:优先级就意味 支持任务插队(数字越小,优先级越高,0的优先级最高) 延迟(delay) 注:延迟意味着可以定义任务什么时间才开始被消费,也就实现了定时任务(比如为了增加网站活跃性,增加定时评论,定时点赞功能) 持久化(persistent data) 注:Beanstalkd 支持定时将文件刷到日志文件里,即使beanstalkd宕机,重启之后仍然可以找回文件 预留(buried) 注:Beanstalkd支持把一个任务设置为预留,这样,消费者就无法取出这个任务了,等合适的时机再把这个任务拿出来消费 任务超时重发(time-to-run) 注:消费者必须在指定的时间内处理完这个任务,否则就认为消费者处理失败,任务会被重新放到队列,等待消费 三 管道(tube)与任务(job) 注:生产者生产任务,并根据业务需求将任务放到不同管道中,比如和注册有关的任务放到注册管道中,和订单有关的放到订单管道中 注:任务从进入管道到离开管道一共有5个状态(ready,delayed,reserved,buried,delete) 生产者将任务放到管道中,任务的状态可以是ready(表示任务已经准备好,随时可以被消费者读取),也可以是delayed(任务在被生产者放入管道时,设置了延迟,比如设置了5s延迟,意味着5s之后,这个任务才会变成ready状态,才可以被消费者读取) 消费者消费任务(消费者将处于ready状态的任务读出来后,被读取处理的任务状态变为reserved) 消费者处理完任务后,任务的状态可能是delete(删除,处理成功),可能是buried(预留,意味着先把任务放一边,等待条件成熟还要用),可能是ready,也可能是delayed,需要根据具体业务场景自己进行判断定义 具体示意图:…
JITAMIN is a project management system written in PHP With Kanban as its main project tool. It has laravel-like directory structure, but in fact uses different packages like Pimple for…
魔术方法:两个下划线开头的格式。 PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toString, __set_state, __clone and __autoload ①__get、__set这两个方法是为在类和他们的父类中没有声明的属性而设计的__get( $property ) 当调用一个未定义的属性时访问此方法(获取)__set( $property, $value ) 给一个未定义的属性赋值时调用(设置)这里的没有声明包括当使用对象调用时,访问控制为proteced,private的属性(即没有权限访问的属性) ②__isset、__unset__isset( $property ) 当在一个不可访问的属性上调用isset()或empty()函数时被调用。__unset(…
When I was trying to share a folder on the host to the container using relative path, it was always unsuccessful. My docker-compose.yml is as below: Notice that I have…
I feel bored about repeating the development environment setting up process very much these days. I’ve been managing linux, windows and mac machines and I have tasted LNMP, ONEINSTACK, MAMP,…
Docker basics-image, container, repository 1. Docker repository docker search ubuntu docker pull ubuntu:16.04 2. Docker image commands docker images -a docker images -a -q docker rmi $image-id docker tag $image-id…
I’m using nginx+php-fpm for my wordpress blog site. After I modified my permalinks setting under Settings, I suddenly found that all my posts’ links are broken! All I got was…
STEPS TO ADD WORDPRESS SOCIAL-SHARE WIDGET