Skip to content

Instantly share code, notes, and snippets.

View skatkov's full-sized avatar
🏠

Stanislav (Stas) Katkov skatkov

🏠
View GitHub Profile
@skatkov
skatkov / README.md
Created August 29, 2026 15:25
RDoc RBS member lookup benchmark

RDoc RBS Member Lookup Benchmark

Benchmarks the two quadratic lookups replaced by parser-local Hash indexes in RDoc::Parser::RBS:

  • Looking up methods in a growing Context#method_list.
  • Looking up attributes in a growing Context#attributes array.

The optimized parser keeps those ordered arrays unchanged. It builds one Hash per context from each authoritative array and updates the indexes as RBS members

@skatkov
skatkov / benchmark.rb
Created August 29, 2026 09:03
RDoc Store Page Lookup Benchmark
#!/usr/bin/env ruby
# frozen_string_literal: true
require "fileutils"
require "json"
require "optparse"
require "rbconfig"
SCRIPT = File.expand_path(__FILE__)
TMP_ROOT = File.expand_path("tmp", __dir__)
@skatkov
skatkov / .gitignore
Created August 28, 2026 11:03
RDoc lazy colored tokens benchmark
/tmp/
{"session_id":"GitHits-899010","server_label":"GitHits","seq":1,"ts":"2026-07-15T13:36:50.229550739+02:00","direction":"meta","transport":"stdio","raw":{"command":["npx","-y","githits@latest","mcp","start"],"cwd":"/home/sk"}}
{"session_id":"GitHits-899010","server_label":"GitHits","seq":2,"ts":"2026-07-15T13:36:50.245458273+02:00","direction":"c2s","transport":"stdio","raw":{"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{"roots":{}},"clientInfo":{"name":"opencode","version":"1.18.1"}},"jsonrpc":"2.0","id":0}}
{"session_id":"GitHits-899010","server_label":"GitHits","seq":3,"ts":"2026-07-15T13:36:51.316323336+02:00","direction":"s2c","transport":"stdio","raw":{"result":{"protocolVersion":"2025-11-25","capabilities":{"tools":{"listChanged":true}},"serverInfo":{"name":"githits","version":"0.6.2"},"instructions":"GitHits provides verified open-source examples plus indexed package/repository evidence.\n\nRouting: use `get_example` for canonical cross-project examples; use `search` /
@skatkov
skatkov / json
Created May 17, 2026 23:53
5000 top downloads from rubygems
[
{
"name": "bundler",
"downloads": 6785603219
},
{
"name": "aws-sdk-core",
"downloads": 3327372761
},
{
# config/initializers/rollout.rb
ROLLOUT_OPTIONS = YAML.load_file(Rails.root.join(“config”, “rollout.yml”))[Rails.env]
#!/bin/sh
set -eu
#region logging setup
if [ "${MISE_DEBUG-}" = "true" ] || [ "${MISE_DEBUG-}" = "1" ]; then
debug() {
echo "$@" >&2
}
else
debug() {
@skatkov
skatkov / fix-extlz4.sh
Created May 25, 2025 14:40
Fix exltz4 gem installation
#!/bin/bash
set -e
echo "Simple comprehensive fix for extlz4 gem installation..."
# Create temporary directory
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
echo "Downloading extlz4 gem..."
@skatkov
skatkov / method_call_detection.rb
Created May 20, 2025 09:53
Method detection code
# Raises an error when method is called, unless it was called by known caller.
#
# In your class:
#
# include MethodCallDetection
# detect_method_calls_of :method_to_detect do |trace|
# next true if trace[0].match?('path/of/direct_call.rb:123')
# next true if trace.any? { _1.match?('path/of/call_somewhere.rb') }
# end
module MethodCallDetection
@skatkov
skatkov / settings.json
Last active April 20, 2025 17:05
zed.settings.json
{
"ui_font_family": "FiraCode Nerd Font Mono",
"buffer_font_family": "FiraCode Nerd Font Mono",
"theme": {
"mode": "system",
"light": "Alabaster",
"dark": "One Dark"
},
"lsp": {
"golangci-lint": {