Skip to content

Instantly share code, notes, and snippets.

View luciagirasoles's full-sized avatar
🎯
Focusing

Mayra Lucia Navarro luciagirasoles

🎯
Focusing
View GitHub Profile
@natematykiewicz
natematykiewicz / unroutable_routes.rake
Last active June 9, 2022 19:47
Find routes that will raise a routing error when requested
desc 'Find routes that will raise a routing error when requested'
task unroutable_routes: :environment do
# A lot of this code was taken from how `rake routes` works
# https://github.com/rails/rails/blob/f95c0b7e96eb36bc3efc0c5beffbb9e84ea664e4/railties/lib/rails/commands/routes/routes_command.rb
require 'action_dispatch/routing/inspector'
unroutables = Rails.application.routes.routes.
map { |r| ActionDispatch::Routing::RouteWrapper.new(r) }.
reject { |r| r.internal? || r.engine? || r.path.starts_with?('/rails/') || !r.controller }.
@DRBragg
DRBragg / file_uploader.rb
Last active September 27, 2023 06:46
PDF Previews with carrierwave
class ItemUploader < CarrierWave::Uploader::Base
require 'carrierwave/orm/activerecord'
include CarrierWave::RMagick
attr_reader :geometry
# Create thumbnail for images and PDFs
version :thumb, :if => :thumbable? do
process :resize_to_fit => [240, 240], :if => :image?
process :pdf_preview => [240, 240], :if => :pdf?
@mrmartineau
mrmartineau / stimulus.md
Last active May 12, 2024 04:35
Stimulus cheatsheet