Skip to content

Instantly share code, notes, and snippets.

View robvolk's full-sized avatar

Rob Volk robvolk

View GitHub Profile
@robvolk
robvolk / Claude.md
Created October 15, 2025 15:34
Foxbox Claude.md

Development workflow

Whenever working in a new session start by opening a branch. Use the conventional commits syntax from here https://www.conventionalcommits.org/en/v1.0.0/ based on the initial prompt to create a branch and also do small commits with logical chunks of work based on your plan. Always run the linter and format code before committing. When you are done always push your work to the remote branch for review.

Conventional Commits

Use the prefixes below based on the work being done. Use this for branch names and commits.

  • feat: for general feature work
  • infra: for updating terraform, cloud infrastructure, or gitlab CI/CD configuration
@robvolk
robvolk / .bash_profile.sh
Created August 21, 2018 16:58
Cleanup git branches
gitc() {
git fetch --prune
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`;
do
git branch -D $branch
done;
git branch --merged master | grep -v '^*' | grep -v '^ master$' | xargs git branch -d
}
" Rob Volk's .vimrc, completely based off of " This is Rob Volk's .vimrc, completely based off of Gary Bernhardt's .vimrc file
" vim:set ts=2 sts=2 sw=2 expandtab:
autocmd!
call pathogen#infect('bundle/{}')
call plug#begin('~/.vim/plugged')
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
@robvolk
robvolk / upgrade_vim.sh
Created August 9, 2017 15:27
Upgrade / Update Vim & all plugins
function upgrade-vim {
brew update
brew upgrade vim
cd ~/.vim/bundle
for i in `ls`; do
cd "$i"
git pull
cd ..
done
@robvolk
robvolk / slack_scrabble_emoji.sh
Created July 26, 2017 22:10
Slack Scrabble Emoji function in Bash
function scrabble {
node -p -e "const s = '$1'; let o = ''; for (c of s) o += ':scrabble-' + c + ': '"
}
@robvolk
robvolk / rails_console_reload.rb
Created January 12, 2017 19:40
Reload file in lib on Rails Console
load "#{Rails.root}/lib/my_file.rb"
@robvolk
robvolk / es6_fetch_example.js
Last active October 17, 2019 16:46
AJAX requests in ES6 using fetch()
// ES6 Fetch docs
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
fetch('https://some.url.com')
.then(response => {
if (response.ok) {
return Promise.resolve(response);
}
else {
return Promise.reject(new Error('Failed to load'));
@robvolk
robvolk / hash_has_values.js
Last active November 3, 2016 23:23
Determine if a hash has any of a set of values defined using sweet ES6 functional programming methods #map and #reduce
function hasValues(hash, fields) {
return fields.map(field => {
return hash[field] != null;
}).reduce((x, y) => { return x || y });
}
hash = { name: "robert paulson", affiliation: "fightclub" };
hasValues(hash, [ "name", "email" ]); // => true
hasValues(hash, [ "email" ]); // => false
@robvolk
robvolk / count_values_of_array.rb
Last active February 15, 2016 19:12
Count & sort values of a Ruby Array
food = ["bacon", "eggs", "cheese", "eggs", "bacon", "bacon", "bacon"]
food.inject(Hash.new(0)) {|h, k| h[k] += 1; h }.sort_by {|k,v| -1 * v}
# => [["bacon", 4], ["eggs", 2], ["cheese", 1]]
@robvolk
robvolk / enable_moped_logger.rb
Created August 18, 2015 17:14
See raw MongoDB queries from Mongoid / Moped by enabling Logger
# From Rails console, run the following and you'll see raw Moped queries for every Mongoid query!
Moped.logger = Logger.new(STDOUT)