Skip to content

Instantly share code, notes, and snippets.

View nbarthelemy's full-sized avatar

Nick Barthelemy nbarthelemy

View GitHub Profile
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'pry', '>= 0.14.1' # Console with powerful introspection capabilities
# # Need to use master of pry-byebug to use latest pry version
# gem 'pry-byebug', github: 'deivid-rodriguez/pry-byebug' # Integrates pry with byebug
# gem 'pry-doc' # Provide MRI Core documentation
# gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB
# gem 'pry-rescue' # Start a pry session whenever something goes wrong.
# gem 'pry-theme' # An easy way to customize Pry colors via theme files
#
@nbarthelemy
nbarthelemy / .gitignore
Created August 8, 2019 03:54 — forked from WattsInABox/.gitignore
Generate Static HTML Website Using Ruby on Rails
# Ignore static version of the site (used to upload error pages to S3 for Heroku errors)
/out
# delete all( 1st 50 ) orders including archived
ShopifyAPI::Order.find(:all, params: { status: 'any', fields: 'id' }).each{ |o| ShopifyAPI::Order.delete(o.id.to_i) }
# get all orders
count = ShopifyAPI::Order.count
page = 1
collection = []
while count > 0 do
collection << ShopifyAPI::Order.find(:all, params: { status: 'any', fields: 'id', page: page })
count = count - 50
@nbarthelemy
nbarthelemy / rails http status codes
Created April 29, 2019 20:22 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@nbarthelemy
nbarthelemy / .bash_profile
Last active October 23, 2018 15:40
RVM or rbenv + git bash prompt config script
[[ -s ~/.bashrc ]] && . ~/.bashrc
[ -f $(brew --prefix)/etc/bash_completion ] && . $(brew --prefix)/etc/bash_completion
# This loads RVM into a shell session. ( optional )
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# This load rbenv into the shell session ( optional )
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source ~/.rbenv/completions/rbenv.bash
require 'csv'
namespace :routes do
desc 'Print out defined routes into csv located at tmp/routes.csv'
task csv: :environment do |task|
CSV.open('tmp/routes.csv', 'wb') do |csv|
csv << ['name', 'verb', 'path']
Rails.application.routes.routes.each do |route|
csv << [ route.name, route.verb, route.path.spec.to_s ]
end
@nbarthelemy
nbarthelemy / agile_git_workflow.md
Created August 21, 2018 20:35
Typical Agile Git Workflow

agile-git-workflow

A simple GitHub git workflow for agile teams based on issues and pull requests

This workflow does not guarantee a working master, if that is required a staging branch can be used, but that is beyond the scope of this document

#Rules

  1. Never work on master
  2. Pulling master should never create a merge commit
# rename alot of files with regular expression
for f in *.<ext>; do mv -n "$f" "${f/<replace this>/<with this>}"; done
# shortform git commands
alias g='git'
# get list of users public repos
curl "https://api.github.com/users/usernamehere/repos?type=owner&sort=updated" -s | sed -En 's|"name": "(.+)",|\1|p' | tr -d ' '
# count relevant lines of shell code in a git repo
egrep -v '^\s*($|#)' $(git grep -l '#!/bin/.*sh' *) | wc -l
# push all remotes
/********* CO Backend Console JS ********************/
// move cart items to order
jQueryIWD('#sidebar_data_cart input[type=checkbox][title^=Add]').prop('checked', true);
// set a $0 custom price
jQueryIWD('[id^=item_use_custom_price_]').click();
jQueryIWD('[id^=item_custom_price_]').each(function(){ this.value = 0 });
// set price to tier 1 price point ( 12 units / half of retail )