Skip to content

Instantly share code, notes, and snippets.

View haifeng's full-sized avatar
🎯
Focusing

Haifeng Cao haifeng

🎯
Focusing
View GitHub Profile
module Sunspot
class ResqueSessionProxy < Sunspot::SessionProxy::AbstractSessionProxy
attr_reader :original_session
delegate :config, :delete_dirty?, :dirty?,
:new_search, :search,
:new_more_like_this, :more_like_this,
:remove, :remove!,
@haifeng
haifeng / sunspot_resque.rb
Created October 13, 2011 16:45 — forked from nz/sunspot_resque.rb
Sunspot with Resque
# app/models/post.rb
class Post
searchable :auto_index => false, :auto_remove => false do
text :title
text :body
end
after_commit :resque_solr_update
user app;
worker_processes 2;
error_log /home/app/logs/nginx.error.log info;
events {
worker_connections 1024;
}
# Everything you need to do to get started with Rails 2.3.8
#
# As of June 14th, 2010 @ 2:30 p.m. MST
#
# This gist now features instructions to get Rails 3 up and running with:
# - Ruby 1.8.7-p174
# - Bundler 0.9.26
# - Cucumber 0.8.0
# - Rspec 1.3.0 + Rspec-Rails 1.3.2
# - RVM
@haifeng
haifeng / oshi.rb
Created July 10, 2010 13:44 — forked from anonymous/oshi.rb
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket