Skip to content

Instantly share code, notes, and snippets.

View HarishChaudhari's full-sized avatar

Harish Chaudhari HarishChaudhari

View GitHub Profile
@HarishChaudhari
HarishChaudhari / passwordRegex.js
Created August 1, 2016 13:29
Password validation RegEx for JavaScript
/**
* Password validation RegEx for JavaScript
*
* Passwords must be
* - At least 8 characters long, max length anything
* - Include at least 1 lowercase letter
* - 1 capital letter
* - 1 number
* - 1 special character => !@#$%^&*
*
@HarishChaudhari
HarishChaudhari / call-dom-manipulator.js
Created December 7, 2022 05:06
JavaScript DOM Manipulator
const manipulator = new DOMManipulator();
// Create a new div element with an ID of "myDiv", a class of "myClass", and some content
const myDiv = manipulator.createElement('div', 'myDiv', 'myClass', 'Hello, world!', {
'data-id': 123,
'data-name': 'John Doe'
});
// Modify the div element to update its class and content, and add a new attribute
manipulator.modifyElement(myDiv, null, 'myOtherClass', 'Hello, world! How are you?', {