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
| post "events", to: "events#create", constraints: ->(req) do | |
| req.user_agent == "SavvyCal Webhooks (https://savvycal.com)" && | |
| req.params["type"] == "event.created" | |
| end | |
| post "events", to: "events#update", constraints: ->(req) do | |
| req.user_agent == "SavvyCal Webhooks (https://savvycal.com)" && | |
| ["event.rescheduled", "event.canceled"].include?(req.params["type"]) | |
| 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
| import { Controller } from '@hotwired/stimulus' | |
| import autoAnimate from '@formkit/auto-animate' | |
| export default class extends Controller { | |
| connect () { | |
| autoAnimate(this.element) | |
| } | |
| } |
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
| resources :media, shallow: true, | |
| constraints: ->(req) do | |
| current_user = req.env["warden"].user(:user) | |
| Flipper.enabled?(:media_uploads, current_user) | |
| 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
| class Chart < ApplicationRecord | |
| validate do |chart| | |
| schema = Rails.cache.fetch("vega_lite_schema/v5") do | |
| Faraday.get("https://vega.github.io/schema/vega-lite/v5.json").body | |
| end | |
| JsonSchemaValidator.new(chart, schema: schema, json: vega_json, field: :vega_json).validate | |
| 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
| import { Controller } from '@hotwired/stimulus' | |
| export default class extends Controller { | |
| connect () { | |
| this.element.addEventListener('change', this.handleChange.bind(this)) | |
| } | |
| handleChange (event) { | |
| this.traverseDown(event.target, event.target.checked) |
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 '@hotwired/stimulus' | |
| export default class extends Controller { | |
| connect () { | |
| this.element.addEventListener('change', this.handleChange.bind(this)) | |
| } | |
| handleChange (event) { | |
| this.traverseDown(event.target, event.target.checked) | |
| } |
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 Event < ApplicationRecord | |
| # Associations | |
| belongs_to :owner, class_name: "User", optional: true | |
| belongs_to :event_source, polymorphic: true | |
| has_noticed_notifications | |
| # ... | |
| 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
| require "faraday" | |
| require "faraday/multipart" | |
| token = ARGV.shift | |
| absolute_path = File.expand_path(ARGV.shift) | |
| # TODO how could we require "active_storage/blob" without eager loading the whole app | |
| blob = ActiveStorage::Blob.build_after_unfurling(io: File.open(absolute_path), filename: File.basename(absolute_path)) |
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 { UpdatesForElement } from "cable_ready"; | |
| import activeElement from "cable_ready/javascript/active_element"; | |
| document.addEventListener("stimulus-reflex:before", (event) => { | |
| recursiveMarkUpdatesForElements(event.detail.element); | |
| }); | |
| document.addEventListener("stimulus-reflex:after", (event) => { | |
| setTimeout(() => { | |
| recursiveUnmarkUpdatesForElements(event.detail.element); |
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
| $ bundle add pagy |