Skip to content

Instantly share code, notes, and snippets.

View realgeoffrey's full-sized avatar
🦴
up

Zheng FJ realgeoffrey

🦴
up
View GitHub Profile
@XYShaoKang
XYShaoKang / 使用 gatsby cli 生成一个新的站点时,卡在安装`pngquant-bin`的临时解决办法.md
Last active August 17, 2023 17:19
使用 gatsby cli 生成一个新的站点时,卡在安装`pngquant-bin`的临时解决办法

gatsbyjs/gatsby#20389

原因:

原因是gatsby生成的默认站点会依赖一个包pngquant-bin

gatsby-starter-default@0.1.0
└─┬ gatsby-plugin-sharp@2.6.1
 └─┬ imagemin-pngquant@6.0.1
@rswanderer
rswanderer / .eslintrc-parameter-instruction.js
Last active September 8, 2023 01:59
ESLint配置文件.eslintrc参数说明
/*
* ESLint的JSON文件是允许JavaScript注释的,但在gist里显示效果不好,所以我把.json文件后缀改为了.js
*/
/*
* ESLint 配置文件优先级:
* .eslintrc.js(输出一个配置对象)
* .eslintrc.yaml
* .eslintrc.yml

Writing template strings in Markdown

With template strings coming to ES6, the backtick (`) means something in Markdown and in JavaScript. If you write this:

To display a message, write `alert(`hello world!`)`.

it'll render like this:

To display a message, write alert(hello world!).

@nuintun
nuintun / 用JS计算字符所占字节数.markdown
Last active March 18, 2024 03:31
用JS计算字符所占字节数
/**
 * 计算字符串所占的内存字节数,默认使用UTF-8的编码方式计算,也可制定为UTF-16
 * UTF-8 是一种可变长度的 Unicode 编码格式,使用一至四个字节为每个字符编码
 *
 * 000000 - 00007F(128个代码)      0zzzzzzz(00-7F)                             一个字节
 * 000080 - 0007FF(1920个代码)     110yyyyy(C0-DF) 10zzzzzz(80-BF)             两个字节
 * 000800 - 00D7FF
 * 00E000 - 00FFFF(61440个代码)    1110xxxx(E0-EF) 10yyyyyy 10zzzzzz           三个字节
 * 010000 - 10FFFF(1048576个代码)  11110www(F0-F7) 10xxxxxx 10yyyyyy 10zzzzzz  四个字节
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];