Skip to content

Instantly share code, notes, and snippets.

View activefx's full-sized avatar

Matt Solt activefx

View GitHub Profile
@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
@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"
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)
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
require 'formula'
class CloogPpl015 < Formula
homepage 'http://repo.or.cz/w/cloog-ppl.git'
url 'http://gcc.cybermirror.org/infrastructure/cloog-ppl-0.15.11.tar.gz'
sha1 '42fa476a79a1d52da41608a946dcb47c70f7e3b9'
keg_only 'Conflicts with cloog in main repository.'
depends_on 'gmp4'
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
scheduler: bundle exec rake resque:scheduler
worker: env TERM_CHILD=1 RESQUE_TERM_TIMEOUT=10 bundle exec rake jobs:work
@activefx
activefx / resque.rb
Created January 22, 2013 03:39
resque initializer
# Require to rescue Resque::TermException errors in the perfrom method
require 'resque/errors'
# Load the servers to enable to web interfaces
require 'resque/server'
require 'resque_scheduler/server'
# Create a global variable to access the Redis DB
$redis = Rails.env == 'test' ? Redis.new : configatron.redis.server
# Tell Resque to use the defined Redis DB
@activefx
activefx / resque.rake
Created January 22, 2013 03:36
resque.rake with error monitoring, resque scheduler and queue clearer
require 'resque/tasks'
require 'resque_scheduler/tasks'
require 'resque/failure/multiple'
require 'resque/failure/redis'
# https://github.com/lantins/resque-exceptional
# Configuration Options
# Required
# api_key - your getexceptional.com api key.
# HTTP Proxy Options (optional)
@activefx
activefx / gist:3712368
Created September 13, 2012 06:33 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@activefx
activefx / spec_helper.rb
Created October 10, 2011 20:19
Spec helper for use with guard, spork, rspec, factory girl, devise, capybara, and mongoid
require 'rubygems'
def start_simplecov
require 'simplecov'
SimpleCov.start 'rails' unless ENV["SKIP_COV"]
end
def spork?
defined?(Spork) && Spork.using_spork?
end