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 dockerfile-rails | |
| bin/rails g dockerfile | |
| brew add flyctl | |
| flyctl launch | |
| fly open |
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 Net::HTTPWithDebug | |
| def initialize(*args) | |
| super | |
| set_debug_output(STDERR) | |
| end | |
| end | |
| Net::HTTP.prepend(Net::HTTPWithDebug) |
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 Referrable | |
| extend ActiveSupport: :Concern | |
| included do | |
| has_one referral, foreign_key: "referred_user_id", dependent: : destroy has_one referring_user, through: :referral alias_method :referred_by, :referring_user | |
| has_many :referrals, foreign_key: "referring_user_id", dependent: :nullify has_many :referred_users, through: referrals | |
| validates :referral_code, uniqueness: true, allow_nil: true | |
| 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
| raw, hashed = Devise.token_generator.generate(User, :reset_password_token) | |
| user = User.find_by(email: '[email protected]') | |
| user.reset_password_token = hashed | |
| user.reset_password_sent_at = Time.now.utc | |
| user.save | |
| # https://mysaas.com/users/password/edit?reset_password_token=raw |
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 | |
| class ColorPalette | |
| DEFAULT_BASE = 3 | |
| DEFAULT_SATURATION = 0.5 | |
| DEFAULT_LIGHTNESS_MIN = 0.4 | |
| DEFAULT_LIGHTNESS_MAX = 0.8 | |
| DEFAULT_LIGHTNESS_DECAY = 20 | |
| # Generate a color scheme with a given number of colors. |
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 data-controller="modal" data-action-"click@document->modal#close"> | |
| <div class="modal" data-target="modal.modal"> | |
| ... modal content goes here | |
| </div> | |
| </div> |
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
| <%= turbo_frame_tag "tabs", target: "tab-content" do %> | |
| <%= link_to 'Tab 1', tab_1_path %> | |
| <%= link_to 'Tab 2', tab_2_path %> | |
| <% end -%> | |
| <%= turbo_frame_tag "tab-content", src: tab_1_path, loading: "eager" %> | |
| # Read more: https://turbo.hotwired.dev/handbook/frames |
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
| <style> | |
| .photos img { | |
| width: 15%; | |
| aspect-ration: 3/2; | |
| object-fit: contain; | |
| mix-blend-mode: color-burn; | |
| } | |
| .photos { | |
| background: #dfdfdf; |
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
| # ๐๐ฎ๐๐๐ฒ๐ฟ ๐๐ผ๐ฐ๐ธ ๐๐ถ๐ฑ๐ถ๐ป๐ด | |
| defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0.05;killall Dock | |
| # Dismiss unmount notifications | |
| sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.DiskArbitration.diskarbitrationd.plist DADisableEjectNotification -bool YES && sudo pkill diskarbitrationd |
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 Cents < ActiveRecord::Type::Integer | |
| def cast(value) | |
| return super if value.is_a?(Numeric) | |
| price_in_dollars = value.to_s.delete("$").to_d | |
| price_in_cents = (price_in_dollars * 100).to_i | |
| super(price_in_cents) | |
| end | |
| def self.dollarize(value) |