Skip to content

Instantly share code, notes, and snippets.

@jcamblan
Last active March 4, 2023 12:47
Show Gist options
  • Save jcamblan/6f93d390806143ad1e15aecfdf9695fc to your computer and use it in GitHub Desktop.
Save jcamblan/6f93d390806143ad1e15aecfdf9695fc to your computer and use it in GitHub Desktop.
export PATH=$PATH:/opt/homebrew/bin
export ZSH="/Users/julien/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh
eval "$(direnv hook zsh)"
eval "$(nodenv init -)"
# Ruby/Rails aliases
alias be='bundle exec'
alias rspec='be rspec'
alias rake='be rake'
alias prystory='code ~/.pry_history'
# Git aliases
alias gs='git status'
alias gch='git checkout'
alias gco='git commit -m'
# Zsh aliases
alias restart='exec zsh -l'
alias zshrc='code ~/.zshrc'
alias ls='lsd'
alias ll='ls -l'
alias lt='ls --tree'
# open a rails console on the given scalingo application
sconsole() {
APP_NAME=$1
scalingo -a $APP_NAME run bundle exec rails c
}
# pg_restore the selected dump on the selected scalingo app
scalingo_pg_restore() {
APP_NAME=$1
DUMP_PATH=$2
sh ~/workspace/restore_db_scalingo.sh $APP_NAME $DUMP_PATH
}
# start ngrok web app on selected region & port
ngrok() {
REGION=$1
PORT=$2
echo "Running: ~/workspace/ngrok http --region=${REGION} --hostname=jcamblan.${REGION}.ngrok.io ${PORT}"
~/workspace/ngrok http --region=$REGION --hostname=jcamblan.$REGION.ngrok.io $PORT
}
# puts the result of a rails command
rputs() {
bin/rails runner "puts $1"
}
# kill rails server process
kill_rails() {
PID=$(lsof -wni tcp:3000 | grep ruby | head -1 | awk '{print $2}')
kill -9 $PID
}
# base64 converters shortcuts
encode64() { echo $1 | base64 }
decode64() { echo $1 | base64 -d }
# Ruby on Mac script's stuff
alias rom='cd ~ && /usr/bin/env bash ~/rom-prime 2>&1 | tee ~/rom-prime.log'
source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
# ruby default version
chruby ruby-3.1.2
# node default version
nodenv global 16.14.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment