Skip to content

Instantly share code, notes, and snippets.

View MichaelDimmitt's full-sized avatar
:shipit:
𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫

MichaelDimmitt

:shipit:
𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫𒐫
View GitHub Profile
@MichaelDimmitt
MichaelDimmitt / BashResourceSuggestions.md
Last active November 1, 2021 04:15
bash suggested resources.

This will be an ongoing list for personal reference.

IsaacG - from exercism https://exercism.org/tracks/bash/exercises/hamming/solutions/IsaacG

The && and || in bash are short-circuit logical operators. They quit evaluating as soon as possible.

a && b will only run b if a is true. a || b will only run b if a is false. a || b || c will stop as soon as anything is true. a && b || c will run a and ... b or c or both!! This is why a full blown if-else is often a good idea.

( is a subprocess. The exit status of the subprocess does propagate to the parent shell. If you got set -e (not recommended), you'd get its exit status. But a subshell cannot exit the parent shell.

@MichaelDimmitt
MichaelDimmitt / my-quick-no-mouse-keyboard-shortcuts.md
Last active February 7, 2025 13:13
macbook keyboard navigation with no mouse - personal cheat sheet

Mac Computer

system commands

  • navigation
    hold fn hold control f2 - navigate to toolbar menu
    fn - mission control

  • text cursor - emacs stamdard
    ctrl a - go to beginning
    ctrl e - go to end

@MichaelDimmitt
MichaelDimmitt / gist:959016f53ce93e6fe0d095313a973140
Last active August 26, 2021 10:10
How to handle database does not exist.
brew install postgresql;
brew services start postgresql;

psql: error: FATAL: database "michaeldimmitt" does not exist

psql postgres;
postgres=# CREATE DATABASE michaeldimmitt with OWNER michaeldimmitt;
@MichaelDimmitt
MichaelDimmitt / DeployToSurge.md
Created May 31, 2021 14:55
Deploy surge with cors enabled and https

Deploy surge with cors enabled and https

npm install -g surge
yarn build;
cp build/index.html build/200.html;
echo '*' > build/CORS;
surge build appname.surge.sh
@MichaelDimmitt
MichaelDimmitt / links-beginners-found-helpful.md
Last active April 26, 2021 00:07
try it out add a comment if you have a question. cheers!
@MichaelDimmitt
MichaelDimmitt / poor-mans-render-one-time.md
Created March 6, 2021 20:20
quick poor mans, way for react to tell how many of these components exist by rendering one time.

Everyone seems to know this, but here is a good refresher in case I ever forget.

  useEffect(() => { console.log('I am a component, 1 render') }, [true]);

Pointed empty array works you dont need true, My paranoid self thought that I read in the documentation that empty array would track all. This was not the case.

  useEffect(() => { console.log('I am a component, 1 render') }, []);
#!/usr/bin/env bash
#{{{ MARK:Header
#**************************************************************
##### Author: JACOBMENKE
##### Date: Mon Jul 10 12:10:25 EDT 2017
##### Purpose: bash script to contain open, copy and paste commands
##### Notes:
#}}}***********************************************************
if [[ -z "$ZPWR_OS_TYPE" ]]; then
@MichaelDimmitt
MichaelDimmitt / javascript_checking the inferred type.md
Last active December 20, 2020 19:22
Checking types in javascript.md

https://stackoverflow.com/a/332445/5283424

function a() { this.foo = 1;}
function b() { this.bar = 2; }
b.prototype = new a(); // b inherits from a
var f = new b();
function type(obj){
 return Object.prototype.toString.call(obj).match(/\s\w+/)[0].trim()
@MichaelDimmitt
MichaelDimmitt / javascript_when to use_preventDefault stopPropagation.md
Last active May 3, 2024 14:43
Today I learned, when to use: event.preventDefault(); event.stopPropagation();

Today I learned, when to use:

  event.preventDefault();
  event.stopPropagation();

Ever need to have a click event on a child element trigger but not on the parent element?

Anyone use event.preventDefault on a regular basis?

Found a really good explanation with working examples on stack overflow πŸŽ‰