Skip to content

Instantly share code, notes, and snippets.

View leenyburger's full-sized avatar

Colleen leenyburger

View GitHub Profile
@leenyburger
leenyburger / gist:a9af889bc798383372f8cbd52f9ead48
Last active August 28, 2025 07:51
Pipedream code for Apollo enrichment + PB automated messages
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
@leenyburger
leenyburger / gist:bf6d467ab2a47c2973d932b1424315bb
Created July 27, 2024 15:22
How to add a loading spinner to Simple File Upload while waiting for uploader

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:

CSS

/* Spinner Styles */
.spinner {
  position: absolute;
@leenyburger
leenyburger / #ChatGPT Streaming.md
Created August 8, 2023 20:50 — forked from alexrudall/#ChatGPT Streaming.md
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

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!

Alt Text

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