I hereby claim:
- I am bentoncreation on github.
- I am bentoncreation (https://keybase.io/bentoncreation) on keybase.
- I have a public key whose fingerprint is 69F3 3662 82F5 6128 4016 61FD 93C3 7BCB 2202 47A5
To claim this, I am signing this object:
import { Controller } from "@hotwired/stimulus"; | |
export default class extends Controller { | |
static values = { highlighted: Boolean }; | |
static classes = ["highlighted"]; | |
toggle() { | |
this.highlightedValue = !this.highlightedValue; | |
} |
# Example Usage | |
# data: stimulus_data( | |
# autosubmit: { controller: true }, | |
# toggle: { controller: true, classes: { checked: "highlighted", unchecked: "unhighlighted" } }, | |
# sortable: { target: "sortBy", actions: { click: "sort" }, | |
# ).merge(other: "stuff") | |
class StimulusData | |
def initialize(**controllers) | |
@controllers = controllers |
class PaymentsController < ApplicationController | |
CHECKOUT_SESSION_ID_KEY = :checkout_session_id | |
before_action :authenticate_user! | |
def new | |
stripe_customer = find_or_create_stripe_customer | |
checkout_session = create_checkout_session(stripe_customer) | |
redirect_to checkout_session.url, allow_other_host: true |
<%= tag.div data: { controller: "autosuggest", action: "autosuggest:click:outside->autosuggest#hide" }, class: "relative" do %> | |
<%= f.text_field :subject, autocomplete: "off", data: { autosuggest_target: "input", action: "input->autosuggest#search focus->autosuggest#search keydown.up->autosuggest#arrowSearch keydown.down->autosuggest#arrowSearch keydown.esc->autosuggest#hide" } %> | |
<%= tag.ul role: "listbox", hidden: true, data: { autosuggest_target: "list", action: "combobox-commit->autosuggest#commit" }, class: "z-40 absolute w-full max-h-60 overflow-auto mt-1 rounded border border-gray-300 shadow-lg p-1 bg-white" do %> | |
<% @subjects.each do |subject| %> | |
<%= tag.li subject.name, role: "option", id: dom_id(subject, :listbox), data: { autosuggest_target: "item" }, class: "w-full text-left cursor-pointer p-2 hover:bg-gray-100 aria-selected:bg-gray-100 aria-selected:font-semibold" %> | |
<% end %> | |
<% end %> | |
<% end %> |
<%= form_with(model: topic_form, url: spaced_topics_path) do |form| %> | |
<div class="mb-4"> | |
<%= form.label :title %> | |
<%= form.text_field :title, data: { session_resume_target: "resumeable" } %> | |
<%= form.error :title %> | |
</div> | |
<div class="mb-2"> | |
<%= form.label :body, class: "sr-only" %> | |
<%= form.markdown_text_area :body, data: { session_resume_target: "resumeable" } %> |
class User | |
has_many :subscriptions | |
has_many :followings | |
end | |
class Channel | |
has_many :topics | |
has_many :subscriptions | |
end |
Rails.application.config.to_prepare do | |
ActiveStorage::Attachment.class_eval do | |
private | |
def transform_variants_later | |
if record.respond_to?(:calculated_variants) | |
record.calculated_variants[name.to_sym]&.values.each do |transformations| | |
blob.preprocessed(transformations) | |
end | |
end |
#!/usr/bin/env ruby | |
require 'listen' | |
APP_ROOT = File.expand_path('..', __dir__) | |
listener = Listen.to("#{APP_ROOT}/tmp/mails") do |_modified, added, _removed| | |
added.each do |added_file| | |
if added_file.end_with?(".eml") | |
system("open -a Mail #{added_file}") | |
else |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
require "action_view" | |
require "fileutils" | |
class WordCounter | |
include ActionView::Helpers::SanitizeHelper | |
def initialize(initial_directory) | |
@initial_directory = initial_directory | |
puts count_directory(@initial_directory) |