Skip to content

Instantly share code, notes, and snippets.

Mike Heavers heaversm

Block or report user

Report or block heaversm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
heaversm / js-library-glitch-fixes.js
Created Apr 5, 2020
Fixes for some weird but crucial bugs in JS
View js-library-glitch-fixes.js
//Polyfill for aframe/threejs raycasting
//navigator.xr.requestDevice is not a function
navigator.xr.requestDevice = navigator.xr.requestDevice || function () {
return new Promise((resolve, reject) => {
supportsSession: new Promise((resolve, reject) => {
immersive: true,
View Useful-css.css
.next-image-button:focus { /* disable focus ring */
outline: none;
.next-image-button:focus-visible { /* enable focus ring for assistive devices */
outline: 3px solid blanchedalmond;
/* avoid layout flash on images by setting default aspect ratio equal to initial width and height of html element */
heaversm /
Last active Feb 2, 2020
VSCode Shortcuts

VSCode Shortcuts


  • option + dbl_click to multiselect entire words.
  • opt + cmd + ↓ selects multiple lines
  • Pasting multi-line content into multi-line cursors distributes them, for example, among list items
  • cmd + d selects additional instances of the highlighted code
  • shift + cmd + l selects all instances of the highlighted code
  • shift + → expands selection one space
heaversm / react-functionality.js
Last active May 6, 2020
Common React Functionality
View react-functionality.js
/* reusable function to update any form input value with state */
state = {
title: ''
handleChange = (e)=>{
const {name, type, value} =;
console.log({name,type,value}); //gives keys to your console log values when you put brackets around them!
const val = type === 'number' ? parseFloat(value) : value; //converts numbers from strings
heaversm / styled-components.jsx
Last active Feb 2, 2020
Styled Components Conventions
View styled-components.jsx
import styled, { ThemeProvider, injectGlobal } from 'styled-components';
const theme = {
red: '#FF0000',
black: '#393939',
grey: '#3A3A3A',
lightgrey: '#E1E1E1',
offWhite: '#EDEDED',
maxWidth: '1000px',
bs: '0 12px 24px 0 rgba(0, 0, 0, 0.09)', /*box shadow*/
heaversm / common-js-tasks.js
Last active Apr 7, 2020
Common JS Tasks and Functions
View common-js-tasks.js
//basic async await
// this is the function we want to schedule. it's a promise.
const addOne = (x) => {
return new Promise(resolve => {
setTimeout(() => {
console.log(`I added one! Now it's ${x + 1}.`)
}, 2000);
# see outdated modules
npm outdated
# update all modules (latest minor version)
npm update --save/--save-dev
heaversm /
Created Oct 31, 2019
Useful helpers for wordpress
#Add a new user
wp user create <username> <email> --role=administrator --user_pass=mypassword
heaversm /
Last active Oct 16, 2019
Common JS Workflows


Use an ES6 Module

With Unpkg

Add type="module" to script tags:

<script type="module">
  //then make sure to use the param module in unpkg:
heaversm /
Created Oct 16, 2019
Useful git commands
#verify remotes
git remote -v
#edit git config
git config -e
You can’t perform that action at this time.