Skip to content

Instantly share code, notes, and snippets.

View cloudworkpro-dave's full-sized avatar

Dave Luke cloudworkpro-dave

View GitHub Profile
Validator Description
contains(str, seed [, options ]) check if the string contains the seed.

options is an object that defaults to { ignoreCase: false}.
ignoreCase specified whether the case of the substring be same or not.
equals(str, comparison) check if the string matches the comparison.
isAfter(str [, date]) check if the string is a date that's after the specified date (defaults to now).
isAlpha(str [, locale, options]) check if the string contains only letters (a-zA-Z).

Locale is one of `['ar', 'ar-AE', 'ar-BH', 'ar-DZ', 'ar-EG', 'ar-IQ', 'ar-JO', 'ar-KW', 'ar-LB', 'ar-LY', 'ar-MA', 'ar-QA', 'ar-QM', 'ar-SA', 'ar-SD', 'ar-SY', 'ar-TN', 'ar-YE', 'bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-AU', 'en-GB', 'en-HK', 'en-IN', 'en-NZ', 'en-US', 'en-ZA', 'en-ZM', 'es-ES', 'fa-IR', 'fr-CA', 'fr-FR', 'he', 'hu-HU',
@swyxio
swyxio / react-query.d.ts
Last active March 3, 2021 16:39
react query fixed working types - its not updated for v1 so i fixed locally
// Type definitions for react-query 0.3
// Project: https://github.com/tannerlinsley/react-query
// Definitions by: Lukasz Fiszer <https://github.com/lukaszfiszer>
// Jace Hensley <https://github.com/jacehensley>
// Matteo Frana <https://github.com/matteofrana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ComponentType } from 'react';
// overloaded useQuery function with pagination
@rigwild
rigwild / aes.js
Last active April 28, 2024 12:47
Easily encrypt string or object using Crypto-JS AES encryption
'use strict'
const password = 'secure secret key'
const encrypt = (content, password) => CryptoJS.AES.encrypt(JSON.stringify({ content }), password).toString()
const decrypt = (crypted, password) => JSON.parse(CryptoJS.AES.decrypt(crypted, password).toString(CryptoJS.enc.Utf8)).content
// Encrypt
const encryptedString = encrypt('This is a string', password)
const encryptedObject = encrypt({ test: 'This is an object' }, password)