Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
var _ = require("lodash"); | |
var R = require("ramda"); | |
var companies = [ | |
{ name: "tw", since: 1993 }, | |
{ name: "pucrs", since: 1930 }, | |
{ name: "tw br", since: 2009 } | |
]; | |
var r1 = _(companies).chain() |
,'._,`. PYTHON SUCKS | |
(-.___.-) EVEN SANDNIGGERS CAN MASTER IT | |
(-.___.-) DESPITE THE FACT THAT THIS IS OBVIOUSLY A COBRA | |
`-.___.-' | |
(( @ @| . __ | |
\ ` | ,\ |`. @| | | _.-._ | |
__`.`=-=mm===mm:: | | |`. | | | ,'=` '=`. | |
( `-'|:/ /:/ `/ @| | | |, @| @| /---)W(---\ | |
\ \ / / / / @| | ' (----| |----) ,~ | |
|\ \ / /| / / @| \---| |---/ | |
# coding: utf-8 | |
# author: haofly | |
# | |
# fun: 生成随机姓名、随机电话号码、随机字符串,目前仅支持Python2 | |
import random | |
def generateName(first_len=0, last_len=0): | |
surnames = [ |
# set the base image to Debian | |
# https://hub.docker.com/_/debian/ | |
FROM debian:latest | |
# replace shell with bash so we can source files | |
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | |
# update the repository sources list | |
# and install dependencies | |
RUN apt-get update \ |
本文曾在“架构师之路”上发布过,近期支援Qcon-AS大会,在微信群里分享了该话题,故对原文进行重新整理与发布。 | |
一、秒杀业务为什么难做 | |
1)im系统,例如qq或者微博,每个人都读自己的数据(好友列表、群列表、个人信息); | |
2)微博系统,每个人读你关注的人的数据,一个人读多个人的数据; | |
3)秒杀系统,库存只有一份,所有人会在集中的时间读和写这些数据,多个人读一个数据。 | |
例如:小米手机每周二的秒杀,可能手机只有1万部,但瞬时进入的流量可能是几百几千万。 | |
又例如:12306抢票,票是有限的,库存一份,瞬时流量非常多,都读相同的库存。读写冲突,锁非常严重,这是秒杀业务难的地方。那我们怎么优化秒杀业务的架构呢? | |
{ | |
"xiaohongshu.com": "小红书", | |
"vip.com": "唯品会", | |
"douguo.com": "豆果美食", | |
"youshu.cc": "有书", | |
"missfresh.cn": "每日优鲜", | |
"qnr.io": "去哪儿", | |
"kaola.com": "网易考拉", | |
"waimai.meituan.com": "美团外卖", | |
"qcs.meituan.com": "美团打车", |
判断滚动条的需求在弹窗插件中使用比较多,当弹窗添加overflow: hidden时,如果页面比较长的话,添加这个属性之后页面会有晃动。 | |
为了增强用户体验,通过判断是否有滚动条而添加 margin-left 属性以抵消 overflow: hidden 之后的滚动条位置。 | |
判断是否有滚动条的方法 | |
function hasScrollbar() { | |
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); | |
} | |
计算滚动条宽度的方法 | |
新建一个带有滚动条的 div 元素,通过该元素的 offsetWidth 和 clientWidth 的差值即可获得 |
{ | |
"xiaohongshu.com": "小红书", | |
"vip.com": "唯品会", | |
"douguo.com": "豆果美食", | |
"youshu.cc": "有书", | |
"missfresh.cn": "每日优鲜", | |
"qnr.io": "去哪儿", | |
"kaola.com": "网易考拉", | |
"waimai.meituan.com": "美团外卖", | |
"qcs.meituan.com": "美团打车", |