"dependencies": { "cable_ready": "5.0.0-pre1", "mrujs": "^0.3.0-beta.25" }
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 IndexableByHashPatch | |
| refine Array do | |
| def to_proc | |
| ->(h) { length == 1 ? h[first] : h.values_at(*self) } | |
| end | |
| end | |
| end | |
| using IndexableByHashPatch |
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
| oooo | |
| oooo:~:+oo | |
| o~.~:~~.:+oo | |
| oooooo oooooooooooo o+:...~.~:o | |
| o+:++~+o ooo++:::::::+++oo++...:.~~o | |
| o+:~+:.~o oo+::~~~:~~~:::~~:::~~:+:~~~o | |
| o+~..+...+ooo+:~~::::~~:~~+++++++++++:~~~+o | |
| o+~..... :::~~~:::+::+:~~::+:++::+:::+~~~+o | |
| o:~.~~.~~~~:::+::~..::~:+~:::::+++++:.::o | |
| o:~~~:+:+++++:....~...::......~:+++:.:~o |
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 Channel < ActionCable::Channel::Base | |
| include CableReady::Broadcaster | |
| delegate :render, to: :ApplicationController | |
| 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
| # intended to be a Rails 6.1 initializer based on @rolandstuder's https://github.com/rails/rails/pull/41506 | |
| # if you want to use it with Rails 7, you will need to add a third options: parameter to the method | |
| module ActiveRecord | |
| module DelegatedType | |
| private | |
| def define_delegated_type_methods(role, types:) | |
| role_type = "#{role}_type" | |
| role_id = "#{role}_id" | |
| define_method "#{role}_class" 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 { Controller } from 'stimulus' | |
| export default class extends Controller { | |
| static values = { | |
| idleTimeoutMs: 30000, | |
| currentIdleTimeMs: Number, | |
| checkIdleStateRateMs: 250, | |
| isUserCurrentlyOnPage: true, | |
| isUserCurrentlyIdle: Boolean, | |
| currentPageName: 'default', |
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 ApplicationController from '../application_controller' | |
| import SlimSelect from 'slim-select' | |
| export default class extends ApplicationController { | |
| static values = { | |
| limit: Number, | |
| placeholder: String, | |
| searchText: String, | |
| searchingText: String, | |
| reflex: String, |
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
| gem "webpacker", "~> 5.4.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
| class CustomersReflex < ApplicationReflex | |
| def lookup(search) | |
| # use search string to do some kind of DB lookup here | |
| self.payload = {} # I have NO IDEA what tom-select expects! | |
| morph :nothing | |
| 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
| # using a predefined hash | |
| hash = { field1: "foo", field2: "bar" } | |
| HashStruct = Struct.new(*hash.keys, keyword_init: true) | |
| hash_struct = HashStruct.new(hash) | |
| hash_struct.field1 # => "foo" | |
| hash_struct.field2 # => "bar" | |
| hash_struct.field3 # => ERROR! |
NewerOlder