name: tester description: Use this agent when you need to write RSpec tests for new functionality, including feature specs for user workflows and unit tests for models, services, or other classes. Examples: Context: User has just implemented a new authentication feature and needs comprehensive test coverage. user: 'I just added magic link authentication to the User model. Can you write tests for this?' assistant: 'I'll use the rspec-test-writer agent to create comprehensive tests for your magic link authentication feature.' Since the user needs RSpec tests written for new functionality, use the rspec-test-writer agent to create appropriate test coverage. Context: User has created a new controller action and wants to ensure it's properly tested. user: 'I added a new endpoint for project time tracking. Here's the controller code...' assistant: 'Let me use the rspec-test-writer agent to write feature specs and controller tests for your new time tracking en
| print "\e[?25l" | |
| rows, cols = `stty size`.split.map(&:to_i) | |
| drops = Array.new(cols) { rand(rows) } | |
| chars = ("0".."9").to_a + ("A".."Z").to_a + ("a".."z").to_a | |
| loop do |
| def fix_encoding(str) | |
| # The "b" method returns a copied string with encoding ASCII-8BIT | |
| str = str.b | |
| # Strip UTF-8 BOM if it's at start of file | |
| if str.byteslice(0..2) == "\xEF\xBB\xBF".b | |
| str = str.byteslice(3..-1) | |
| end | |
| if str.ascii_only? |
This aims to be factual information about the size of large language models. None of this document was written by AI. I do not include any information from leaks or rumors. The focus of this document is on base models (the raw text continuation engines, not 'helpful chatbot/assistants'). This is a view from a few years ago to today of one very tiny fraction of the larger LLM story that's happening.
- GPT-2,-medium,-large,-xl (2019): 137M, 380M, 812M, 1.61B. Source: openai-community/gpt2. Trained on the unreleased WebText dataset said to 40GB of Internet text - I estimate that to be roughly 10B tokens. You can see a list of the websites that went into that data set here domains.txt.
- GPT-3 aka davinci, davinci-002 (2020): 175B parameters. There is a good breakdown of how those parameters are 'spent' here [How d
Ruby has recently merged namespaces as an experimental feature that is disabled by default, as of this writing.
This is a non-trivial development driven by @matz himself, and mainly implemented by @tagomoris, who just became a Ruby committer (🎉).
The feature has been cooking for a long time, with a first ticket opened a couple of years ago (#19744) and a revised one opened just last week (#21311).
| # Usage: | |
| # | |
| # class Post < ApplicationRecord | |
| # include HasNanoid | |
| # has_nanoid | |
| # end | |
| # | |
| module HasNanoid | |
| extend ActiveSupport::Concern |
| require "digest" | |
| require "rack" | |
| # This class encapsulates a unit of work done for a particular tenant, connected to that tenant's database. | |
| # ActiveRecord makes it _very_ hard to do in a simple manner and clever stuff is required, but it is knowable. | |
| # | |
| # What this class provides is a "misuse" of the database "roles" of ActiveRecord to have a role per tenant. | |
| # If all the tenants are predefined, it can be done roughly so: | |
| # | |
| # ActiveRecord::Base.legacy_connection_handling = false if ActiveRecord::Base.respond_to?(:legacy_connection_handling) |
| class FuzzyIndex | |
| def initialize | |
| @index = Hash.new { |h, k| h[k] = Set.new } | |
| end | |
| def []=(key, value) | |
| trigrams(key).each { @index[it] << [key, value] } | |
| end | |
| def [](query) |
| <%= form_with model: citizen, class: "card flex flex-col gap", data: { controller: "form" } do |form| %> | |
| <div class="flex flex-col gap mb-2"> | |
| <div class="flex flex-col gap-half"> | |
| <% countries = Country.order(:name) %> | |
| <%= label_tag :country_id, "Country", class: "text-sm font-medium leading-none" %> | |
| <%= select_tag :country_id, options_from_collection_for_select(countries, :id, :name, citizen.country_id), include_blank: "Select one", class: "input", data: { action: "form#submit", form_submitter_param: "on_country_change" } %> | |
| </div> | |
| <div class="flex flex-col gap-half"> | |
| <% states = State.where(country_id: citizen.country_id).order(:name) %> |
You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.
I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is