Skip to content

Instantly share code, notes, and snippets.

class Admin::LabelsController < ApplicationController
def index
@search = Sunspot.new_search(Label)
@search.build do |q|
q.keywords(params[:keywords]) if params[:keywords].present?
q.with(:tracking_number, params[:tracking_number]) if params[:tracking_number].present?
q.with(:status, params[:status]) if params[:status].present?
q.order_by(:created_at, :desc)
q.facet :status
@oogali
oogali / kvm.rb
Created March 1, 2011 17:02
Connect to Manaviz KVM without opening a browser (tested on OS X)
#!/usr/bin/env ruby
#
# I hate ManaWiz KVMs. That is all.
#
# Create a file in your home directory called ".kvmcfg" with the following:
# :kvm_user: yourusername
# :kvm_passwd: yourpassword
#
# Then run this marvelous script:
# $ ./kvm.rb servername-oob.whatever.com