Skip to content

Instantly share code, notes, and snippets.

@masaomi
masaomi / #ChatGPT Streaming.md
Created February 12, 2024 12:27 — 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.

@masaomi
masaomi / knapsack.out
Last active February 2, 2020 07:34
knapsack.rb
Goods Stock:
Total Weight: 113, Total Price: 610
Goods 1, weight= 1, price=96
Goods 2, weight= 4, price=96
Goods 3, weight=14, price=96
Goods 4, weight=19, price=78
Goods 5, weight=13, price=66
Goods 6, weight=19, price=57
Goods 7, weight=17, price=47
@masaomi
masaomi / jupyter_demo
Created April 2, 2017 23:24
jupyter_demo
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div style=\"text-align: center\"><img width=300px src=\"http://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/R_logo.svg/200px-R_logo.svg.png\"></div>"
]
},
{

test

hogehoge