A screenrc-style status footer for Claude Code showing real-time session data.
[Opus] 14% | ↓28.5K ↑8.2K/200.0K | +156 -23 | 14m07s | main | myproject/src | $0.08
| # frozen_string_literal: true | |
| require "benchmark" | |
| require "memory_profiler" | |
| require "active_support" | |
| require "active_support/core_ext/object/blank" | |
| def test_fast | |
| @cache = ENV["TESTING"].presence if !defined?(@cache) | |
| @cache | |
| end |
| class BaseClient | |
| class APINotFound < StandardError; end | |
| attr_reader :auth_strategy | |
| def initialize(auth_strategy: :headers, headers: {}) | |
| @auth_strategy = auth_strategy | |
| @headers = headers | |
| end |
| 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 |
| class AttachedValidator < ActiveModel::EachValidator | |
| # Active Storage validator to ensure that an attachment is attached. | |
| # | |
| # usage: | |
| # validates :upload, attached: true | |
| # | |
| def validate_each(record, attribute, _value) | |
| return if record.send(attribute).attached? | |
| errors_options = {} |
Для интеграции ChatGPT в приложение Rails вам потребуются следующие шаги:
Получите API-ключ GPT, откройте сайт https://openai.com/ и зарегистрируйте аккаунт, елкгда будут инструкции по получению ключа.
Добавьте библиотеку 'httparty' в файл Gemfile вашего приложения и запустите
bundle install| <style> | |
| .git-graph { | |
| text-align: left; | |
| line-height: 1; | |
| } | |
| .git-graph-row { | |
| clear: both; | |
| text-align: left; | |
| } | |
| .git-graph-cell { |
yarn add tom-select@import "tom-select/dist/css/tom-select.bootstrap5";| -------------------- model Recipe + Favorites ----------------------- | |
| 1. Add pagination: | |
| =============== | |
| Gemfile | |
| ------- | |
| gem 'pagy' | |
| $bundle |