Old way:
# routes.rb
require 'sidekiq/web' # ... mount Sidekiq::Web, at: '/sidekiq'
New way
# config.ru
require 'sidekiq/web'
run Rack::URLMap.new(
"/" => Rails.application,
"/sidekiq" => Sidekiq::Web
)
Read on...
require 'sidekiq/web' # ... mount Sidekiq::Web, at: '/sidekiq'
require 'sidekiq/web'
run Rack::URLMap.new(
"/" => Rails.application,
"/sidekiq" => Sidekiq::Web
)
Read on...
mount Resque::Server, :at => "/resque"
require 'resque/server'
run Rack::URLMap.new(
"/" => Rails.application,
"/resque" => Resque::Server.new
)
Read on...
Recently I took the plunge into figuring out a solution to play music in my apartment. I tried a number of solutions but the deciding factor for me ended up being setup and the type of apps available for the hardware platform.
My building offers free WiFi (hooray!) but no dedicated ethernet port (boo!). Here are the 3 things I tried before succeeding.
The Nexus Q is pretty simple to set up. Joining my existing network was a snap and didn't require any special cables, a monitor, etc. It did require that I download the Nexus Q app for my Android phone though. Once it was up and running I noticed a number of inconveniences.
So at the end of it, I had to put the Nexus Q back in its box. All the hardware is there so I hope a future software update enables bluetooth speaker pairing and 3rd party apps.
I next tried a Raspberry Pi. Building it is a snap but the lack of TV really made setup impossible. I may give this a try someplace else. Raspberry Pi + Music Player Daemon should be a no brainer. There's even a version of MPD that works with Spotify.
The last thing I tried was Sonos. They've got a basic bridge and Play 3 wireless speaker that costs around the same price as the Nexus Q. The only problem here is that the bridge requires Ethernet. Fortunately I didn't have to look far before I figured out the Apple Airport Express offers a client mode which basically transforms WiFi signals into Ethernet. (The Airport Express does much more too but this is the mode I needed!) After setting up client mode and getting my building to authenticate the device by MAC Address, I was cooking with gas.
Sonos setup is really simple and they offer applications for Windows, Mac, Android, and iOS. It's not perfect (hey Sonos, where's my Debian package?!) but it works well. And the best part about Sonos is that there's no vendor lock in at all. I've got Pandora, NPR, Spotify, and Amazon's cloud player all set up and working.
Apple and Google may think they're winning the war by using their Android and iOS platforms to lock in users, but the reality is that for me, it means giving even more power to the independent vendors who just want your stuff to work wherever you want it to. So thank you Amazon, Netflix, Dropbox, Evernote, Pandora, Sonos, and the rest of you letting me use the things I paid for how I want to.
Read on...OriginalDismax = Sunspot::Query::Dismax
class PatchedDismax < OriginalDismax
def to_params
params = super
params[:defType] = 'edismax'
params
end
def to_subquery
query = super
query = query.sub '{!dismax', '{!edismax'
query
end
end
Sunspot::Query.send :remove_const, :Dismax
Sunspot::Query::Dismax = PatchedDismax
require 'progress_bar'
desc "Do some awesome thing that takes a long time"
task :my_rake_task => :environment do |t|
progress_bar = ProgressBar.new(Person.count)
Person.all.each do |person|
progress_bar.increment!
person.gender = person.gender.downcase
person.save
end
end