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
module HasOneTimePassword | |
extend ActiveSupport::Concern | |
included do | |
class_attribute :otp_secret_salt, | |
instance_accessor: false, | |
default: 'otp' | |
end | |
module ClassMethods |
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 'base64' | |
require 'json' | |
require 'net/https' | |
require 'openssl' | |
require 'securerandom' | |
require 'time' | |
require 'uri' | |
module Aliyun | |
class SMS |
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
module SoftDelete | |
extend ActiveSupport::Concern | |
included do | |
scope :trashed, -> { where.not(deleted_at: nil) } | |
scope :not_trashed, -> { where(deleted_at: nil) } | |
scope :kept, -> { not_trashed } | |
define_model_callbacks :trash, :untrash | |
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
<% heading ||= '' %> | |
<% dismissible ||= false %> | |
<% flash.each do |type, msg| %> | |
<div class="alert alert-<%= type %> alert-dismissible" role="alert"> | |
<% if heading.present? %> | |
<h4 class="alert-heading"><%= heading %></h4> | |
<% end %> | |
<div><%= msg %></div> | |
<% if dismissible %> |
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
<% if object.errors.any? %> | |
<div id="error_explanation" class="alert alert-danger alert-dismissible animate__animated animate__pulse" role="alert"> | |
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
<span aria-hidden="true">×</span> | |
</button> | |
<h4 class="alert-heading"> | |
<%= t "activerecord.errors.template.header", count: object.errors.count, model: object.model_name.human %> | |
</h4> | |
<div> | |
<p><%= t "activerecord.errors.template.body" %></p> |
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
<div class="field" data-controller="toggle-password-visibility" data-toggle-password-visibility-visible-icon-class="mdi-eye-off"> | |
<%= form.label :password, class: 'label'%> | |
<div class="control"> | |
<div class="field has-addons has-addons-right"> | |
<div class="control is-clearfix has-icons-left has-icons-right"> | |
<span class="icon is-left"> | |
<i class="mdi mdi-onepassword mdi-24px"></i> | |
</span> | |
<%= form.password_field :password, class: ['input', { "is-danger": sign_in.errors.key?(:password) }], data: { 'toggle-password-visibility-target': 'password' }, required: true %> | |
<% if sign_in.errors.key?(:password) %> |
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
[Unit] | |
Description=Puma HTTP Server | |
After=network.target | |
# Uncomment for socket activation (see below) | |
# Requires=puma.socket | |
[Service] | |
Type=simple |
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
export default class extends ApplicationController { | |
print() { | |
window.print() | |
} | |
scrollToTop() { | |
window.scrollTo({ top: 0, behavior: "smooth" }) | |
} | |
confirm(event) { |
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
/* | |
ERB template chunk from The Feed's display of emails: | |
<section class="postings postings--feed-style" id="postings" | |
data-controller="pagination" data-pagination-root-margin-value="40px"> | |
<%= render partial: "postings/snippet", collection: @page.records, as: :posting, cached: true %> | |
<%= link_to(spinner_tag, url_for(page: @page.next_param), | |
class: "pagination-link", data: { pagination_target: "nextPageLink", preload: @page.first? }) unless @page.last? %> | |
</section> |
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
class Ticket < ActiveRecord::Base | |
belongs_to :grouper | |
belongs_to :user | |
validate :user_cant_be_blacklisted, on: :confirmation | |
validate :user_cant_double_book, on: :confirmation | |
validate :grouper_cant_be_full, on: :confirmation | |
validate :grouper_cant_have_occurred, on: :confirmation |