Skip to content

Instantly share code, notes, and snippets.

View rbarfoed's full-sized avatar

Rasmus Barfoed rbarfoed

  • Copenhagen, Denmark
View GitHub Profile
@jarosan
jarosan / elasticsearch.rake
Created July 16, 2012 20:37
Elasticsearch reindex task
# Run with: rake environment elasticsearch:reindex
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klass = Place
ENV['CLASS'] = klass.name
ENV['INDEX'] = new_index = klass.tire.index.name << '_' << Time.now.strftime('%Y%m%d%H%M%S')
@matthutchinson
matthutchinson / fakeout.rake
Created February 10, 2010 16:49
fakeout.rake - a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# NOTE: requires the faker or ffaker gem
# sudo gem install faker - http://faker.rubyforge.org
# OR
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker
require 'faker'
class Fakeout
@celldee
celldee / Experimental Subscription
Created September 11, 2009 07:27
Bunny Subscription Examples (versions <= 0.8.0)
# This is how Queue#subscribe will work in the next version of Bunny (v0.5.4).
# It's in the 'experimental' branch now.
#
# In order for subscription to work smoothly you need to use a combination of
# Queue#subscribe, Queue#unsubscribe, Queue#ack and Client#qos prefetch. The
# prefetch will allow a controlled number of messages to be released to a
# consumer, which means that Queue#unsubscribe and other methods can be run
# without errors due to out of sequence messages.
#