Skip to content

Instantly share code, notes, and snippets.

@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active May 23, 2024 21:04
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.

@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API
@prpetten
prpetten / .pronto.yml
Last active January 3, 2018 14:30
CircleCI Pronto config
all:
exclude:
- 'config/**/*'
- 'vendor/**/*'
max_warnings: 150
github:
slug: repo-owner/repo-name
@tomtomecek
tomtomecek / gist:be467df44da205c49778
Last active August 27, 2018 10:05
Ruby String interpolation vs Concatenation - benchmarking and comparison

Test nr.1

require 'benchmark/ips'
 
Benchmark.ips do |bm|
 
  TEST_STRING = 'I am testing...'
  ADD_STRING  = 'testing 1 2 3'
 
@iqbalhasnan
iqbalhasnan / carrierwave.rb
Last active May 25, 2023 06:06
carrierwave mini_magick image processing - quality, strip, exif rotation, gaussian blur, interlace
#config/initializers/carrierwave.rb
module CarrierWave
module MiniMagick
# Rotates the image based on the EXIF Orientation
def exif_rotation
manipulate! do |img|
img.auto_orient
img = yield(img) if block_given?
img
end
@basiszwo
basiszwo / rails-and-mssql.md
Created September 4, 2013 09:51
Rails and MSSQL Server

Rails and MSSQL

Install freeTDS (http://freetds.schemamania.org/)

brew install freetds for OSX Checkout what's required for Ubuntu.

Install tiny_tds for using freetds on

Check working connection

@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@schleg
schleg / 01. Gemfile
Created May 26, 2011 17:26
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'