Skip to content

Instantly share code, notes, and snippets.

View yshmarov's full-sized avatar
🇺🇦

Yaro Shm yshmarov

🇺🇦
View GitHub Profile

Для интеграции ChatGPT в приложение Rails вам потребуются следующие шаги:

  1. Получите API-ключ GPT, откройте сайт https://openai.com/ и зарегистрируйте аккаунт, елкгда будут инструкции по получению ключа.

  2. Добавьте библиотеку 'httparty' в файл Gemfile вашего приложения и запустите

bundle install
  1. Создайте класс в папке 'lib' вашего приложения для обращения к сервису GPT:
@yshmarov
yshmarov / ferrum.rb
Created February 20, 2024 20:32 — forked from bopm/ferrum.rb
format.pdf do
html = ApplicationController.new.render_to_string(
template: 'pdfs/test',
formats: [:pdf],
layout: 'layouts/pdf',
assigns: { user: @user },
encoding: 'UTF-8'
)
Ferrum::Browser.new(timeout: 7).tap do |browser|
browser.content = html
def authenticate_and_get_companies
host = "https://api.procore.com"
client_id = "foo"
client_secret = "bar"
procore_account = ProcoreAccount.create!(access_token: nil, refresh_token: nil, expires_at: nil)
token = Procore::Auth::ClientCredentials.new(
client_id: client_id,
client_secret: client_secret,
@yshmarov
yshmarov / gist:1330c88bb6976313003151b53653de5c
Created July 25, 2024 08:53
Jumpstart: what's good and what's bad
SVGs are not abstracted
Connected_accounts & accounts - misleading naming; accounts should be organizations
No exmaple of a resource that requires paid account to access
Inconsistent CSS (btn btn or inline classes)
UI could be better (do not mix User-level features and Acconut level features (Billing, members))
Reuse shared <head>
Flash above app content. WTF?!
Bloatware
- action text mentions
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
PRODID:-//Apple Inc.//macOS 15.2//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Paris
BEGIN:DAYLIGHT
DTSTART:19810329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
TZNAME:CEST
@yshmarov
yshmarov / no-tailwind-yes-importmaps.txt
Last active August 22, 2025 08:48
new rails app with minimal dependencies for screencasts
rails new myapp --skip-docker --skip-keeps --skip-action-mailer --skip-action-mailbox --skip-action-text --skip-thruster --skip-brakeman --skip-rubocop --skip-ci --skip-kamal