Skip to content

Instantly share code, notes, and snippets.

View joshRpowell's full-sized avatar
🏠
Working from home

Josh Powell joshRpowell

🏠
Working from home
  • Fort Lauderdale, FL
View GitHub Profile
@kaspth
kaspth / routes.rb
Last active April 6, 2023 16:57
`draw` method to explore routes in the console
# All these requires are just for running via `irb`, if using `bin/rails console` you probably just need the method.
require "active_support/all" # Got an inflector NoMethodError, so I'm just being lazy here.
require "action_dispatch"
require "action_dispatch/routing/route_set"
require "action_dispatch/routing/inspector"
require "action_controller" # For the ActionController::Parameters autoload, which any route helper uses.
# Console helper play around with the routing DSL and tweak an individual route you're building.
@etagwerker
etagwerker / rails-new.sh
Created October 8, 2022 19:20
rails-new.sh
rails new librarian -d postgresql --skip-system-test --skip-action-mailbox --skip-action-cable --skip-active-job --skip-active-storage --skip-jbuilder --asset-pipeline=propshaft --css=tailwind
--javascript=esbuild
@yahonda
yahonda / ruby31onrails.md
Last active June 25, 2024 20:26
Ruby 3.1 on Rails

Ruby 3.1 on Rails

Actions required to use Ruby 3.1.0 with Rails

Rails 7.0.Z

  • Rails 7.0.1 is compatible with Ruby 3.1.0.
  • Rails 7.0.1 addes net-smtp, net-imap and net-pop gems as Action Mailbox and Action Mailer dependency, you do not need to add them explicitly in your application Gemfile anymore.
  • thor 1.2.1 has been released. You will not see DidYouMean::SPELL_CHECKERS.merge deprecate warnings anymore.

Rails 6.1.Z

  • Use Rails 6.1.5 to support database.yml with aliases and secrets.yml with aliases.
@pottsga
pottsga / Install Oracle Instant Client on macOS.md
Last active September 7, 2023 18:50
How to install Oracle Instant Client on macOS for both Intel x86_64 architectures as well as Apple's own silicon the M1 chipset.

Note (Read Me)

As of 12/14/2021, Oracle does not yet support Apple Silicon (arm64e). Due to this, it is necessary to leverage Rosetta v2. You can do this by clicking the iTerm/Terminal.app icon in Applications, clicking Get Info, and checking Open with Rosetta. Close out completely and restart app.

Install Instant Client

  1. Download Basic Package (ZIP) (instantclient-basic-macos.x64-19.8.0.0.0dbru.zip) Instant Client for macOS (Intel x86)
  2. Unzip
  3. mv instantclient_19_8 /usr/local/lib
@tabishiqbal
tabishiqbal / _form.html.erb
Last active May 2, 2024 13:30
Ruby on Rails Tom-Select Example with Stimulus controller
<%= form_with(model: team) do |form| %>
<div>
<%= form.label :name %>
<%= form.text_field :name, class: "input" %>
</div>
<div>
<%= f.select :user_id, {}, {placeholder: "Select user"}, {class: "w-full", data: { controller: "select", select_url_value: users_path }} %>
</div>
@adrienpoly
adrienpoly / application.html.erb
Last active March 22, 2024 08:14
Capybara / Stimulus test helper to ensure JS is ready when test starts
<!DOCTYPE html>
<html>
<head>
...
</head>
<body data-controller="js">
<%= yield %>
</body>
</html>
class SynchronousJob < ApplicationJob
def self.perform_later
raise "This job is not designed to be run asynchronously. Please use #perform_now"
end
end
@ryanong
ryanong / service.rb
Created November 16, 2020 16:08
Service Class
require "active_job/arguments"
module Service
extend ActiveSupport::Concern
class ServiceJob
include Sidekiq::Worker
sidekiq_options queue: :web_default
@johnmeehan
johnmeehan / index.html
Created October 18, 2020 18:34
Stimulus js Checkbox toggle
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="main.css">
<script src="bundle.js" async></script>
</head>
<body>
<div data-controller="toggler">
<label>Toggle Me</label>
@palkan
palkan / bulletify.rb
Created September 7, 2020 17:00
Bulletify: RSpec helpers to run Bullet in tests
RSpec.shared_context "bullet" do
before(:each) do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if N+1 query occurs
Bullet.start_request
end
after(:each) do
Bullet.perform_out_of_channel_notifications if Bullet.notification?