Installing mysql2 gem errors on MacOS Catalina with MySQL 5.7.
Make sure openssl is installed on Mac via Homebrew.
brew install openssl
| # /app/models/concerns/has_many_attached.rb | |
| module HasManyAttached | |
| extend ActiveSupport::Concern | |
| class_methods do | |
| def has_many_attached(name, dependent: :purge_later, service: nil, strict_loading: false, **options) | |
| super(name, dependent: :purge_later, service: nil, strict_loading: false) | |
| if options[:file_types].any? | |
| validate "validate_#{name}_file_types".to_sym |
| import { reactive } from '@vue/reactivity' | |
| function switchboard(value) { | |
| let lookup = {} | |
| let current | |
| let get = () => current | |
| let set = (newValue) => { |
| import { Controller } from "@hotwired/stimulus" | |
| import SignaturePad from 'signature_pad' | |
| export default class extends Controller { | |
| static targets = ["canvas", "input"] | |
| connect() { | |
| this.signaturePad = new SignaturePad(this.canvasTarget) | |
| this.signaturePad.addEventListener("endStroke", this.endStroke) | |
| this.resizeCanvas() | |
| if (this.inputTarget.value) { |
| // ==UserScript== | |
| // @name Download AlpineJs version from Tailwind UI | |
| // @namespace kevinbatdorf | |
| // @version 1.0 | |
| // @description When you press copy, it will download an html file containing the script code and alpine HTML | |
| // @author https://twitter.com/kevinbatdorf | |
| // @match https://tailwindui.com/components/* | |
| // @grant none | |
| // ==/UserScript== |
| // ==UserScript== | |
| // @name Add AlpineJs to Tailwind UI | |
| // @namespace http://tampermonkey.net/ | |
| // @version 3.0 | |
| // @description Add Alpine JS code to Tailwind Ui copy/paste | |
| // @author https://gist.github.com/KevinBatdorf/8bd5f808fff6a59e100dfa08a7431822 | |
| // @match https://tailwindui.com/components/* | |
| // @grant none | |
| // ==/UserScript== |
This is all you really need to know in order to make Action Mailbox work in development.
ngrok http 3000 and make note of your subdomain for steps 3 and 8.https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mimeaction_mailbox:
mailgun_api_key: API KEY HERE
| require "onnxruntime" | |
| require "mini_magick" | |
| img = MiniMagick::Image.open("bears.jpg") | |
| pixels = img.get_pixels | |
| model = OnnxRuntime::Model.new("model.onnx") | |
| result = model.predict({"inputs" => [pixels]}) | |
| p result["num_detections"] |
This blogpost shows how to setup Rails 6 with Bootstrap 4.
This snippet shows a somehow different and less customized approach.
$ rails new rails6-bootstrap4
$ bundle --binstubs
$ yarn add bootstrap jquery popper.js expose-loader