Skip to content

Instantly share code, notes, and snippets.

View Hongyu-Zhuo's full-sized avatar

HYu Hongyu-Zhuo

  • China, Beijing
View GitHub Profile
@Hongyu-Zhuo
Hongyu-Zhuo / global-types.ts
Created August 7, 2023 06:25
typescript common types
declare global {
export type Stringified<T> = string & {
[P in keyof T]: { '_ value': T[P] };
// [P in keyof T]: T[P]
};
export interface JSON {
// stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;
stringify<T>(value: T, replacer?: (key: string, value: any) => any, space?: string | number): string & Stringified<T>;
// parse(text: string, reviver?: (key: any, value: any) => any): any;
parse<T>(text: Stringified<T>, reviver?: (key: any, value: any) => any): T;
@Hongyu-Zhuo
Hongyu-Zhuo / ImageUtills.ts
Last active February 18, 2021 06:34
Image orientation
export class ImageUtil {
constructor() {
}
init() {
window.URL = window.URL || webkitURL;
}
@Hongyu-Zhuo
Hongyu-Zhuo / flat-to-tree.ts
Last active December 11, 2020 05:55
Flat data array converted to tree data
export class TreeUtil<T extends TreeNode<T>> {
map: {[k: string]: number} = {};
roots: T[] = [];
/**
* @field status
* @type
* 0 - 未成功执行 `config` 方法;
* 1 - 已成功执行 `config` 方法;
*/
@Hongyu-Zhuo
Hongyu-Zhuo / sketch-never-ending.md
Created March 19, 2019 06:26 — forked from Bhavdip/sketch-never-ending.md
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com