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(board, html: {class: "space-y-4"}) do |form| %> | |
<div> | |
<%= form.label :title, class: "block text-sm font-medium text-gray-700" %> | |
<%= form.text_field :title %> | |
</div> | |
<div> | |
<%= form.fields_for :embeds do |embed_form| %> | |
<%= embed_form.label :input, class: "sr-only" %> | |
<%= embed_form.text_field :input, placeholder: "Enter an embeddable link", data: {reflex_permanent: true} %> |
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
( | |
Server.killAll; | |
~gtranspose = 0; | |
~rec_end = 0; | |
~stretch = 1.0; | |
~density = 0.0; | |
~num_channels = 12; | |
~pitch_env_amp = 0.0; | |
~pitch_range = 0.0; |
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
<!-- app/views/boards/_board.html.erb --> | |
<%= render partial: "embeds/embed", collection: embeds, locals: {board: board}, cached: true %> | |
<%= render partial: "embeds/embed", collection: embed_templates %> |
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
# Phoenix | |
if grep -q '^ "phoenix"' mix.lock; then | |
source $HOME/.asdf/asdf.sh | |
source $HOME/.asdf/completions/asdf.bash | |
export $(cat $RELEASE_DIR/../../.rbenv-vars | xargs) | |
echo ' | |
-----> Detected Phoenix app.' | |
mix local.rebar --force | |
mix local.hex --force |
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
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
def onboarding_step_path(workflow) | |
board = workflow.user.boards&.first | |
case workflow.next_step | |
when :create_board | |
new_board_path | |
when :create_embed | |
board_path(board) | |
when :create_comment |
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
# app/models/application_record.rb | |
class ApplicationRecord < ActiveRecord::Base | |
self.abstract_class = true | |
cattr_accessor :skip_callbacks | |
end | |
# app/models/concerns/user_notifiable.rb | |
module UserNotifiable | |
included do |
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 { navigator } from "@hotwired/turbo"; | |
import { Controller } from "stimulus"; | |
import { useMutation } from "stimulus-use"; | |
export default class extends Controller { | |
connect() { | |
useMutation(this, { attributes: true, childList: true, subtree: true }); | |
} | |
mutate(entries) { |
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 Submittable | |
extend ActiveSupport::Concern | |
include StimulusReflex::ConcernEnhancer | |
included do | |
prepend_before_reflex do | |
instance_variable_set("@#{resource_name.underscore}", resource_class.new(submit_params)) | |
end | |
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
module ApplicationCable | |
class Connection < ActionCable::Connection::Base | |
identified_by :current_user | |
identified_by :session_id | |
def connect | |
self.current_user = env["warden"].user | |
self.session_id = request.session.id | |
reject_unauthorized_connection unless self.current_user || self.session_id | |
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
// useHotkeys.js | |
import hotkeys from "hotkeys-js"; | |
export const bindHotkeys = (controller) => { | |
hotkeys.filter = () => true; | |
for (const [hotkey, handler] of Object.entries( | |
controller.constructor.hotkeys | |
)) { | |
hotkeys(hotkey, (e) => controller[handler](e)); |