Skip to content

Instantly share code, notes, and snippets.

😀

Devin Rhode devinrhode2

😀
View GitHub Profile
@devinrhode2
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) => {
console.log(
'x', e.x,
'y', e.y,
'ofsX', e.offsetX,
'ofsY', e.offsetY,
'cursor:', document.getElementsByClassName('MicrosoftMap')[0].style.cursor || '""',
{ el: e.target }
View gist:f66032724783f7c2b3945dac5db01811
vscode
iterm2
- option/alt key sends Esc+
- option left arrow https://coderwall.com/p/h6yfda/use-and-to-jump-forwards-backwards-words-in-iterm-2-on-os-x
zsh stuff
gitignore
git ssh
https://support.mozilla.org/en-US/questions/1113500
View global .gitconfig
[core]
excludesfile = ~/.gitignore_global
editor = code --wait
pager = cat
ignorecase = false
[user]
email = devinrhode2@gmail.com
name = devinrhode2
[merge]
tool = code
@devinrhode2
devinrhode2 / answer-to-bens-quiz-question.md
Last active Feb 13, 2020
answer to bens quiz question
View answer-to-bens-quiz-question.md
View How I rebase.md

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
devinrhode2 / dump.md
Created Jan 4, 2020
Some submodule post-checkout and post-merge scripts+dump of submodule notes
View dump.md

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

    "submodulePostCheckoutCorrectDetachedHeads": "
    git submodule sync --recursive &&
    git submodule update --checkout &&
    git submodule foreach \
      'latest_commits_remote_branch=$(\
        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
// WORK IN PROGRESS...
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 (Object.prototype.hasOwnProperty.call(obj, key)) {
return obj[key];
} else {
// This console log could be rather buggy:
@devinrhode2
devinrhode2 / emuparadise.download.user.js
Created Sep 29, 2019 — forked from infval/emuparadise.download.user.js
emuparadise.me download workaround (Most games + Sega Dreamcast, Books/Comics/Guides/Magazines)
View emuparadise.download.user.js
// ==UserScript==
// @name EmuParadise Download Workaround
// @version 1.2.2
// @description Replaces the download button link with a working one
// @author infval (Eptun)
// @match https://www.emuparadise.me/*/*/*
// @grant none
// ==/UserScript==
// https://www.reddit.com/r/Piracy/comments/968sm6/a_script_for_easy_downloading_of_emuparadise_roms/
@devinrhode2
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 .env.live file.
View getIEVersionInt
formatting for 1st answer on https://stackoverflow.com/questions/31757852/how-can-i-detect-internet-explorer-ie-and-microsoft-edge-using-javascript/32107845
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.