Skip to content

Instantly share code, notes, and snippets.

View discoposse's full-sized avatar
💭
Life happens. How you interpret the results is what you have control over.

Eric Wright discoposse

💭
Life happens. How you interpret the results is what you have control over.
View GitHub Profile
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active March 26, 2024 22:33
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.

@discoposse
discoposse / README.md
Created April 29, 2019 01:41 — forked from tristanm/README.md
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@codingoutloud
codingoutloud / which.ps1
Last active December 24, 2015 10:19
Implements the Unix shell 'which' command using PowerShell
<#
Implements the Unix shell 'which' command using PowerShell.
original: https://gist.github.com/codingoutloud/6782961
#>
function WhichOnes
{
if ($args.Count -eq 0)
{
# obviously use of 'which' in usage text is a hack (since it is chosen to match the alias)