Skip to content

Instantly share code, notes, and snippets.

View TravisBernard's full-sized avatar

Travis Bernard TravisBernard

View GitHub Profile
@TravisBernard
TravisBernard / notes.md
Last active April 6, 2024 21:19
VSCode Key Bindings

File: Reveal Active File In Explorer View: CMD+1

focusActiveEditorGroup: CMD+2

terminal.focus: CMD+3

Abracadabra: Convert To Template: CMD+SHFT+'

Refactor...: OPT+CMD+M

@TravisBernard
TravisBernard / .zshrc
Last active March 30, 2023 16:16
Git Prompt for ZSH
####
# Some of my favorite things
####
alias g="git"
alias app="code ~/Development/app"
####
# GIT PROMPT
# adapted from: https://www.themoderncoder.com/add-git-branch-information-to-your-zsh-prompt/
# with additions from: https://salferrarello.com/zsh-git-status-prompt/
@TravisBernard
TravisBernard / main.applescript
Created February 22, 2023 20:37
AppleScript to Open Jira
set jiraID to display dialog "Jira ID?" default answer "" with icon note buttons {"Cancel", "Continue"} default button "Continue"
open location "https://SCRUBBED.atlassian.net/browse/" & (text returned of jiraID)
@TravisBernard
TravisBernard / .gitconfig
Last active September 29, 2023 20:40
My favorite git aliases
[alias]
aa = add --all ; add all files from workspace to stage
ap = add -p ; interactively add files from workspace to stage
c = commit -m ; commit with message - usage git c "message here"
f = fetch --all --prune --tags; update local branch index from remotes
s = status
b = branch
ch = checkout
lo = log --oneline ; show commits in abbreviated format
home = checkout main ; checkout main branch
@TravisBernard
TravisBernard / dropFkIfExists.sql
Created September 4, 2020 15:14
Drop FK IF EXISTS
-- Derived from https://stackoverflow.com/a/34545062/2992570
DROP PROCEDURE IF EXISTS dropForeignKeyIfExists;
delimiter ///
create procedure dropForeignKeyIfExists(IN tableName VARCHAR(64), IN constraintName VARCHAR(64))
begin
IF EXISTS(
SELECT * FROM information_schema.table_constraints
WHERE
@TravisBernard
TravisBernard / backup.sh
Last active November 25, 2020 15:14
Backup and Restore Docker Based Mysql
# Backs up the data from a docker mysql instance to the host machine's file system
docker-compose exec $MACHINEID mysqldump -uuser -ppass --all-databases > /host/machine/path/backup.sql
# Or
docker exec $MACHINEID mysqldump -uuser -ppass --all-databases > /host/machine/path/backup.sql
@TravisBernard
TravisBernard / reducers.js
Created January 2, 2019 18:13
Using Jest, create a mock that maintains real functionality but also allows method spying.
// FILE: __mocks__/reducers.js
/*
* Wrap every function exported in a module with a Jest mock fn, keeping the original implementation.
* Allows for using the fn().mock.xxx properties to test fn usage and i/o while still maintaining the original
* functionality
*
* Originally wrote this to wrap around Redux reducers and action creators in a React project to spy on reducer
* activity while still testing the store's side effects
*/
@TravisBernard
TravisBernard / allthethings.sh
Last active August 18, 2018 21:12
Clean all the things (M2)
#!/bin/bash
# Derived from
# https://github.com/btford/allthethings
#
# Licensed under WTFPL http://sam.zoy.org/wtfpl/
#
pur=$(tput setaf 5) # Purple
@TravisBernard
TravisBernard / install_magento2_with_db
Last active December 15, 2017 17:25 — forked from wsakaren/install_magento2_with_db
Install script for magento2 with database, assumes you are running from www.localhost.com/20
#!/bin/bash
# Sets up a database with a magento2 installation. This assumes you are running from under your httpdocs/<release> location and have www.localhost.com in your /etc/hosts file
# To run type : install_magento2 <dirname> <password> <release>
# password is used for the datbase user and the magento admin password
if [ $# -eq 0 ]; then
echo "No arguments supplied"
echo "Usage: `basename $0` <dirname> <password> <release>"
echo "e.g install_magento2.sh mage2 password 21"
exit 1