see https://pnpm.io/installation
$ pnpm --versioncorepack will NOT be distributed with Node.js v25>= https://nodejs.org/docs/latest-v24.x/api/corepack.html
see https://pnpm.io/installation
$ pnpm --versioncorepack will NOT be distributed with Node.js v25>= https://nodejs.org/docs/latest-v24.x/api/corepack.html
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!
Want more content like this, for free? Check out my free book, RailsAI!
| class << NSProxy | |
| def method_added(meth) | |
| end | |
| def inherited(klass) | |
| end | |
| end | |
| class Proxy < NSProxy | |
| def self.const_missing(n) |
| require 'childprocess' | |
| guard 'shell' do | |
| watch %r{^app/(.+)\.rb$} do |m| | |
| `killall rake` | |
| # Why this: | |
| # - spawn a child process to avoid locking Guard | |
| # - make sure that the child process has stdout and stdin otherwise it crashes | |
| # - bonus point: get REPL access in the simulator! |
| module ActiveRecord::UnionScope | |
| def self.included(base) | |
| base.send :extend, ClassMethods | |
| end | |
| module ClassMethods | |
| def union_scope(*scopes) | |
| id_column = "#{table_name}.#{primary_key}" | |
| sub_query = scopes.map { |s| s.select(id_column).to_sql }.join(" UNION ") | |
| where "#{id_column} IN (#{sub_query})" |
| class MyViewController < UIViewController | |
| include ViewTags | |
| #by convention, these views will have tags that correspond to the order you specify them in | |
| # :date_label:1, :name_label:2 | |
| has_view :date_label, :name_label | |
| def loadView | |
| views = NSBundle.mainBundle.loadNibNamed "myview", owner:self, options:nil | |
| self.view = views[0] |
This is a distillation of a technique we use internally at Basho to reduce the pain of cloning some of our larger repos. It relies a bit on shell scripts and environment variables, but it can be run more directly, as I show below.
Create a bare git repository in some directory, e.g. /var/lib/gitcache.
git init --bare /var/lib/gitcacheAdd all repositories you want to cache as remotes to the git repository, e.g.
| .list-container { | |
| border-radius: 5px; | |
| border: 1px solid #C5C5C5; | |
| box-shadow: inset 0 1px 0 #FFF; | |
| } | |
| ol { | |
| border: 1px solid transparent; | |
| } |
Gist to describe the process of adding a namespaced isolated Rails Engine
to a typical Rails application and adding methods to one of the Rails Engine's
controller and model.
| body { | |
| background-color: #FFF; | |
| } | |
| #wrapper { | |
| width: 90%; | |
| margin: 200px auto; | |
| } | |
| h1 { |