Skip to content

Instantly share code, notes, and snippets.

View justin808's full-sized avatar
💭
Hiring!

Justin Gordon justin808

💭
Hiring!
View GitHub Profile
# 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 April 4, 2024 11:04
Updated .pryrc with option to remove pry-byebug
# 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 / Rakefile
Last active October 21, 2023 16:15
Rake tasks to rename Octopress posts to correspond to metadata, for org-mode as well. In Octopress, the meta is used for the blog post date.
org_posts_dir = "org_posts" # directory under source
# From http://www.ewal.net/2012/09/08/octopress-customizations/
# Modified to have default flag of true to include drafts
desc "Rename files in the posts directory if the filename does not match the post date in the YAML front matter"
task :rename_posts do
rename_posts_in_dir "#{source_dir}/#{posts_dir}", "markdown"
# remove next line if you're you're not using org-mode
rename_posts_in_dir "#{source_dir}/#{org_posts_dir}", "org"
@justin808
justin808 / run-commands-async.sh
Created June 4, 2018 00:21
Simple bash script to run multiple tasks concurrently
#!/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'
)
@justin808
justin808 / .pryrc
Created January 11, 2022 21:29
Pryrc for ruby/debug and not byebug
# 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
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.
# 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.
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"
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
# 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