Skip to content

Instantly share code, notes, and snippets.

View Chip-L's full-sized avatar

Chip Long Chip-L

View GitHub Profile
@Chip-L
Chip-L / Asteroids-Helpers.js
Created June 28, 2023 05:42
Helper function for Asteroids game from NetNinja/ChrisCourses tutorial
getVertices() {
const cos = Math.cos(this.rotation)
const sin = Math.sin(this.rotation)
return [
{
x: this.position.x + cos * 30 - sin * 0,
y: this.position.y + sin * 30 + cos * 0,
},
{
@Chip-L
Chip-L / slideDown.css
Last active August 7, 2021 18:28
Animate a div to slide down into view using pure CSS
/* This adds the animation to slide a div with text up and down.
However, I only want this to happen if the feature is supported (it is on most browsers --
https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-fill-color)
*/
@supports (-webkit-text-fill-color: transparent) {
.container {
/* hide the container above it's actual location */
transform: translateY(-100%);
transform-origin: top;
@Chip-L
Chip-L / graphql-sequelize-tutorial.md
Last active July 19, 2021 06:53
GraphQL, Sequelize, and an Apollo server - Comments on a tutorial
@Chip-L
Chip-L / gist:3d5459807431b8f75282bead6923b951
Last active June 12, 2021 17:41
RegEx Tutorial: Matching a [US] Phone Number

RegEx Tutorial: Matching a [US] Phone Number

There are many times we need to validate the data that is entered is what we expect it to be. A common area we need to validate data for is a phone number. In the United States, although there is a proper format for the phone number, in this day of computers, many people don't use that format. Regex will allow us to test the most common formats of phone numbers for validity.

Table of Contents