This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reindex_companies_since(timestamp) | |
conditions = ["updated_at >= ?", timestamp] | |
total = Company.count(:conditions => conditions) | |
indexed = 0 | |
companies = Queue.new | |
indexing = true | |
Thread.abort_on_exception = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.build_fuzzy_query(name, options = {}) | |
[].tap do |q| | |
subq = [].tap do |subq| | |
Normalizer.short_name(name).split.uniq.each do |token| | |
subq << "short_name_text:#{token}^5" # exact match | |
subq << "short_name_text:#{token}~^3" # fuzzy match | |
subq << "marketing_alias_text:#{token}^5" # exact match | |
subq << "marketing_alias_text:#{token}~^3" # fuzzy match | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setup do | |
@company = Factory(:company, :company_name => "Highgroove Studios", :marketing_alias => "Genius Wolf Brains", :state => "GA") | |
@top = Factory(:company, :company_name => "Company HQ", :state => "GA", :company_search_weight => '1', :company_sort_order => '5') | |
@middle = Factory(:company, :company_name => "Company", :state => "GA", :company_search_weight => '1', :company_sort_order => '5') | |
@bottom = Factory(:company, :company_name => "Company", :state => "GA", :company_search_weight => '5', :company_sort_order => '1') | |
Company.solr_index_batch!({}) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get '/' do | |
"hello world" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.signin .options ul li').hover(function() { | |
$('.signin .options ul li').removeClass('hover'); | |
$(this).addClass('hover'); | |
}), function() { | |
$('.signin .options ul li').removeClass('hover'); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.signin .options li').hover( -> | |
$('.signin .options li').removeClass('hover') | |
$(this).addClass('hover') | |
true | |
, -> | |
$('.signin .options li').removeClass('hover') | |
true | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
less_encoded = crazy_encoded_stuff.gsub("\\", "") | |
JSON.parse(less_encoded[1, less_encoded.length - 1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'blather/client' | |
setup 'hello@highgroove.com', '******', 'talk.google.com' | |
message :chat?, :body do |m| | |
write_to_stream "I am a robot!" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventsController < AdminController | |
def index | |
@days_with_events = Events.all.map(&:to_days).flatten.uniq | |
end | |
end | |
class Event < ActiveRecord::Base | |
def to_days | |
(started_at.to_date..ended_at.to_date).to_a | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
requirements = scoped_requirements_for_index_or_export.page(page).per(params[:per_page]).all | |
requirements.map(&:id) #apparently makes this work.... | |
logger.debug "DEBUG: Requirement: #{@requirement.id}" | |
logger.debug "DEBUG: Last Requirement: #{requirements.last.id}" | |
if requirements.last.id == @requirement.id and requirements.num_pages != page | |
.... |