Skip to content

Instantly share code, notes, and snippets.

View activefx's full-sized avatar

Matt Solt activefx

View GitHub Profile
class Example
def make_method(&block)
line_no = __LINE__; method_defs = %{
def dynamic_method
#{block}.call(1)
end
}
instance_eval method_defs, __FILE__, line_no
module Nokoquery
module DSL
module Item
def item(name, *args, **options, &block)
modulizer = Nokoquery::Modulizer.new(module_type: 'Item', name: name, klass: self)
method_module = modulizer.module_for
mod_name = modulizer.module_name
method_module.class_variable_set(:"@@_#{mod_name}_#{name}_block_capture", block)
@activefx
activefx / queues.rake
Last active May 13, 2021 12:27
Rake tasks for Shoryuken / AWS SQS queue creation and management
# See https://github.com/phstc/shoryuken/wiki/Creating-a-queue
namespace :queues do
desc "List all SQS queues"
task :list => :environment do
queues.each { |queue_url| puts queue_url }
end
desc "Get details for a specific SQS Queue"
@activefx
activefx / 20250805200852_install_prompt_engine.rb
Created August 5, 2025 20:19
Compressed PromptEngine migrations in correct order
class InstallPromptEngine < ActiveRecord::Migration[8.0]
def change
create_table :prompt_engine_settings do |t|
# Encrypted API keys
t.text :openai_api_key
t.text :anthropic_api_key
# Other settings can be added here in the future
t.json :preferences
t.timestamps
end