Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug.
gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]| # Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros | |
| # | |
| # Optimized version which uses to_yaml for content creation and checks | |
| # that models are ActiveRecord::Base models before trying to fetch | |
| # them from database. | |
| namespace :db do | |
| namespace :fixtures do | |
| desc 'Dumps all models into fixtures.' | |
| task :dump => :environment do | |
| models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s| |
| <style> | |
| .mcwidget-overlay a[href^="https://manychat.com"], .mcwidget-embed a[href^="https://manychat.com"] { | |
| display: none; | |
| } | |
| </style> |
| CHECKING_OUT_BRANCH=$3 | |
| OLD_BRANCH=$1 | |
| NEW_BRANCH=$2 | |
| if [ $CHECKING_OUT_BRANCH -eq 1 ] | |
| then | |
| FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status` | |
| MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r` | |
| MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'` | |
| CHECKING_OUT_BRANCH=$3 | |
| OLD_BRANCH=$1 | |
| NEW_BRANCH=$2 | |
| if [ $CHECKING_OUT_BRANCH -eq 1 ] | |
| then | |
| FILES_CHANGED=`git diff $OLD_BRANCH $NEW_BRANCH --name-status` | |
| MIGRATIONS_REMOVED=`echo "$FILES_CHANGED" | egrep 'D\tdb/migrate/([0-9]+)' | sort -r` | |
| MIGRATIONS_ADDED=`echo "$FILES_CHANGED" | egrep 'A\tdb/migrate/([0-9]+)'` | |
| After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work. | |
| The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0." | |
| Database files have to be updated before starting the server, here are the steps that had to be followed: | |
| # need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default | |
| brew unlink postgresql | |
| brew install postgresql@9.6 | |
| brew unlink postgresql@9.6 | |
| brew link postgresql |
| Started GET "/products" for 127.0.0.1 at 2017-12-06 14:29:33 +0800 | |
| Processing by ProductsController#index as HTML | |
| User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]] | |
| Spree::Preference Load (4.0ms) SELECT "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1 LIMIT $2 [["key", "spree/app_configuration/currency"], ["LIMIT", 1]] | |
| Spree::Store Load (5.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE (url like '%tsi.lvh.me%') ORDER BY "spree_stores"."id" ASC LIMIT $1 [["LIMIT", 1]] | |
| Spree::Store Load (6.3ms) SELECT "spree_stores".* FROM "spree_stores" WHERE "spree_stores"."default" = $1 ORDER BY "spree_stores"."id" ASC LIMIT $2 [["default", "t"], ["LIMIT", 1]] | |
| Spree::Order Load (2.8ms) SELECT "spree_orders".* FROM "spree_orders" WHERE "spree_orders"."completed_at" IS NULL AND "spree_orders"."currency" = $1 AND "spree_orders"."guest_token" = $2 AND "spree_orders"."store_id" = $3 |
| # Given a multiline script, this will wrap the script in a function and then | |
| # call it so Capybara's evaluate_script knows how to get the return value properly. | |
| # By default, Capybara just prepends a 'return ' to your script. | |
| # | |
| # Usage: | |
| # | |
| # value = page.evaluate_multiline_script %{ | |
| # var foo = []; | |
| # $('li').each(function(i, li) { | |
| # foo[foo.length] = $(li).text(); |
| module Rack | |
| # disable CSS3 and jQuery animations in test mode for speed, consistency and avoiding timing issues. | |
| # Usage for Rails: | |
| # in config/environments/test.rb | |
| # config.middleware.use Rack::NoAnimations | |
| class NoAnimations | |
| def initialize(app, options = {}) | |
| @app = app | |
| end |
| #!/bin/sh | |
| ps aux | grep ruby | grep -v grep | awk '{print $2}' | xargs kill |