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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="main.css"> | |
<script src="bundle.js" async></script> | |
</head> | |
<body> | |
<div data-controller="toggler"> | |
<label>Toggle Me</label> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "phlex" | |
end | |
require "phlex/testing/view_helper" | |
include Phlex::Testing::ViewHelper |
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
<%= form_for customer, html: { id: dom_id(customer), class: 'row g-3' } do |f| %> | |
<% presenter = InlineErrorRenderer.new(customer, self, 'form-control-lg form-control-solid mb-3 mb-lg-0') %> | |
<div class='col-md-6'> | |
<%= f.label :full_name %> | |
<%= f.text_field :full_name, presenter.html_options_for(:full_name) %> | |
<%= presenter.error_container_for(:full_name) %> | |
</div> | |
<div class='col-md-6'> | |
<%= f.label :phone_number, 'Phone Number' %> | |
<%= f.text_field :phone_number, presenter.html_options_for(:phone_number) %> |
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
# Original code https://twitter.com/robinbortlik/status/1699524286568964440?s=20 | |
# app/controllers/stories.rb | |
class StoriesController < ApplicationController | |
before_action :check_authorizationa # this should check and return a 401 | |
def create | |
story = Story.new(story_params) | |
if story.save |
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
# Add your own tasks in files placed in lib/tasks ending in .rake, | |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | |
require_relative "config/application" | |
Rails.application.load_tasks | |
desc "Set local gems" | |
task :gems do | |
Dir["gems/**"].each do |path| |
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
def random_string(length = 6) | |
rand(36**length).to_s(36) | |
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
CREATE TABLE posts ( | |
id INTEGER PRIMARY KEY, | |
title TEXT NOT NULL, | |
content TEXT NOT NULL | |
); | |
CREATE TABLE comments ( | |
id INTEGER PRIMARY KEY, | |
content TEXT NOT NULL, | |
post_id INTEGER NOT 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
components/ | |
my_bounded_context/ | |
app/ | |
presentation/ # This is called the "UI" layer in DDD literature, but it is also | |
# where things like JSON interfaces live -- any kind of presentation | |
# or handshake to anything outside. So "presentation" rather than "ui". | |
assets/ | |
helpers/ | |
mailers/ | |
views/ |
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 "stimulus" | |
import TomSelect from "tom-select" | |
export default class extends Controller { | |
static values = { url: String } | |
connect() { | |
this.initTomSelect() | |
} |
NewerOlder