Skip to content

Instantly share code, notes, and snippets.


EJ Mason mxmason

View GitHub Profile
View soFetch.js
* A small lib for fetching with query parameters.
* CREDIT: discussion in this issue thread:
* @param {String} url
* @param {Object} [opts={}] The init options for the fetch request
* @param {Object} [opts.params] The key-value pairs that will be used to build a query string
* @example
* // Makes a GET request to ``
* soFetch('');
* // Makes a GET request to with query params
mxmason / webflow-disable-scroll-prefers-reduced-motion.js
Last active Jan 15, 2021
These snippets completely disable the smooth-scroll animation that is present on all Webflow sites. Animated scrolling can disorient or surprise users, or even cause motion sickness!
View webflow-disable-scroll-prefers-reduced-motion.js
// Disable smooth scrolling for users who have set `prefers-reduced-motion` in their operating system
// 1. Place this snippet before the end of the <body> tag;
// NOT in the <head> tag!
// 2.Make sure it's inside $(function() {})!
$(function() {
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
if (mediaQuery.matches) $(document).off('');
View a-better-form.markdown

A Better Form™

Don't mind this. I made it because I was mad about a specific thing that I saw on the Internet.

A Pen by EJ Mason on CodePen.


View cryptoUUID.js
// Using the web crypto API is a quick way to get a pseudo-random number.
// It's is experimental in IE11 and namespaced behind a prefix.
var crypto = window.crypto || window.msCrypto;
// Generates a uuidv4-compliant string
// credit:
function uuidv4() {
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
c ^
View getFocusableChildren.js
View pe-generic-setup-demo.html
<!-- External dependencies the component needs to run (optional) -->
<script src=""></script>
<!-- Polyfill loaders - Will not execute for modern browsers -->
<!-- WebComponents -->
<script src="^2/webcomponents-loader.js"></script>
<!-- JS features -->
<script src=""></script>

Data Structure and Algorithms: Full Stack Project

You've been asked to create a site for an animal shelter which allows adoption of cats and dogs. These are the only two animals allowed in the shelter. The adoption process works strictly on a first-in, first-out basis. People can adopt a cat, or a dog, or both, but they may only adopt the oldest one (by arrival time, not age) that is in the shelter.

The following instructions should guide you to through the project from start to finish. Be sure to follow them in the order!

If you’re the sort of person who likes a working example, you can see the working client and the working server for yourself.

Setting up

This app will use two distinct repositories: one for the client, and one for the server.

  • Create the parent directory for your app on your local machine: mkdir AnimalShelter