Skip to content

Instantly share code, notes, and snippets.

View fengmk2's full-sized avatar
🐢
Coding for fun

fengmk2 fengmk2

🐢
Coding for fun
View GitHub Profile
@fengmk2
fengmk2 / .husky pre-commit
Last active March 30, 2025 07:56
eggjs oxlint config and .prettierrc config
npx lint-staged
@gomezcabo
gomezcabo / recursive-required.ts
Last active September 7, 2024 02:54
Typescript RecursiveRequired generic type
type RecursiveRequired<T> = Required<{
[P in keyof T]: T[P] extends object | undefined ? RecursiveRequired<Required<T[P]>> : T[P];
}>;
type ExampleType = {
a?: number;
b: number;
c?: {
d?: {
e?: number;
@Aschen
Aschen / README.md
Last active January 17, 2025 05:31
Benchmarking AsyncLocalStorage

What is the overhead of AsyncLocalStorage?

Run the benchmark:

$ npm i benchmark

# Run the AsyncLocalStorage benchmark
$ node async-local-storage.js ASL
ASL x 15,551 ops/sec ±3.30% (79 runs sampled)
@prmichaelsen
prmichaelsen / deep-complete.ts
Created May 16, 2019 23:37
recursively mark all properties of a typescript type as defined
/** private type, not exported */
declare type NonObject = undefined | null | boolean | string | number | Function;
/**
* This type allows you to mark an object with
* optional properties as required.
*/
export declare type Complete<T> = {
[K in keyof T]-?: T[K];
}
/**
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active April 25, 2025 01:50
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@Akiyamka
Akiyamka / blend-mode-polyfill.js
Created November 9, 2018 10:13
blend-mode-polyfill
/**
* @author Boggddan <github.com/boggddan>
* Запускается в браузерах которые не поддерживают свойство background-blend-mode.
* Полифил применяется к тегам помеченым атрибутом `data-background-blend-mode` в свойтвах которого нужно передать режим смешивания.
* Поддерживается: normal, multiply, lighten, screen, darken. (протестировано в IE 11)
* @example: <div data-background-blend-mode="multiply"></div>
*/
/* Element.prepend polyfill for IE 11 */
function prependPolyfill() {
const delay = (time) => {
return new Promise(resolve => setTimeout(resolve, time));
};
const serviceFactory = (timeout) => {
return async () => {
await delay(timeout);
return timeout;
};
};
@hollodotme
hollodotme / Install-nginx-with-http2-support.md
Created April 9, 2016 17:07
Install nginx with http2 support on ubuntu 14.04 LTS (Trusty)

How to install nginx (>= 1.9.5) with http2 support on Ubuntu 14.04 LTS (Trusty)

IMPORTANT: Backup your nginx site configs (usually under /etc/nginx/sites-available)!

Remove old nginx

Remove old nginx incl. nginx-common:

apt-get autoremove --purge nginx nginx-common
@atian25
atian25 / README.md
Created March 9, 2016 14:07 — forked from steve-jansen/README.md
Stop and start Symantec Endpoint Protection on OS X

This script enables you stop and start Symantec Endpoint Protection on OS X

Installation

sudo curl https://gist.githubusercontent.com/steve-jansen/61a189b6ab961a517f68/raw/sep -o /usr/local/bin/sep
sudo chmod 755 /usr/local/bin/sep
sudo chown root:staff /usr/local/bin/sep
@anvaka
anvaka / 00.Intro.md
Last active April 23, 2025 22:53
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score