Skip to content

Instantly share code, notes, and snippets.

😀

Carter Li CarterLi

😀
Block or report user

Report or block CarterLi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scroll.md

iOS 与 惯性滚动

注:以下所有例子均 在 iOS 的微信中测试过,但对于饿了么APP的内置浏览器同样适用(两者使用相同内核)

引题

工作中常常有需要显示大量信息的情况,列表超出一屏就涉及到滚动的问题。例如

- var n = 1
@CarterLi
CarterLi / everything.html
Last active Apr 1, 2016
很牛B的html代码,丢进去没错的
View everything.html
<!-- 适应移动端start -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" /><!-- 删除苹果默认的工具栏和菜单栏 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /><!-- 设置苹果工具栏颜色 -->
<meta name="format-detection" content="telphone=no, email=no" /><!-- 忽略页面中的数字识别为电话,忽略email -->
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->
View async.md

异步 与 Generator

讨论会上谈到了这两者的关系,自认为有些许心得,却羞于开口,于是有了这篇博文。

引题

……

View canvas.html
<!doctype html>
<meta charset="utf-8" />
<style type="text/css">
canvas {
display: block;
}
</style>
<input id="file" type="file" accept="image/*" multiple />
<canvas id="canvas"></canvas>
<script>
@CarterLi
CarterLi / 0001-Dynamic-tls-records.patch
Created Sep 10, 2017
Sslconfig patches for nginx 1.13.5 ( Apply them in order )
View 0001-Dynamic-tls-records.patch
From 28e518f73665baa867e5a0627cffdad0ab4f09f0 Mon Sep 17 00:00:00 2001
From: Carter Li <carter.li@eoitek.com>
Date: Wed, 6 Sep 2017 10:07:12 +0800
Subject: [PATCH 1/3] Dynamic tls records
---
src/event/ngx_event_openssl.c | 39 +++++++++++++++++
src/event/ngx_event_openssl.h | 15 ++++++-
src/http/modules/ngx_http_ssl_module.c | 76 ++++++++++++++++++++++++++++++++++
src/http/modules/ngx_http_ssl_module.h | 6 +++
View http.js
function foo(req, res) {
req.log("hello from foo() handler");
return "foo";
}
function summary(req, res) {
var a, s, h;
s = "JS summary\n\n";
View tls13_chacha20_poly1305.patch
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 1669652..018718d 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -3662,6 +3662,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
STACK_OF(SSL_CIPHER) *prio, *allow;
int i, ii, ok;
unsigned long alg_k = 0, alg_a = 0, mask_k, mask_a;
+ int use_chacha = 0;
@CarterLi
CarterLi / add_proxy_ssl_alpn_directive.diff
Created Jun 15, 2018
Backport nginx patches from google nginx
View add_proxy_ssl_alpn_directive.diff
From c45dfdd8d0c3de53b4f56610292a72ecad321362 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= <carter.li@eoitek.com>
Date: Fri, 15 Jun 2018 14:58:33 +0800
Subject: [PATCH] add "proxy_ssl_alpn" directive
---
src/event/ngx_event_openssl.c | 22 ++++++++++++++++++
src/event/ngx_event_openssl.h | 2 ++
src/http/modules/ngx_http_proxy_module.c | 29 ++++++++++++++++++++++++
src/http/modules/ngx_http_ssl_module.c | 2 --
View nginx-tls13.diff
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index c4454fc..8a597c2 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -644,6 +644,12 @@ ngx_ssl_ciphers(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *ciphers,
return NGX_ERROR;
}
+ if (SSL_CTX_set_ciphersuites(ssl->ctx, "TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_CHACHA20_POLY1305_SHA256") == 0) {
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,
@CarterLi
CarterLi / test_signalfd.c
Last active Sep 18, 2019
A simple test case for liburing, and a working example for epoll
View test_signalfd.c
#include <liburing.h>
#include <libaio.h>
#include <unistd.h>
#include <sys/signalfd.h>
#include <sys/epoll.h>
#include <sys/poll.h>
#include <stdio.h>
int setup_signal() {
sigset_t mask;
You can’t perform that action at this time.