- You MUST NOT try and generate a Rails app from scratch on your own by generating each file. For a NEW app you MUST use
rails newfirst to generate all of the boilerplate files necessary. - Create an app in the current directory with
rails new . - Use Tailwind CSS for styling. Use
--css tailwindas an option on therails newcall to do this automatically. - Use Ruby 3.2+ and Rails 8.0+ practices.
- Use the default Minitest approach for testing, do not use RSpec.
- Default to using SQLite in development.
rails newwill do this automatically but take care if you write any custom SQL that it is SQLite compatible. - An app can be built with a devcontainer such as
rails new myapp --devcontainerbut only do this if requested directly. - Rails apps have a lot of directories to consider, such as app, config, db, etc.
- Adhere to MVC conventions: singular model names (e.g., Product) map to plural tables (products); controllers are plural.
- Guard against incapable browsers accessing controllers with `allo
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
| variant: flatcar | |
| version: 1.0.0 | |
| kernel_arguments: | |
| should_exist: | |
| - flatcar.autologin | |
| passwd: | |
| users: | |
| - name: core | |
| ssh_authorized_keys: | |
| - "ssh-ed25519 T0r5c5h2exdqJOsFgoimZmnNGkOwHse6CkbMcGrW8pi0vxXbkgdmcRDIepuw EXAMPLE SSH KEY" |
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
| #!/bin/bash | |
| # Script to update a firewall rule in a Hetzner Firewall with your current IP address. | |
| # Good if you would like to restrict SSH access only for your current IP address (secure). | |
| ################# | |
| # WARNING: This script will overwrite all rules in the firewall rules, so make sure you | |
| # added all the required rules. | |
| # I use a separate firewall rule just for SSH access. | |
| ################# |
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
| # frozen_string_literal: true | |
| class Components::Gravatar < Ode::Base | |
| include Flecks | |
| prop :size, Integer, default: 80 | |
| prop :alt, String | |
| prop :email, String do |value| | |
| value.to_s.strip.downcase | |
| end |
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
| # NOTE: partial content required for Gemfile | |
| gem "rails" | |
| gem "propshaft" | |
| gem "importmap-rails" | |
| gem "stimulus-rails" | |
| gem "tailwindcss-rails" | |
| gem "action_policy" |
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
| import { Controller } from '@hotwired/stimulus' | |
| export default class extends Controller { | |
| static classes = ['highlight'] | |
| connect () { | |
| this.element | |
| .querySelector(`a[name='${window.location.hash.slice(1)}']`) | |
| ?.parentElement?.classList?.add(...this.highlightClasses) | |
| } |
the-keeper-iteration-2.mp4
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
| # frozen_string_literal: true | |
| ############################################################################################### | |
| # WHAT I SERIALIZE? # | |
| ############################################################################################### | |
| # This scrip can help you to find what object types you need to witelist after CVE-2022-32224 update | |
| # AD: If you using StimulusJS then checkout my gem stimulus_tag_helper | |
| # https://rubygems.org/gems/stimulus_tag_helper | |
| # https://github.com/crawler/stimulus_tag_helper |
This guide will walk you through adding some extra features such as the ability to underline your text, or enhance your content by adding superscripts or subscripts for annotations or Math equations.
Prerequisites: Instruction guide assumes that you have created a Rails application and installed ActionText.
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 bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
NewerOlder