Skip to content

Instantly share code, notes, and snippets.


Devin Rhode devinrhode2

View GitHub Profile
devinrhode2 / generateMouseEventHandler.js
Last active May 4, 2020
discover coordinates for a cypress manual coordinate click
View generateMouseEventHandler.js
// paste this into a file like location-map-component.js:
if (typeof window !== 'undefined') {
window.addEventListener('mousemove', (e) => {
'x', e.x,
'y', e.y,
'ofsX', e.offsetX,
'ofsY', e.offsetY,
'cursor:', document.getElementsByClassName('MicrosoftMap')[0].style.cursor || '""',
{ el: }
View gist:f66032724783f7c2b3945dac5db01811
- option/alt key sends Esc+
- option left arrow
zsh stuff
git ssh
View global .gitconfig
excludesfile = ~/.gitignore_global
editor = code --wait
pager = cat
ignorecase = false
email =
name = devinrhode2
tool = code
devinrhode2 /
Last active Feb 13, 2020
answer to bens quiz question
View How I

First, run a vanilla git rebase. Then in vs code... "Undo" all commits you may want to modify. (in git sidebar, there's a "..." button with a ton of git related actions) From here, you would use vscode git diff editor/viewer, and highlight chunks of code to stage. From there it's personal opinion as to exactly how to group the code changes into one or a series of commits.

devinrhode2 /
Created Jan 4, 2020
Some submodule post-checkout and post-merge scripts+dump of submodule notes

In your package.json scripts... add these without newlines/escapes

    "submodulePostCheckoutCorrectDetachedHeads": "
    git submodule sync --recursive &&
    git submodule update --checkout &&
    git submodule foreach \
        git branch -r --contains `git log -1 --pretty=format:\"%h\"`
       ) node $toplevel/dev-scripts/checkout_right_branch $sm_path'", // end submodule post-checkout
    "submodulePostMergeUpdateSubmoduleMerge": "
View Always securely use square brackets.js
const safeGet = (obj, key) => {
if (obj[key] == null) obj[key];
if (typeof obj[key] === 'function') {
throw new Error('Cannot safely get '+key+' since it a function. Use square bracket syntax to directly access instead.');
if (, key)) {
return obj[key];
} else {
// This console log could be rather buggy:
devinrhode2 /
Created Sep 29, 2019 — forked from infval/ download workaround (Most games + Sega Dreamcast, Books/Comics/Guides/Magazines)
// ==UserScript==
// @name EmuParadise Download Workaround
// @version 1.2.2
// @description Replaces the download button link with a working one
// @author infval (Eptun)
// @match*/*/*
// @grant none
// ==/UserScript==
devinrhode2 / get-env-var.js
Last active Sep 25, 2019
attempt to try and change environment variables used in .eslintrc.js for CRA dev server without restarting the dev server
View get-env-var.js
/* Usage:
const initGetEnv = require('./dev-scripts/get-env-var.js');
const env = initGetEnv({
useLiveEnv: typeof process.env.USE_LIVE_ENV !== 'undefined'
if (env('foobar')) doSomething();
// The idea is that you'd be able to change variables on the fly by editing the file.
View getIEVersionInt
formatting for 1st answer on
const ieVersionInt = (function getIEVersionInt(){
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer') {
let ua = navigator.userAgent,
re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");
if (re.exec(ua) !== null){
You can’t perform that action at this time.