Skip to content

Instantly share code, notes, and snippets.

View lorainwings's full-sized avatar
🎯
Focusing

lorainwings

🎯
Focusing
View GitHub Profile

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@lorainwings
lorainwings / what-forces-layout.md
Created January 18, 2024 04:39 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@lorainwings
lorainwings / font-family.css
Created September 21, 2020 03:16 — forked from 52cik/font-family.css
font-family 最优重置
/**
* 为了避免字体混乱的局面,Neat.css 统一了 font-family 的设置。
*
* 1. 中文字体选择如下:
* Windows 优先使用「微软雅黑」,如果没有则使用「中易宋体(SimSun)」。
* OS X 优先使用「冬青黑体简体(Hiragino Sans GB)」,如果没有则使用默认的「华文黑体」。
* Linux 优先使用「文泉驿微米黑」。
*
* 2. 西文字体选择如下:
* Windows 优先使用「Arial」。
@lorainwings
lorainwings / npm.taobao.sh
Created September 21, 2020 03:15 — forked from 52cik/npm.taobao.sh
npm 淘宝镜像配置
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
@lorainwings
lorainwings / wsl_socks5.md
Created June 26, 2020 16:23 — forked from moenn/wsl_socks5.md
为 windows wsl 配置 socks5 代理

windows代理软件需要开启允许LAN连接

1. 安装 polipo

sudo apt install polipo

2. 配置 polipo

vim /etc/polipo/config
在文件中写入如下内容:

socksParentProxy = "localhost:1080"
socksProxyType = socks5
@lorainwings
lorainwings / wsl_socks5.md
Created June 26, 2020 16:23 — forked from moenn/wsl_socks5.md
为 windows wsl 配置 socks5 代理

windows代理软件需要开启允许LAN连接

1. 安装 polipo

sudo apt install polipo

2. 配置 polipo

vim /etc/polipo/config
在文件中写入如下内容:

socksParentProxy = "localhost:1080"
socksProxyType = socks5
location ~ /(.*)/detail {
set $first_path $1;
root /home/www/growth-upgrade/html;
try_files $uri $uri/ $first_path/index.html;
if (!-e $request_filename) {
rewrite ^/(.*) /$first_path/index.html last;
break;
@lorainwings
lorainwings / CompressImg.js
Created November 21, 2019 08:37 — forked from win5do/CompressImg.js
利用cavans实现前端图片压缩
export default class CompressImg {
options = {
files: [], // 文件列表
maxSize: 500 * 1024, // 压缩限度
quality: 0.6, // 质量
}
constructor(options) {
this.options = options;
}
@lorainwings
lorainwings / forEach
Last active September 12, 2019 03:02
对象和数组通用forEach
function forEach(target, iteratee) {
const array = Array.isArray(target) ? target : Object.keys(target);
let index = -1;
const length = array.length;
while (++index < length) {
const key = target !== array ? array[index] : index;
iteratee(target[key], key);
}
return target;
}