- Install the Stripe CLI with:
brew install stripe/stripe-cli/stripe - Login to our Stripe account:
stripe login - Listen for Stripe webhooks using Latest API version and forward to:
yarn stripe:listen, which does:stripe listen --latest --forward-to http://localhost:3000/webhook_events/stripe
- Replay events locally with
stripe trigger <event type>: stripe trigger checkout.session.completed
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 Game | |
| attr_gtk | |
| def tick | |
| defaults | |
| render | |
| input | |
| calc | |
| 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 Jobbable | |
| extend ActiveSupport::Concern | |
| # This concern allows model instances to run async jobs that depend on them. | |
| # Calling #async_method_name will trigger the MethodNameJob | |
| PREFIX = "async_" | |
| included do | |
| def method_missing(method_name) |
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
| #! /usr/bin/env ruby | |
| # adapted from https://gist.github.com/gabehollombe/064a90351c204381832d749ca6b569e0 | |
| # but it actually edits a file! | |
| # `editor.rb [filename]` | |
| # arrows, letters, backspace... Just the basics. | |
| require 'curses' | |
| include Curses | |
| include Curses::Key |
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 'zlib' | |
| module RImage | |
| class InvalidSignature < Exception | |
| end | |
| class InvalidChecksum < Exception | |
| end | |
| class RImage |
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
| <div class="field" data-controller="toggle-password-visibility" data-toggle-password-visibility-visible-icon-class="mdi-eye-off"> | |
| <%= form.label :password, class: 'label'%> | |
| <div class="control"> | |
| <div class="field has-addons has-addons-right"> | |
| <div class="control is-clearfix has-icons-left has-icons-right"> | |
| <span class="icon is-left"> | |
| <i class="mdi mdi-onepassword mdi-24px"></i> | |
| </span> | |
| <%= form.password_field :password, class: ['input', { "is-danger": sign_in.errors.key?(:password) }], data: { 'toggle-password-visibility-target': 'password' }, required: true %> | |
| <% if sign_in.errors.key?(:password) %> |
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 ApplicationPresenter | |
| attr_reader :model | |
| delegate_missing_to :@model | |
| delegate :helpers, to: 'ActionController::Base' | |
| delegate :url_helpers, to: 'Rails.application.routes' | |
| delegate :to_param, :to_json, :to_query, :to_yaml, :to_enum, to: :@model | |
| delegate :model_name, :model_name_const, :model_name_underscore, to: :class | |
| def initialize(model) |
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
| # frozen_string_literal: true | |
| Rails.application.eager_load! | |
| unused_routes = {} | |
| # Iterating over all non-empty routes from RouteSet | |
| Rails.application.routes.routes.map(&:requirements).reject(&:empty?).each do |route| | |
| name = route[:controller].camelcase | |
| next if name.start_with?('Rails') |
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 Publisher | |
| def subscribe(subscribers) | |
| @subscribers ||= [] # if @subscribers is nil, we initialize it as empty array, else we do nothing | |
| @subscribers += subscribers | |
| end | |
| def broadcast(event, *payload) | |
| @subscribers ||= [] # @subscribers is nil, we can't do each on it | |
| @subscribers.each do |subscriber| | |
| # If event is :item_added occured with payload item itself |
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
| <%= render StimulusComponent.new controller: "test" do |component| %> | |
| <button <%= component.action :click, :test, :test %>>Hello, Stimulus Component!</button> | |
| <% end %> |