This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// required dependencies | |
// - jquery | |
// - jquery-ui | |
// - @activeadmin/activeadmin | |
import jQuery from 'jquery' | |
window.jQuery = jQuery | |
window.$ = jQuery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this code is used for lazy loading stimulus controller with Vite | |
// Vite lazy import only works with relative path | |
// so place this code in stimulus controllers folder | |
// reference: https://github.com/vitejs/vite/issues/1931#issuecomment-868310388 | |
// this code is originally from https://github.com/hotwired/stimulus-rails/blob/49cfc34beb92ad56140a78db6be4c7733207be30/app/assets/javascripts/stimulus-loading.js | |
const controllerAttribute = "data-controller" | |
const registeredControllers = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Utilities | |
``` | |
gem install rubocop | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shutdown until process finishes | |
# | |
## arguments | |
# first argument is a PID | |
pid=$1 | |
while true | |
do | |
if ! ps -p $pid > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.application.config.colorize_logging = false | |
io = StringIO.new | |
logger = Logger.new(io) | |
logger.formatter = proc do |_severity, _time, _progname, message| | |
sql = message.sub(/^\s*[A-Za-z0-9]+ Load \(\d+\.\d+ms\)\s+/, "").chomp | |
sql = sql.sub(/^\s*\(\d+\.\d+ms\)\s+/, "").chomp | |
IO.popen("sql-formatter", "r+") do |pipe| | |
pipe.puts sql | |
pipe.close_write |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rails runner | |
# | |
# Used to create rails app file with module and classes included | |
# | |
### How to use | |
# - Copy this into your bin folder. | |
# - Make this file executable by using `chmod +x`. | |
sub_directory = ARGV[0] | |
constant_name = ARGV[1] |
OlderNewer