Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hiring!

Justin Gordon justin808

💭
Hiring!
View GitHub Profile
View .pryrc
# Using these pry gems
# Essentials
# gem "pry"
# gem "pry-rails"
# gem "pry-byebug"
# gem "pry-doc"
# gem "pry-rescue"
# === EDITOR ===
# Pry.editor = 'vi'
@justin808
justin808 / run-commands-async.sh
Created Jun 4, 2018
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'
)
@justin808
justin808 / .tmux.conf
Last active Aug 20, 2020
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 / rails_helper.rb
Created Sep 7, 2015
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 Nov 7, 2018
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
@justin808
justin808 / pgk.zsh
Last active Apr 10, 2017
Script to kill errant rails development processes
View pgk.zsh
export PROCESSES_TO_QUIT='bpos puma rake sidekiq spring rails$ ruby-debug phantomjs zeus passenger guard resque "node server.js" ruby$ node foreman fsevent_wat'
pgr() {
echo "Finding processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pgrep -l
}
pgk() {
echo "Killing processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -l
View react_on_rails-simple-redux.js
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx
import { HELLO_WORLD_NAME_UPDATE } from '../constants/helloWorldConstants';
export const updateName = (text) => ({
type: HELLO_WORLD_NAME_UPDATE,
text,
});
View redux-thunk-example.js
// multiple entities returned gets normalized
// https://github.com/shakacode/react-webpack-rails-tutorial/blob/08081f07c7d2686facf2e98d956d50dfbef83678/mobile/ReactNativeTutorial/app/api/index.js
export const fetchComments = async () => {
const response = await getRequest('comments.json');
const camelizedResponse = _.mapKeys(_.camelCase, response);
const { entities } = normalize(camelizedResponse, { comments: commentsSchema });
return entities;
};