Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Rosenberg agrberg

  • Wheel
  • Austin, TX
View GitHub Profile
@agrberg
agrberg / ruby_version.sh
Created Oct 19, 2020
Ruby Version updating script
View ruby_version.sh
function rv() {
new_version=${1};
sed_command_base="^ruby.*\([[:digit:]]\.\)*[[:digit:]]*";
if [[ -z "$new_version" ]]; then
if [[ -e Gemfile ]]; then
echo "Gemfile: $(sed -ne /${sed_command_base}/p Gemfile)";
fi
if [[ -e .ruby-version ]]; then
@agrberg
agrberg / pre-push
Created Jul 1, 2020
This simple bash script ensures that bundle-audit is updated and called before a push to Heroku. The goal is to ensure that a developer deploying the site is 100% aware of any vulerable gems and _must_ intentionally use `--no-verify` if they do not want to update gems.
View pre-push
#!/usr/bin/env sh
# This simple bash script ensures that bundle-audit is updated and called before a push to Heroku
# The goal is to ensure that a developer deploying the site is 100% aware of any vulerable gems
# and _must_ intentionally use `--no-verify` if they do not want to update gems.
if [ "$1" = "heroku" ]; then
bundle exec bundle-audit check --update
fi
@agrberg
agrberg / environment.js
Created Apr 11, 2020
Getting webp images and autogeneration working in Rails 6
View environment.js
const IMAGE_REGEXP = /\.(?:jpe?g|png)$/; // https://regexper.com/#%2F%5C.%28%3F%3Ajpe%3Fg%7Cpng%29%24%2F
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin');
const { environment } = require('@rails/webpacker');
environment.plugins.prepend('ImageminWebpWebpackPlugin', new ImageminWebpWebpackPlugin({
silent: false,
detailedLogs: true,
}));
const manifest = environment.plugins.get('Manifest')
@agrberg
agrberg / .profile
Created Dec 5, 2014
Helpers for `afplay` OS X
View .profile
function pid_for_name() {
ps -A | grep -m1 $1 | awk '{print $1}'
}
function pause_af {
kill -17 $(pid_for_name afplay)
}
function play_af {
kill -19 $(pid_for_name afplay)
}