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
@use "sass:color"; | |
$choices-selector: "choices" !default; | |
$choices-font-size-lg: $font-size-lg !default; | |
$choices-font-size-md: $font-size-base !default; | |
$choices-font-size-sm: $font-size-sm !default; | |
$choices-border-radius: var(--bs-border-radius) !default; | |
$choices-border-radius-item: 20px !default; | |
$choices-bg-color: var(--bs-body-bg) !default; | |
$choices-bg-color-disabled: #eaeaea !default; |
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/sentry.rb | |
config.before_send_transaction = lambda do |event, _hint| | |
relevant_span = event.spans.find { |s| s[:op] == 'view.process_action.action_controller' } | |
if relevant_span | |
sampling_config = { 50 => 1, 200 => 10, 500 => 20, 1000 => 50 } | |
duration_in_ms = (relevant_span[:timestamp] - relevant_span[:start_timestamp]) * 1000 | |
sampling_percentage = sampling_config. |
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
File.open(file_path, 'w') do |file| | |
file.write("[") | |
if records.any? | |
last_id = records.last.id | |
records.find_each do |model| | |
file.write(model.to_json(except: excluded_columns)) | |
file.write(",\n") if model.id != last_id | |
end | |
end | |
file.write("]\n") |
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/layouts/rails_admin/_head.html.slim | |
/we override the default head to add our custom rails_admin stylesheet pack tag | |
meta[content="IE=edge" http-equiv="X-UA-Compatible"] | |
meta[content="text/html; charset=utf-8" http-equiv="Content-Type"] | |
meta[content="width=device-width, initial-scale=1" name="viewport; charset=utf-8"] | |
meta[content="NONE,NOARCHIVE" name="robots"] | |
= csrf_meta_tag | |
= stylesheet_link_tag "rails_admin/rails_admin.css", media: :all | |
= stylesheet_pack_tag "rails_admin", media: :all | |
= javascript_include_tag "rails_admin/rails_admin.js" |
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
module UnpermittedParametersListener | |
extend ActiveSupport::Concern | |
included do | |
before_action :instrument_listener_for_unpermitted_params | |
after_action :merge_unpermitted_params_hints | |
attr_reader :permitted_action_params | |
end |
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
module ActionDispatch | |
class JsonApiPublicExceptions < PublicExceptions | |
def call(env) | |
request = ActionDispatch::Request.new(env) | |
status = request.path_info[1..].to_i | |
exception = env['action_dispatch.exception'] | |
message = returned_message(exception, status) | |
attribute = exception.try(:param) || :base | |
code = convert_to_code(status) |
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
class ErrorsMapper | |
class << self | |
def call(model, *prefix) | |
model.errors.details.map { |attribute, detail| map_details(model, prefix, attribute, detail) }.flatten | |
end | |
def single(status: 422, attribute: :base, code: :invalid, message: I18n.t('activerecord.errors.messages.invalid')) | |
{ status: status, pointer: attribute, code: code, detail: message } | |
end |
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
ListView( | |
children: <Widget>[ | |
BeeHeader(i18n.t('inspections.contactSection')), | |
BeeInput( | |
i18n.t('inspections.firstName'), | |
validator: Validators.presence(i18n.t('inspections.firstNameEmpty')), | |
onSaved: (String value) { | |
beekeeper.firstname = value; | |
}, | |
), |
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
TextFormField( | |
onSaved: (String value) { | |
myModel.street = value; | |
}, | |
), | |
TextFormField( | |
onSaved: (String value) { | |
myModel.houseNo = value; | |
}, | |
), |
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
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
warn 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'rails', '~> 5.2' |
NewerOlder