-
First, configure Shrine. I'll leave this exercise to the reader as it's very dependent on how you'll be storing your files (on a server, on S3, etc.)
-
Define an alternate attachment module (instead of the ActiveStorage or Paperclip one):
module ShrineImageAttachment extend ActiveSupport::Concern included do # FIXME: Use whatever store you have defined that you want to use for product images. To avoid caching issues, I recommend using some kind of public store.
🏄♂️
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 search | |
| function! GemSearch() | |
| call fzf#run(fzf#wrap({'source': "bundle list | sed '1d;$d' | cut -d ' ' -f 4", 'sink': {gem -> GemFileSearch(gem)}})) | |
| endfunction | |
| function! GemFileSearch(gem) | |
| let gemdir = substitute(system("bundle show " . a:gem), '\n\+$', '', '') | |
| call fzf#run(fzf#wrap({'source': 'rg --files ' . gemdir . ' --color never | sed -e "s#^' . gemdir . '/##"', 'dir': gemdir})) | |
| endfunction |
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 Player < ActiveRecord::Base | |
| BASE_ELO = 1000 | |
| has_many :elo_ratings | |
| after_save :record_rating | |
| attr_writer :elo | |
| def elo | |
| elo_ratings.most_recent_rating || BASE_ELO | |
| 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 OpenGraph | |
| class << self | |
| def fetch_data(url) | |
| html = Nokogiri::HTML(body(url)) | |
| { | |
| title: find_meta("og:title", html) || html.title.presence, | |
| description: find_meta("og:description", html), | |
| image: find_meta("og:image", html), | |
| site_name: find_meta("og:site_name", html) |
OlderNewer