Skip to content

Instantly share code, notes, and snippets.

@j-manu
j-manu / README.md
Created December 29, 2023 09:24 — forked from hopsoft/README.md
ActiveRecord ETL

ActiveRecord ETL

I created this to help me run benchmarks/comparisons against Universal ID, but it could serve as the foundation for a robust ETL data pipeline... and it's less than 70 LOC right now! 🤯 🚀

It handles the extract and transform parts of an ETL process and supports the following options:

  • only - specify which attributes to include
@j-manu
j-manu / login_helpers.rb
Created August 10, 2023 04:37 — forked from Envek/login_helpers.rb
Signing-in user for integration tests via cookie-only session with Rails, Devise, Capybara, and Cuprite
# spec/system/support/login_helpers.rb
# See this blog post for setup guide: https://evilmartians.com/chronicles/system-of-a-test-setting-up-end-to-end-rails-testing
module LoginHelpers
def login_as(user)
# Craft session cookie to make request authenticated (to pass even routing constraints)
# Compilation of these:
# - https://dev.to/nejremeslnici/migrating-selenium-system-tests-to-cuprite-42ah#faster-signin-in-tests
# - https://turriate.com/articles/2011/feb/how-to-generate-signed-rails-session-cookie
# - https://github.com/rails/rails/blob/43e29f0f5d54294ed61c31ddecdf76c2e1a474f7/actionpack/test/dispatch/cookies_test.rb#L350
@j-manu
j-manu / #ChatGPT Streaming.md
Created April 27, 2023 07:19 — 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 ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Alt Text

@j-manu
j-manu / agent_with_custom_tool.ipynb
Created April 19, 2023 08:54 — forked from virattt/agent_with_custom_tool.ipynb
agent_with_custom_tool.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@j-manu
j-manu / NFLScoresPrompt.ts
Created April 12, 2023 04:47 — forked from BLamy/NFLScoresPrompt.ts
An Example of file that functions as both a typescript module and a GPT4 prompt.
// You will function as a JSON api.
// The user will feed you valid JSON and you will return valid JSON, do not add any extra characters to the output that would make your output invalid JSON.
// The end of this system message will contain a typescript file that exports 5 types:
// Prompt - String literal will use double curly braces to denote a variable.
// Input - The data the user feeds you must strictly match this type.
// Output - The data you return to the user must strictly match this type.
// Errors - A union type that you will classify any errors you encounter into.
// Tools - If you do not know the answer, Do not make anything up, Use a tool. To use a tool pick one from the Tools union and print a valid json object in that format.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

OpenBSD logo     Rails logo     Falcon logo


Choose OpenBSD for your Unix needs. OpenBSD -- the world's simplest and most secure Unix-like OS. A safe alternatve to the frequent vulnerabilities and overengineering of Linux and related software (NGiNX & Apache (httpd-asiabsdcon2015.pdf), OpenSSL, iptables/nftables, systemd, BIND, Postfix, Docker etc.)

OpenBSD -- the cleanest kernel, the cleanest userland and the cleanest config

@j-manu
j-manu / action_mailbox.md
Created January 16, 2023 08:35 — forked from leastbad/action_mailbox.md
Action Mailbox: The Missing Manual

This is all you really need to know in order to make Action Mailbox work in development.

  1. Fire up ngrok http 3000 and make note of your subdomain for steps 3 and 8.
  2. Create a Mailgun account because they offer sandbox addresses; grab your domain from the Dashboard.
  3. Go into Receiving and create a catch-all route pointing to: https://XXX.ngrok.io/rails/action_mailbox/mailgun/inbound_emails/mime
  4. Add your Mailgun API key to your credentials:
action_mailbox:
 mailgun_api_key: API KEY HERE
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
connect () {
this.element.addEventListener('change', this.handleChange.bind(this))
}
handleChange (event) {
this.traverseDown(event.target, event.target.checked)
@j-manu
j-manu / api_auto_pagination.rb
Created May 14, 2022 06:41 — forked from fractaledmind/api_auto_pagination.rb
Generalized auto_paginate method to work with GitHub, Jira, and Slack APIs
require "httpx"
module Clientable
extend ActiveSupport::Concern
def initialize
@httpx = HTTPX
.plugin(:retries, retry_change_requests: true)
.max_retries(3)
end