第59期 — 2020-06-14

在浏览器中阅读

周e信

扫描二维码关注微信公众号

Node.js

terminal-image 在终端中显示图片🔗

支持所有支持颜色系统的命令行终端

Sindre Sorhus

教程 moment-timezone🔗
  • Chrome v34 之前不支持在 border widths, column gaps, transform values, box shadows 以及 calc() 里使用。
  • 火狐 bug:如果 display 为 table,则 100vh 不起作用。

Valeri Karpov

express限流的两种方式🔗

Native中间件方式

export function rateLimit(duration) {
  const lock = {};
  return (req, res, next) => {
    if (req._.user.id in lock) {
      res.status(429).send();
    } else {
      next();
      lock[req._.user.id] = true;
      setTimeout(() => delete lock[req._.user.id], 1000 * duration);
    }
  }
}

流处理方式

import { Router, next } from 'rxxpress';
import { throttleTime, groupBy, mergeMap } from 'rxjs/operators';

import { authenticate } from './auth';

const router = new Router();

router.all('*').pipe(
  use(authenticate()),                                  // --> conduct authentication
  groupBy(({req}) => req._.user.id),                    // --> split request stream based on user
  mergeMap(group => group.pipe(throttleTime(10000))),   // --> throttle each split stream 10 seconds, then merge them together
  next()                                                // --> pass to next handler
).subscribe();

// ...
// Rest of your API definition
// ...

export default router.core;

Eugene Ghanizadeh

前端

Thomas Park

Hasura

Polypane blog

教程 - vh, vw, vmin 和 vmax🔗
  • Chrome v34 之前不支持在 border widths, column gaps, transform values, box shadows 以及 calc() 里使用。
  • 火狐 bug:如果 display 为 table,则 100vh 不起作用。

Asha Laxmi and Maria Antonietta Perna

投稿

The Lounge

Al Mamun

Mustafa Enes Ertarhanaci

Femi Oladeji

Outline

Abhi

Animate.css

Michael Kutateladze

运维

分享 - Coinbase - kubernets还是太复杂,我们使用odin来发布🔗

odin是 coinbase 开源的发布部署工具。直接绑定 AWS 的自动扩展组 ASG,可以水平扩展,也可以垂直扩展。

Drew Rothstein

sickcodes

HashiCorp

Steven Wade

caprover - 简单易用paas平台实现🔗

对于 web developer 不想花时间在 devops 上的,可以用来一键部署。

类似方案

dokku flynn

CapRover

扫描二维码关注微信公众号
本期阅读量