Skip to content

Instantly share code, notes, and snippets.

#!/bin/zsh
# Script that tests if a TEST_BRANCH can be merged successfully into
# a TARGET_BRANCH.
#
# Usage: git_merge_test.sh [-i] [TARGET_BRANCH] [TEST_BRANCH]
#
# Example: git_merge_test.sh dev feature-new-stuff
#
# Inspect conflicts: the script will clean up automatically unless you
function copyItem(text) {
const tempElement = document.createElement('div');
tempElement.innerHTML = text;
const copy = (event) => {
if (event.clipboardData) {
event.clipboardData.setData('text/html', tempElement.innerHTML);
event.clipboardData.setData('text/plain', tempElement.innerHTML);
event.preventDefault();
}
@robballou
robballou / git_branches.sh
Created April 10, 2020 21:02
Find branches that are removed/deleted from remote
#!/bin/zsh
#
# Checks local branches to see if the branch is on remote and tracking remote that is still there.
#
# Does not delete branches automatically, but will provide a command in cases where you have a local
# branch that is not on remote and is tracking a now-gone remote branch.
#
main() {
@robballou
robballou / regex.ts
Last active July 3, 2019 19:57
JavaScript regex for find/replace
// Match function declarations for converting to function expressions
const regex = /^(export\s?)?(async\s?)?function ([^(]+)(\([^)]*\))(\s*:[^{]+)? {/
// replace: $1const $3 = $2$4$5 => {
// class methods... caution! this also replaces if statements
const regex2 = /([^(]+)\((.+)\) {/
// replace $1 = ($2) => {
@robballou
robballou / .babelrc
Created January 26, 2018 21:37
Using new babel with shippedProposals
{
"presets": [
[
"@babel/env",
{
"targets": {
"node": "current"
},
"shippedProposals": true
}
@robballou
robballou / example.sh
Last active January 9, 2018 20:38
Bash examples for my own memory's sake...
#!/bin/bash
# check number of arguments, output a message to STDERR
if [[ "$#" -eq "0" ]]; then
2>&1 echo "Usage: $0 FILE"
exit 1
fi
# check if an argument equals a string
if [[ "$1" = "dev" ]]; then
@robballou
robballou / branch.sh
Created March 28, 2017 15:50
Branch sub folders
#!/bin/bash
#
# Change git branches in all subfolders (that are git repos)
#
# Usage: ./resources/scripts/branch.sh BRANCH
#
set -e
@robballou
robballou / ffmpeg_commands.md
Last active March 21, 2017 19:31
Various commands for ffmpeg

Various ffmpeg commands:

  • Audio rate: limit audio rate to 44100: ffmpeg -i INPUT -ar 44100 OUTPUT
#!/usr/bin/env python
"""
workTime.py
Coded by: Rob Ballou ([email protected])
Calculates the number of hours that have passed
in a work day (starting at 8:30).
The start time can be changed by passing the hour and min
@robballou
robballou / commit_everything.sh
Last active May 10, 2018 14:53
Updated commit everything script
#!/bin/bash
#
# Usage: ./commit_everything.sh "Commit message"
#
# This script will commit everything! This means that it will commit changes
# in submodules, subprojects, and the parent repo (if there is one). This came
# about after working on several projects with varying git repo setups and
# provides a single interface for all kinds of committing!
#
# The commit message provided is used on all commits except those commits