If you're seeing a slow load on the iframe, you can move your script to defer or async and (if desired) add a loading gif.
Here's the code:
/* Spinner Styles */
.spinner {
position: absolute;
| import axios from "axios"; | |
| export default defineComponent({ | |
| async run({ steps, $ }) { | |
| const { email, first_name, last_name, how_did_you_find_us } = steps.trigger.event; | |
| if (!email) { | |
| throw new Error("Missing email in request"); | |
| } | |
| // Apollo enrichment |
This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!
First, add the ruby-openai gem! Needs to be at least version 4. Add Sidekiq too.
| <div data-controller="clipboard"> | |
| <%= render "clipboard_partial" %> | |
| </div> | |
| #clipboard_partial.html.erb | |
| <div> | |
| Welcome to the cliboard partial | |
| <div data-clipboard-text-value="Copy Me!"> | |
| More stuff | |
| </div> |
File is here in S3:
curl -I https://s3.us-east-1.wasabisys.com/static.files-simplefileupload.com/s2fuah5i30wvwd7for7ent2oj8p2
S3 returns a content type of Content-Type: image/jpeg
When the image is requested a GET request is sent to the Rails application which does a redirect_to. There is a WAF in front of *.files-simplefileupload.com. This returns a content type of text/html which is correct (I think)? -> then it hits a second WAF which sits in front of resize-files.simplefileupload.com
Curl the first WAF (redirect) type of text
➜ Developer git:(master) ✗ curl -I "https://cdn-jzo7ptov.files-simplefileupload.com/static/blobs/proxy/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBeG9lQVE9PSIsImV4cCI6bnVsbCwicHVyIjoiYmxvYl9pZCJ9fQ\=\=--0afeccae07753ae47dc2ba989601da489d50d492/0368F3B3-02EC-43CE-A2C8-1AA0EB020598.jpeg"| class Meetup | |
| include HTTParty | |
| base_uri 'api.meetup.com' | |
| attr_reader :options | |
| def initialize | |
| api_key = YOUR_API_KEY | |
| @options = { | |
| query: { |
| class MeetupController < ApplicationController | |
| def index | |
| @events = Meetup.new.events | |
| render json: @events, status: :ok | |
| rescue StandardError => e | |
| render json: { errors: e.message }, status: :unprocessable_entity | |
| end | |
| end |
| attr_reader :options | |
| def initialize | |
| api_key = YOUR_API_KEY | |
| @options = { | |
| query: { | |
| key: api_key, | |
| sign: "true", | |
| desc: "true", |
| class Meetup | |
| include HTTParty | |
| base_uri 'api.meetup.com' | |
| def get_data | |
| self.class.get('/operation-code-hampton-roads/events') | |
| end | |
| def events | |
| if get_data.code.to_i == 200 |
| class MeetupController < ApplicationController | |
| def index | |
| @events = Meetup.new.events | |
| render json: @events, status: :ok | |
| rescue StandardError => e | |
| render json: { errors: e.message }, status: :unprocessable_entity | |
| end | |
| end |