Skip to content

Instantly share code, notes, and snippets.

View stve's full-sized avatar

Steve Agalloco stve

View GitHub Profile
module Kernel
alias :old_puts :puts
def puts(val)
old_puts val
old_puts caller.inspect
end
end
@PetrKaleta
PetrKaleta / Rakefile
Last active August 29, 2015 14:01
Heroku deploy rake tasks with hooks. Demonstrates how to trigger Sidekiq to quiet or terminate via API before deploy
# List of environments and their heroku git remotes (id: 'remote_name')
HEROKU_ENVIRONMENTS = {
staging: 'staging-remote-name',
production: 'production-remote-name'
}
namespace :deploy do
# Create rake tasks to deploy on Heroku environments
# $ rake -T deploy
# rake deploy:production # Deploy to production
class Levenshtein
def initialize(str)
@str = str.downcase
end
def distance(str2)
distances = (0..str2.length.next).to_a
@str.each_char.with_index do |char, i|
distances[0] = i + 1
sub_cost = i
@ryandotsmith
ryandotsmith / s_queue.rb
Last active August 29, 2015 14:07
Multi-threaded SQS Ruby Worker. I have tests. Maybe this is a gem? Lemme know if you find it useful.
require 'aws-sdk'
require 'json'
module SQSW
class SQueue
MissingQueue = Class.new(StandardError)
def initialize(url = nil)
raise(MissingQueue, "Missing queue_url") if url.nil?
@q = find_queue(url)
@evanphx
evanphx / gist:358c1627b69f7a33fca6
Created October 29, 2014 16:54
Tachyon installer with hash verification
curl http://tachyon.vektra.io/install.sh > it.sh && test $(openssl sha1 < it.sh) = "23fb0450b152dfaa8331dd37c3a4c13d4de9dbb8" && bash it.sh
@adambair
adambair / titler
Created April 26, 2009 15:06
Post your current iTunes track to Presently.
#!/usr/bin/env ruby
require 'rubygems'
require 'rbosa'
account='xxx'
username='xxx'
password='xxx'
api="https://#{account}.presentlyapp.com/api/twitter/statuses/update.xml"
itunes = OSA.app("iTunes")
@eric
eric / newrelic_thinking_sphinx.rb
Created October 26, 2009 21:41
NewRelic instrumentation for ThinkingSphinx
# NewRelic instrumentation for ThinkingSphinx
if defined? ActiveRecord
ActiveRecord::Base.class_eval do
class << self
add_method_tracer :search, 'ActiveRecord/#{self.name}/search'
add_method_tracer :search, 'ActiveRecord/search', :push_scope => false
add_method_tracer :search, 'ActiveRecord/all', :push_scope => false
add_method_tracer :search_count, 'ActiveRecord/#{self.name}/search_count'
add_method_tracer :search_count, 'ActiveRecord/search_count', :push_scope => false
#!/usr/bin/ruby
require 'rubygems'
require 'tinder'
load "#{ENV['HOME']}/.campfire_status"
msg = "[#{USER_NAME} @ #{Time.now.strftime('%I:%M%p')}] #{ARGV.join(' ')}"
campfire = Tinder::Campfire.new(CAMPFIRE_SITE)
campfire.login(CAMPFIRE_EMAIL, CAMPFIRE_PASSWORD)
# on Start
do shell script "~/bin/set_campfire_status.rb \"Starting Pomodoro '$pomodoroName'\""
# on End
do shell script "~/bin/set_campfire_status.rb \"Pomodoro '$pomodoroName' ended\""
# on Reset
do shell script "~/bin/set_campfire_status.rb \"Pomodoro '$pomodoroName' ended (reset)\""
# install git
# install heroku ruby gem
# now, clone the github_twitter_server project
git clone git://github.com/technoweenie/github_twitter_server.git
cd github_twitter_server
# create a free heroku app
heroku create USER-gh-twitter