Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Shults benjishults

  • SmartThings Inc.
View GitHub Profile
@benjishults
benjishults / karabiner.json
Last active Jul 30, 2020
for PC keyboard
View karabiner.json
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
View keybase.md

Keybase proof

I hereby claim:

  • I am benjishults on github.
  • I am benjishults (https://keybase.io/benjishults) on keybase.
  • I have a public key whose fingerprint is 1974 71B9 AF07 216D A15C 52C2 32FA 983E 9B0D EF24

To claim this, I am signing this object:

View pullUpstream.sh
#!/bin/bash
# put this file in the folder containing your repo folders.
# when run, it will try to do a git pull upstream of the current branch of each repo and print a message on each failure.
pushd . &> /dev/null
for dir in $( find . -maxdepth 1 -type d -print )
do
popd &> /dev/null
pushd "$dir" &> /dev/null
@benjishults
benjishults / checkStash.sh
Last active Apr 5, 2019
check whether there is a stash in the current branch
View checkStash.sh
#!/bin/bash
# put this file in the folder containing your repo folders.
# when run, it will check whether there is a stash in the current branch
pushd . &> /dev/null
for dir in $( find . -maxdepth 1 -type d -print )
do
popd &> /dev/null;
pushd "$dir" &> /dev/null;
@benjishults
benjishults / Application.java
Created Dec 31, 2018
Application second pass in enum refactor demo
View Application.java
public static void main(String[] args) {
Path file = Path.of(args[0]);
processorFactory(file).processFile(file);
}
@benjishults
benjishults / TextProcessor.java
Created Dec 31, 2018
TextProcessor in enum refactor demo
View TextProcessor.java
public class TextProcessor implements Processor {
@Override
public void processFile(Path file) {
System.out.println("process text file");
}
}
@benjishults
benjishults / DocumentType.java
Created Dec 31, 2018
DocumentType second pass in enum refactor demo
View DocumentType.java
public enum DocumentType implements Processor {
TXT("txt", "text") {
@Override
public void processFile(Path file) {
System.out.println("process text file");
}
},
MD("md", "markdown") {
@Override
public void processFile(Path file) {
@benjishults
benjishults / Application.java
Created Dec 31, 2018
Application second pass in enum refactor demo
View Application.java
public class Application {
public static void main(String[] args) {
Path file = Path.of(args[0]);
DocumentType.forPath(file).processFile(file);
}
}
@benjishults
benjishults / Processor.java
Created Dec 31, 2018
Processor third pass in enum refactor demo
View Processor.java
public interface Processor {
void processFile(Path file);
}
@benjishults
benjishults / Processor.java
Created Dec 31, 2018
Processor second pass in enum refactor demo
View Processor.java
public class Processor {
public void processFile(Path file) {
switch (DocumentType.forPath(file)) {
case TXT:
processTextFile(file);
break;
case MD:
processMarkdownFile(file);
break;
case HTML: