Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fengmk2's full-sized avatar
:atom:
Coding at antgroup.com

fengmk2 fengmk2

:atom:
Coding at antgroup.com
View GitHub Profile
@gomezcabo
gomezcabo / recursive-required.ts
Last active April 19, 2024 01:52
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;
@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];
}
/**
@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 March 7, 2024 13:07
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
# the path where screenshots to save
SS_PATH="/tmp"
# if you want to save them to your desktop, SS_PATH should be "/Users/YOURNAME/Desktop"
# a variable of unix timestamp for screenshot file name
NOW=$(date +%s)
# execute screen capture command, screenshot$NOW.png is the name of file
screencapture -i -r $SS_PATH/screenshot$NOW@2X.png
@getify
getify / gist:7ae82fdc2e86bf66bcba
Last active March 27, 2022 19:50
List of ES6 books either out or in progress...