Skip to content

Instantly share code, notes, and snippets.

View jhirbour's full-sized avatar

John Hirbour jhirbour

View GitHub Profile
# RVM notes
# when updating OS versions of Xcode (or any of the C/C++ underbits)
#
# if OSx dev is ahead of HomeBrew you may need xcode beta crap from apple's
# download dev site.
#
# you need to rebuild rvm
# https://stackoverflow.com/questions/9663005/how-do-i-recompile-a-ruby-with-rvm
#
# rvm reinstall [RUBY]
# History
# history is managed by rvm (~/.rvm/scripts/irbrc.rb)
# IRB.conf[:SAVE_HISTORY] = 1000
#
# loaded by rvm
# require 'rubygems'
# require 'pp'
if defined? Rails && Rails.env
require 'logger'
#!/bin/sh
bundler_version=$(bundler --version | awk '{print $3}')
gemfile_version=$(tail -1 Gemfile.lock | awk '{print $1}')
echo "bundler_version is $bundler_version"
echo "gemfile_version is $gemfile_version"
if [ "$bundler_version" = "$gemfile_version" ]; then
bundler "$@"
else
echo "ALERT!!!! *** CHANGE YOUR BUNDLER VERSION!!!! ***"
#!/bin/bash
MyShellVar=$(ls /tmp)
/usr/bin/osascript << EOF
set MyApplVar to do shell script "echo '$1'"
tell application "Finder"
activate
set result to display dialog MyApplVar buttons {"OK", "OK2"} default button "OK"
end tell
# RVM notes
# when updating OS versions of Xcode (or any of the C/C++ underbits)
#
# if OSx dev is ahead of HomeBrew you may need xcode beta crap from apple's
# download dev site.
#
# you need to rebuild rvm
# https://stackoverflow.com/questions/9663005/how-do-i-recompile-a-ruby-with-rvm
#
# rvm reinstall [RUBY]
@jhirbour
jhirbour / clean my spree
Last active August 12, 2020 02:14
Code to empty a spree database of product/taxons/orders
#### DON'T RUN THIS ON YOUR PRODUCTION DATA!!!! It will delete stuff !!!!!!
###
###
### FWIW this was from Spree circa 2013
# clear product data
Spree::Product.all.map { |p| p.destroy! }
Spree::Variant.with_deleted.map { |v| v.destroy! }
Spree::StockItem.all.map { |si| si.destroy! }
@jhirbour
jhirbour / me-mux
Created January 27, 2017 16:31
Create a Named Tmux session, named the same as the directory you're currently in.
#!/bin/sh
#PROJECT_NAME=`basename $PWD`
PROJECT_NAME=`basename $PWD | tr '.' '-'`
PROJECT_DIR=$PWD
tmux has-session -t $PROJECT_NAME 2>/dev/null
if [ "$?" -eq 1 ] ; then
echo "No Session found. Creating and configuring."
pushd $PROJECT_DIR
tmux new-session -d -s $PROJECT_NAME

Keybase proof

I hereby claim:

  • I am jhirbour on github.
  • I am jhirbour (https://keybase.io/jhirbour) on keybase.
  • I have a public key whose fingerprint is B7F7 861E C8BE 0D35 28BB 1854 305C E94C 4CEC D7F2

To claim this, I am signing this object:

@jhirbour
jhirbour / gist:6800583
Created October 2, 2013 21:10
In Spree: Replace t/taxon_name with category/taxon_name

Create or edit: $APP_ROOT/app/helpers/spree/base_helper_decorator.rb

Add this:

Spree::BaseHelper.module_eval do
  def seo_url(taxon)
    return main_app.categories_path(taxon.permalink)
  end
end
@jhirbour
jhirbour / ror_os_x
Last active December 22, 2015 11:08
Getting RoR up and running on OS X
How to get RoR running on OS X.
# Supported OS
OS X: 10.8.4
# PREFACE:
* None of these commands should be run as root. Run them as the user you want to do devlopment as. There ARE steps where you'll be prompted for your password.
* you SHOULD NOT have mysql installed locally if you intend to use this guide... if you do the "brew install mysql" commands may break it...