This is just one I found and seems pretty good
Author Archives: Mark
Good email regex
Featured
Removing env file from file
Featured
After adding .env to the .gitignore file, use to remove it from git. To remove it completely from the history use
To “map” through a js object use “for in” First we get each item in the object and call it ‘person’ to make it easier to read. Then loop through it’s data to populate the array. In our example “data” … Continue reading
Basic unit testing with Jest
Featured
Let’s say for example we have a back end function that checks if you are under age from a user’s date of birth. First we load that function: Then we set up some test data, like so: We then run … Continue reading
Full size background image
Featured
Background-size cover makes the image cover the whole screenBackground-position center centers the imageBackground-attachement fixed makes it so the image doesn’t move when you scroll down the page.
Using Reduce
Featured
Reduce is used somewhat similar to ‘map’ Zero is set as the initial value and then it goes through the array and adds each value (in this example the currentScore) to the totalScore which becomes the new ‘previousScore’. Here’s a … Continue reading
Checking a video to play it
Featured
This was from a long time ago. I think it had something to do with browser compatibility or device compatibility. Leaving it here in case it’s useful in the future.
The ConditionalWrap component checks the condition (in this example the element.url) and if it exists put the wrapper around the children, otherwise just render the children. The wrapper in this example is a link. You can put whatever content you … Continue reading
How to undo a pushed merge in Git
Featured
First use “git log” to find the commit hash of your merge and copy it somewhere. Then use You can then recommit with the comment of “revert merge” or something similar
An example when you could use this is when the video has ended to automatically close the video player and go back to the website.