Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Peña anthonypena97

View GitHub Profile
View Pointer Coordinates
// from work with three.js project
// desktop pointer
pointer.x = (event.clientX / window.innerWidth) * 2 - 1;
pointer.y = - (event.clientY / window.innerHeight) * 2 + 1;
// mobile touch
pointer.x = +(event.targetTouches[0].pageX / window.innerWidth) * 2 + -1;
pointer.y = -(event.targetTouches[0].pageY / window.innerHeight) * 2 + 1;
@anthonypena97
anthonypena97 / email-regex.md
Last active Sep 23, 2021
Email RegEx Validation Tutorial
View email-regex.md

Email RegEx Validation

Follow along this gist for an explanation on targeting email address strings using a Regular Expression in JavaScript.

Summary

Our Regular Expression: /^([a-z0-9_.-]+)@([\da-z.-]+).([a-z.]{2,6})$/

A Regular Expression, or RegEx, is used to target a string value. The expression itselfs specifies the composition of the string that is being targetted.