This file contains 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
https://daisyui.com - Premade Tailwind CSS components. Looks great and needs way less classes on your HTML |
This file contains 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
version: "3" | |
services: | |
domoticz: | |
image: linuxserver/domoticz:latest | |
container_name: domoticz | |
environment: | |
- PUID=19000 | |
- PGID=19000 | |
- TZ=Europe/Lisbon | |
volumes: |
This file contains 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
https://learnui.design/tools/data-color-picker.html | |
https://design-system-playground.netlify.com |
This file contains 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
Code quality: | |
rubocop - linter | |
https://github.com/prettier/plugin-ruby - (NOT A GEM!) Prettier for ruby | |
overcommit - git hooks to run linting before commits, etc | |
bundler-audit - check your gemfile for outdated gems with security issues | |
bundler-leak - check your gemfile for gems with known memory leaks | |
brakeman - rails static code analyzer with a focus on security | |
sqlint - linter for SQL code (I know, not ruby, but useful for a lot of ruby apps) | |
Background jobs: |
This file contains 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
# config/initializers/oj.rb | |
Oj.optimize_rails |
This file contains 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
# | |
# app/controllers/organizations_controller.rb | |
# | |
# old action | |
def index | |
@organizations = Organization.all | |
end | |
# new action |
This file contains 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
# old action | |
def index | |
@organizations = Organization.all | |
end | |
# new action | |
def index | |
@organizations = if request.format.html? | |
Organization.includes(hqs: :country).all | |
else |
This file contains 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
# app/views/organizations/index.json.jbuilder | |
json.array! @organizations, partial: 'organizations/organization', as: :organization | |
# app/views/organizations/_organization.json.jbuilder | |
json.extract! organization, :id, :name, :address, :contact_name, :contact_phone, :created_at, :updated_at | |
json.url organization_url(organization, format: :json) | |
json.hqs organization.hqs do |hq| | |
json.extract! hq, :id, :name |
This file contains 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
# app/views/organizations/index.html.erb | |
<table> | |
<tbody> | |
<% @organizations.each do |organization| %> | |
<tr> | |
<td><%= organization.name % ></td> | |
<td><%= organization.address %></td> | |
<td><%= organization.contact_name %></td> | |
<td><%= organization.contact_phone %></td> |
This file contains 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
# app/controllers/organizations_controller.rb | |
class OrganizationsController < ApplicationController | |
def index | |
@organizations = Organization.all | |
end | |
end |
NewerOlder