Skip to content

Instantly share code, notes, and snippets.

View ToniRib's full-sized avatar

Toni Rib ToniRib

View GitHub Profile
@ToniRib
ToniRib / fish_prompt.fish
Last active June 29, 2018 17:30
Simple Fish Prompt for QA
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set_color e22265
printf (date "+%I:%M:%S%p ")
set_color normal
set_color -o f18f1b
echo -n (basename $PWD)
set_color normal
@ToniRib
ToniRib / push_build.md
Last active December 20, 2017 17:09
push build to GitHub & trigger CircleCI build (fish)

Usage: push_build <branch-name:required>

Shell: fish

Pushes the given branch to GitHub, triggers a build on CircleCI, and signs you up for Mac notifications to let you know if the build passed or failed when it is done.

function push_build
  if test (count $argv) -eq 0
 echo "Must include a branch name"
@ToniRib
ToniRib / create_pull_request.md
Last active July 2, 2019 16:38
Create a PR from the command line with fish!

Actions

  • Pushes the code to GitHub
  • Creates a pull request between the current branch and master
  • Includes the JIRA story link in the pull request description

Usage:

create_pull_request <story number:required> <title:optional>

@ToniRib
ToniRib / pre-commit-hooks.md
Last active January 5, 2018 00:29
Options for GSC main repo pre-commit hooks

Pre Commit Hook Options For Ruby Style Guide Violations

If you would like to use one of this options, perform the following:

  1. In whatever repo you want this turned on in, navigate to .git/hooks in the terminal.
  2. Run mv pre-commit.sample pre-commit to rename the sample file and activate it.
  3. Paste one of the following into that file and save.
  4. Feel free to edit anything you would like in your own hook! They aren't commited, so you're welcome to have a custom configuration.

All of these assume that rubocop is installed in the Gemfile and that a rubocop.yml file exists in the directory. At a minimum, rubocop must be installed. If you don't have a rubocop.yml file, the default configuration will be used.

Each of these only check against files that have been staged for the given commit.

" ============================================================================
" Toni Rib's vimrc
" ============================================================================
set nocompatible " be iMproved, required
filetype off " required
set shell=sh
" -------------------------------- Mappings ---------------------------------
@ToniRib
ToniRib / simple_set.rb
Last active August 24, 2016 11:52
Set implementation using Ruby, based on the Array class (repo: https://github.com/ToniRib/ruby_set_with_arrays)
class SimpleSet
attr_reader :elements
def initialize(elements = [])
@elements = elements.uniq
end
def contains?(element)
elements.include?(element)
end
set -g -x PATH /usr/local/bin $PATH
function a.
atom .
end
function ga.
git add .
end
function ll
ls -lGFah
end
function gcm
git commit -m $argv
end
function rvm --description='Ruby enVironment Manager'
# run RVM and capture the resulting environment
set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX)
bash -c 'source ~/.rvm/scripts/rvm; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
# apply rvm_* and *PATH variables from the captured environment
and eval (grep '^rvm\|^[^=]*PATH\|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/s/:/" "/g; s/^/set -xg /; s/=/ "/; s/$/" ;/; s/(//; s/)//')
# needed under fish >= 2.2.0
and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set_color 55f914
echo -n (basename $PWD)
set_color normal
echo -n ' '
__informative_git_prompt