Skip to content

Instantly share code, notes, and snippets.

View trobrock's full-sized avatar

Trae Robrock trobrock

View GitHub Profile
class Message < ApplicationRecord
has_translated_rich_text :content
trobrock / intelligence.rb
Created November 29, 2023 18:08
OpenAI in Rails
# frozen_string_literal: true
module Intelligence
extend ActiveSupport::Concern
MODEL = 'gpt-4-1106-preview'
def get_chat_completion(json: true)
FROM ruby:3.2.2
# Set up the Chrome PPA
RUN wget -q -O - | apt-key add -
RUN echo "deb stable main" >> /etc/apt/sources.list.d/google.list
# Update the package list and install chrome
RUN apt-get update -y
RUN apt-get install -y google-chrome-stable
You are SoftwareEngineer-GPT, an AI designed to autonomously develop software to streamline business operations for Berry Springs Lodge.
Your decisions must always be made independently without seeking user assistance. Play to your strengths as an LLM and pursue simple strategies with no legal complications.
1. Write ruby code to screen scrape indeed to collect market pay rates.
1. ~4000 word limit for short term memory. Your short term memory is short, so immediately save important information to files.
module RateLimitable
extend ActiveSupport::Concern
class_methods do
def rate_limiter(name, key:, threshold:, interval:, retry_from: [])
limiter_name = "#{name}_limiter"
define_method(limiter_name) do |&block|
limiter = instance_variable_get("@#{limiter_name}".to_sym)
limiter ||= instance_variable_set("@#{limiter_name}".to_sym,
#!/usr/bin/env bash
export AWS_PROFILE=trobrock
echo "Creating archive..."
tar -cv $file | gzip -9 > $file.tgz
echo "\tDONE"
echo "Uploading to glacier..."
# frozen_string_literal: true
module EncryptedAttribute
extend ActiveSupport::Concern
class_methods do
def attr_encrypted(attr)
define_method(attr) do
value = instance_variable_get("@#{attr}")
return value if value
trobrock / Gemfile
Created June 25, 2020 19:14 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
name: Compile Mermaid Diagrams
on: [push]
name: Compile Mermaid
runs-on: ubuntu-latest
- uses: actions/checkout@master
#!/usr/bin/env bash
# Run this with `git bisect start BAD_SHA GOOD_SHA ; git bisect run ~/`
# Run migrations, bundle, etc to make sure the app updates through time, and ensure there is a clean git tree
bundle install
git checkout Gemfile.lock
# Run the test, the exec is important so it returns the proper status code
exec rspec spec/models/tasks/inventory_clone_spec.rb