In a time when you work on multiple projects with different development environments (mostly in JVM ecosystem), It's hard and repetitive work to change your env or java version, etc. I found the integration between sdkman and direnv as a solution for myself.
- Install sdkman SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems.
- Install direnv direnv is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Open GitKraken using the current repo directory. | |
| ## For when you want a prettier view of your current repo, | |
| ## but prefer staying in the cli for most things. | |
| ## This will break if GitKraken ever removes the -p flag. | |
| ## If you're not using OSX, the path is definitely different. | |
| kraken () { | |
| ~/Applications/GitKraken.app/Contents/MacOS/GitKraken -p $(pwd) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Formatting constants | |
| export BOLD=`tput bold` | |
| export UNDERLINE_ON=`tput smul` | |
| export UNDERLINE_OFF=`tput rmul` | |
| export TEXT_BLACK=`tput setaf 0` | |
| export TEXT_RED=`tput setaf 1` | |
| export TEXT_GREEN=`tput setaf 2` | |
| export TEXT_YELLOW=`tput setaf 3` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Usage: | |
| // p(instance)('privateMethod)(arg1, arg2, arg3) | |
| class PrivateMethodCaller(x: AnyRef, methodName: String) { | |
| def apply(_args: Any*): Any = { | |
| val args = _args.map(_.asInstanceOf[AnyRef]) | |
| def _parents: Stream[Class[_]] = Stream(x.getClass) #::: _parents.map(_.getSuperclass) | |
| val parents = _parents.takeWhile(_ != null).toList | |
| val methods = parents.flatMap(_.getDeclaredMethods) | |
| val method = methods.find(_.getName == methodName).getOrElse(throw new IllegalArgumentException("Method " + methodName + " not found")) |