Skip to content

Instantly share code, notes, and snippets.

John Hirbour jhirbour

Block or report user

Report or block jhirbour

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jhirbour
jhirbour / me-mux
Created Jan 27, 2017
Create a Named Tmux session, named the same as the directory you're currently in.
View me-mux
#!/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
View keybase.md

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 / explanation.md
Last active Sep 11, 2015
PGSQL finding if rows have other rows in a time range near them
View explanation.md

I'm trying to find rows in a table where there have been other rows created within a minute of them.

Why you can't use group by:

You can't use group by for this because certain rows will exist inside of 2 groups.

 timestamp                      minute logical group
----------------------------------------------------------- 
2010-01-01 09:09:01             A1
2010-01-01 09:09:58             A1, A2
@jhirbour
jhirbour / clean my spree
Last active Apr 16, 2019
Code to empty a spree database of product/taxons/orders
View clean my spree
#### DON'T RUN THIS ON YOUR PRODUCTION DATA!!!! It will delete stuff !!!!!!
# 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! }
# clear taxonomies and Taxons
# double check that this deletes from spree_taxons and spree_taxonomies
@jhirbour
jhirbour / gist:6800583
Created Oct 2, 2013
In Spree: Replace t/taxon_name with category/taxon_name
View gist:6800583

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 Dec 22, 2015
Getting RoR up and running on OS X
View ror_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...
You can’t perform that action at this time.