Skip to content

Instantly share code, notes, and snippets.

View justin808's full-sized avatar
💭
Hiring!

Justin Gordon justin808

💭
Hiring!
View GitHub Profile
@justin808
justin808 / errors-for-tutorial-different-drivers
Last active March 6, 2016 22:15
Errors when running non-selenium drivers (anybody know how to fix this?) for the https://github.com/shakacode/react-webpack-rails-tutorial/
➜ ~/shakacode/react-webpack-rails-tutorial (fix-comments-json-format) DRIVER=selenium_chrome rspec [12:06:38]
Running via Spring preloader in process 39408
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's 'rails' settings.
Capybara using driver: selenium_chrome
Add new comment
from main page
via Horizontal Form
when the new comment is submitted

Redux

  1. Use Immutable.js for non primitives, such as lists, objects, maps, etc.
  2. Store keys of Immutable.js values should be named with prefix $$ Store should be of the shape:
export type StoreType = {
  $$commentsStore: $$Map<string, any>,
 $$profileStore: $$Map,
@justin808
justin808 / poltergeist.rb
Last active November 26, 2016 09:29
Switch from PhantomJS to Selenium Chrome when PhantomJS crashes. Original at https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/spec/support/poltergeist.rb
# See in use here:
# https://github.com/shakacode/react-webpack-rails-tutorial/blob/master/spec/support/poltergeist.rb
# This file supports 2 strategies:
# 1. switch_to_selenium: switch drivers
# 2. restart_poltergeist
RESTART_PHANTOMJS = ENV["RESTART_PHANTOMJS"] &&
%w(TRUE YES).include?(ENV["RESTART_PHANTOMJS"].upcase)
puts "RESTART_PHANTOMJS = #{RESTART_PHANTOMJS}"
// 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;
};
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
// app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx
import { HELLO_WORLD_NAME_UPDATE } from '../constants/helloWorldConstants';
export const updateName = (text) => ({
type: HELLO_WORLD_NAME_UPDATE,
text,
});
########################################################################################################################
########################################################################################################################
# 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 / 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'
)
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 / .pryrc
Last active June 7, 2024 02:35
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 / .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'