Skip to content

Instantly share code, notes, and snippets.

View anthonypena97's full-sized avatar

Anthony Pena anthonypena97

View GitHub Profile
// 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 September 23, 2021 11:48
Email RegEx Validation Tutorial

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.