Skip to content

Instantly share code, notes, and snippets.

View hoangphunam0604's full-sized avatar
🐢
slowly

Hoang Phu Nam hoangphunam0604

🐢
slowly
View GitHub Profile
@hoangphunam0604
hoangphunam0604 / abstract-unique-validator.ts
Created January 5, 2021 02:36 — forked from zarv1k/abstract-unique-validator.ts
Unique Validator Example for NestJS
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
import { Connection, EntitySchema, FindConditions, ObjectType } from 'typeorm';
interface UniqueValidationArguments<E> extends ValidationArguments {
constraints: [
ObjectType<E> | EntitySchema<E> | string,
((validationArguments: ValidationArguments) => FindConditions<E>) | keyof E,
];
}
@hoangphunam0604
hoangphunam0604 / JapaneseRegex.js
Created December 15, 2023 02:02 — forked from ryanmcgrath/JapaneseRegex.js
Regex to test for presence of Japanese characters
// REFERENCE UNICODE TABLES:
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml
// http://www.tamasoft.co.jp/en/general-info/unicode.html
//
// TEST EDITOR:
// http://www.gethifi.com/tools/regex
//
// UNICODE RANGE : DESCRIPTION
//
// 3000-303F : punctuation