Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hiring!

Justin Gordon justin808

💭
Hiring!
View GitHub Profile
@justin808
justin808 / run-commands-async.sh
Created June 4, 2018 00:21
Simple bash script to run multiple tasks concurrently
View run-commands-async.sh
#!/usr/bin/env bash
# Edit the list of commands.
# YOU MUST USE SINGLE QUOTES HERE.
commands=(
'yarn run build:client-bundles:prod'
'yarn run build:server-bundle:prod'
'yarn run build:global-styles:prod'
)
View .pryrc
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# gem '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
# end
@justin808
justin808 / .pryrc
Last active September 21, 2022 09:30
Updated .pryrc with option to remove pry-byebug
View .pryrc
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# # pick either:
# # using byebug, but has issues with Zeitwerk
# gem 'pry-byebug' # Integrates pry with byebug
#
# # using default ruby debuggger
# gem 'pry-stack_explorer'
@justin808
justin808 / .pryrc
Created January 11, 2022 21:29
Pryrc for ruby/debug and not byebug
View .pryrc
# Using these pry gems -- copy to your Gemfile
# group :development, :test do
# gem 'awesome_print' # pretty print ruby objects
# gem 'pry' # Console with powerful introspection capabilities
# # pick either:
# # using byebug, but has issues with Zeitwerk
# gem 'pry-byebug' # Integrates pry with byebug
#
# # using default ruby debuggger
# gem 'pry-stack_explorer'
@justin808
justin808 / .tmux.conf
Last active January 12, 2022 19:57
My tmux conf file for tmux 1.9a
View .tmux.conf
set-option -g default-shell /bin/zsh
# https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard
# http://brentvatne.github.com/tmux-copy-paste/
# this next command takes the current buffer and puts it on the OS clipboard
#bind Y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
#
# I don't understand why the next would be useful
# bind P run "tmux paste-buffer"
bind y copy-mode
@justin808
justin808 / check_db_version.rb
Created September 6, 2015 23:44
Check DB Version -- place this in config in your Rails app to ensure the team uses the same db version. Change line to match your expected DB.
View check_db_version.rb
# Method to check the DB version matches
# We ran into an issue where different versions of postgres caused inconsistent results.
def check_db_version
expected_db_version = "PostgreSQL 9.4"
adapter = ActiveRecord::Base.connection.adapter_name
sql = case adapter
when "MSSQL"
"SELECT @@VERSION"
when "MySQL", "Mysql2", "PostgreSQL"
"SELECT VERSION()"
@justin808
justin808 / rails_helper.rb
Created September 7, 2015 04:16
rails_helper with setup for Capybara feature tests, allowing JavaScript driver to be set by setting DRIVER environment variable.
View rails_helper.rb
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../../config/environment", __FILE__)
require "rspec/rails"
require "rspec/mocks"
require "capybara/rspec"
require "vcr"
require "rails/application"
require "webmock/rspec"
require "shoulda/matchers"
require "capybara-screenshot/rspec"
View justin-shell-tips.md
gpf='git push --force-with-lease'
gca='git commit -v -a'
gpthis='git push origin HEAD:$(git_current_branch) && git branch -u origin/$(git_current_branch) $(git_current_branch) && echo "pushed current branch and set upstream to origin"'
gco='git checkout'
g='grep -i --color=auto'
hb='hub browse'
@justin808
justin808 / git-helpers.zsh
Last active November 7, 2018 20:27
zsh with git flow
View git-helpers.zsh
# depends on justin808 gist named utility.zsh
# https://gist.github.com/justin808/bdef67f37c2cbdba898a
# See forum discussion: http://forum.railsonmaui.com/t/zsh-with-git-flow/135
#### GIT ####
# http://superuser.com/questions/458906/zsh-tab-completion-of-git-commands-is-very-slow-how-can-i-turn-it-off
# fix slow completion on files
# __git_files () {
# _wanted files expl 'local files' _files
View gist:bd75f4aba6bb775e45f26f56ef9cf826
########################################################################################################################
########################################################################################################################
# run-prod-locally.sh
########################################################################################################################
echo "Only run this once to set your production setup after changing JS assets."
echo "You can run foreman start -f Procfile.local-prod to restart the server without recompiling"
echo "You may want to have your /application.yml and /config/database.yml reflect your development settings for production"
# Run the rake tasks as production
RAILS_ENV=production rake assets:clobber