define method plural_name
that returns String
set self.visible_on_sidebar = true
in Resource
#!/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] |
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 |
# shutdown until process finishes | |
# | |
## arguments | |
# first argument is a PID | |
pid=$1 | |
while true | |
do | |
if ! ps -p $pid > /dev/null |
## Utilities | |
``` | |
gem install rubocop | |
``` |
// 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 = {} |
// required dependencies | |
// - jquery | |
// - jquery-ui | |
// - @activeadmin/activeadmin | |
import jQuery from 'jquery' | |
window.jQuery = jQuery | |
window.$ = jQuery |
import { Controller } from 'stimulus' | |
// used for changing form fields dynamically based on what user want in one page | |
export default class extends Controller { | |
static values = { targetContainerId: String, templateId: String } | |
async connect() { | |
// store array of DocumentFragment by id | |
this.templates = {} | |
// store container elements by id |
#!/bin/zsh | |
# install auto suggestions | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
# install syntax highlighting | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git | |
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc | |
sed -z --regexp-extended 's/(plugins=\(.*)\)/\1\tzsh-autosuggestions\n\tzs-syntax-highlighting\n)/g' ~/.zshrc |