Skip to content

Instantly share code, notes, and snippets.

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

Dorian dlupu

🏠
Working from home
View GitHub Profile
@dlupu
dlupu / hotwire_stimulus_2_0.md
Last active March 16, 2022 19:02 — forked from scottharvey/stimulus.md
Hotwire Stimulus 2.0 cheatsheet (in the process of being updated). If you have any feedback, please comment.
@dlupu
dlupu / application_controller.rb
Created October 5, 2020 20:05 — forked from sunny/application_controller.rb
Rails helper so that "?_locale_keys=1" in URL shows locale keys
class ApplicationController < ActionController::Base
include I18nHelper
end
@dlupu
dlupu / plugin.sh
Created December 30, 2019 18:51
Create rspec rails plugin
# http://stackoverflow.com/questions/8507798/rails-3-1-plugin-gem-dummy-test-app-rspec
# http://namick.tumblr.com/post/17663752365/how-to-create-a-gemified-plugin-with-rails-3-2-rspec
rails plugin new plugin_name --skip-test-unit --dummy-path=spec/dummy
cd plugin_name
# Add rspec-rails to gemspec dev deps
# s.add_development_dependency "rspec-rails"
bundle install
@dlupu
dlupu / rubocop_pre_commit_hook
Last active February 18, 2021 15:50 — forked from kiran/rubocop_pre_commit_hook
forked pre-commit hook for changed ruby files. (whitespace sensitivity in the regex was borking selection)
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
ADDED_OR_MODIFIED = /^\s*(A|AM|M)/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|
file_name_with_status =~ ADDED_OR_MODIFIED