Skip to content

Instantly share code, notes, and snippets.

@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
@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 / gist:1354740
Created November 10, 2011 12:24
Add a step to the order process
Order.class_eval do
state_machine :initial => :cart, :use_transactions => false do
event :next do
transition :from => 'cart', :to => 'orderdetails'
transition :from => 'orderdetails', :to => 'address'
transition :from => 'address', :to => 'delivery'
transition :from => 'delivery', :to => 'payment', :if => :payment_required?
transition :from => 'delivery', :to => 'complete'
transition :from => 'confirm', :to => 'complete'
@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 / 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 / thubmnail_with_dimensions.rb
Created March 25, 2010 15:37
Paperclip processor to save dimensions of an image
# Filename: RAILS_ROOT/lib/paperclip_processors/thumbnail_with_dimensions.rb
# Required Configuration in the model
# has_attached_file :image,
# :styles => {
# :thumbnail => {
# :geometry => "100x100>",
# :format => :png,
# :processors => [:thumbnail_with_dimensions],
# :mystyle => :thumbnail
# },