Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Settings class
*/
/**
* Class Settings
*/
class Settings {
/**
@ker0x
ker0x / find_by_role.php
Last active October 10, 2022 16:01
Symfony User findByRole
<?php
public function findByRole(Role $role): mixed
{
$rsm = $this->createResultSetMappingBuilder('u');
$query = <<<SQL
SELECT %s
FROM user u
WHERE u.roles::jsonb ?? :role
@makrmark
makrmark / remote_modal_events_controller.js
Last active May 24, 2024 09:09
How to respond to Bootstrap (5) events from within Rails Stimulus Controller
import { Controller } from "@hotwired/stimulus"
import { Modal } from "bootstrap"
// Connects to data-controller="remote-modal-events"
export default class extends Controller {
connect() {
let thisController = this
// The listener for the Bootstrap event
this.element.addEventListener('hide.bs.modal', function (event) {