Skip to content

Instantly share code, notes, and snippets.

@r3ap3r2004
r3ap3r2004 / Perf Script
Created May 27, 2011 00:02 — forked from stephskardal/Perf Script
Perf Script
#!/usr/bin/ruby
#url labels can only be /a-zA-Z0-9-/
urls = [
['Spreedemo-home', 'http://demo.spreecommerce.com/'],
['Spreedemo-product', 'http://demo.spreecommerce.com/products/xm-inno-xm2go-portable-satellite-radio-mp3-player-and-home-kit'],
['Google-home', 'http://www.google.com/'],
['Google-shopping', 'http://www.google.com/prdhp?hl=en&tab=vf']
]
n = 100
@r3ap3r2004
r3ap3r2004 / gist:1084226
Created July 15, 2011 07:07 — forked from branch14/gist:743495
mplayer.rb
# control mplayer remotely via rack
#
# load & append files (mp3, ogg, etc) & lists (m3u)
# http://localhost:3000/mplayer/loadfile+http://www.archive.org/download/af002/03_Swiss_Jazz.mp3
# http://localhost:3000/mplayer/loadlist+http://www.archive.org/stream/af002
#
# playback
# http://localhost:3000/mplayer/pause
# http://localhost:3000/mplayer/stop
#
@r3ap3r2004
r3ap3r2004 / git_track_spree
Created January 1, 2012 16:42
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN BRANCH
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN BRANCH
old_branch_or_commit="29e3d4f707bdb047a6fabc2543247139027b06fb"
parts=(
config/locales/en.yml
core/app/views
)
@r3ap3r2004
r3ap3r2004 / git_track_rails_skeleton
Created January 1, 2012 16:43
TRACKS CHANGES TO RAILS' APP SKELETON SINCE A GIVEN VERSION
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO RAILS' APP SKELETON SINCE A GIVEN VERSION
old_version="3.1.1"
# Exit on failure
#
set -e
#!/bin/sh
## you'll have to do a couple extra steps to get this running
## there are probably other ways to handle svncanboot, but this is from the linux forum
set -e
if
touch /etc/_testr_file
then
@r3ap3r2004
r3ap3r2004 / bogo.rb
Created February 11, 2012 01:31 — forked from BDQ/bogo.rb
module Spree
class Calculator::Bogo < Calculator
preference :number_to_buy, :integer, :default => 1
preference :number_to_get, :integer, :default => 1
def self.description
"Buy One Get One"
end
def compute(order)
@r3ap3r2004
r3ap3r2004 / track_spree
Created March 14, 2012 01:06
TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO PARTS OF SPREE SINCE A GIVEN COMMIT
# To be placed in the root of your app.
old_commit="32483802d823e92c0746d080217870dd48f49307"
parts=(
core/app/assets/javascripts/store/checkout.js
@r3ap3r2004
r3ap3r2004 / track_rails_skeleton
Created March 14, 2012 01:06
TRACKS CHANGES TO RAILS' APP SKELETON SINCE A GIVEN VERSION
#!/usr/bin/env zsh
# 1304046900 TRACKS CHANGES TO RAILS' APP SKELETON SINCE A GIVEN VERSION
# To be placed in the root of your app.
old_version="3.1.3"
# Exit on failure
#
@r3ap3r2004
r3ap3r2004 / gist:2108314
Created March 19, 2012 11:28 — forked from kbaum/gist:892247
prune_workers_from_terminated_instance.rb
module Resque
def self.unregister_workers_for_host(host)
Resque.workers.select{|worker| worker.id.split(':').first==host}.each(&:unregister_worker)
end
end
Resque.unregister_workers_for_host("ip-10-250-192-51")
@r3ap3r2004
r3ap3r2004 / deploy.rb
Created May 16, 2012 03:55 — forked from uhlenbrock/deploy.rb
Precompile assets locally for Capistrano deploy
load 'deploy/assets'
namespace :deploy do
namespace :assets do
desc 'Run the precompile task locally and rsync with shared'
task :precompile, :roles => :web, :except => { :no_release => true } do
%x{bundle exec rake assets:precompile}
%x{rsync --recursive --times --rsh=ssh --compress --human-readable --progress public/assets #{user}@#{host}:#{shared_path}}
%x{bundle exec rake assets:clean}
end