Skip to content

Instantly share code, notes, and snippets.

View lucianghinda's full-sized avatar

Lucian Ghinda lucianghinda

View GitHub Profile
@lucianghinda
lucianghinda / parser.rb
Created January 8, 2024 09:55
Gemfile parser with Prism
# frozen_string_literal: true
require "prism"
module RubyGems
module GemList
class Parser
def initialize(list, rubygems_client: RubyGems::Client.new)
@list = list
@rubygems_client = rubygems_client
@lucianghinda
lucianghinda / api_response.rb
Created March 30, 2024 18:16
Mastodon Client
module Mastodon
ApiResponse = Data.define(:body, :headers, :code, :links)
end
@lucianghinda
lucianghinda / compare.rb
Created October 5, 2024 15:31
Compare Substack exported subscribers with Beehiiv exported subscribers
require 'csv'
require 'time'
require 'set'
class Diff
MissingData = Data.define(:rows, :headers)
def initialize(source_file:, second_file:)
@source_file = source_file
@second_file = second_file
@lucianghinda
lucianghinda / benchmark-instance-variables-vs-private-getters.rb
Created April 23, 2025 14:26
Ruby - Benchmark Instance Variable vs Private Getters Access
require 'benchmark'
require 'benchmark/ips'
class TestClass
def initialize
@value = "test value"
end
def direct_access
@value