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
module ApplicationHelper | |
def tickaroo_button(opts) | |
opts[:button_type] ||= :default | |
sig = TikButtonSignature.new.signature(opts) | |
s = "" | |
s += "width='#{opts[:width]}' " if opts[:width].present? | |
s += "height='#{opts[:height]}' " if opts[:height].present? | |
s += "lang='#{opts[:lang]}' " if opts[:lang].present? | |
s += "data-title='#{opts[title]}' " if opts[:title].present? |
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
gem 'celluloid', '0.15.1' | |
require 'celluloid/autostart' | |
class Manager | |
include Celluloid | |
trap_exit :processor_died | |
def initialize | |
puts "manager initialized" |
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 'celluloid/autostart' | |
class Manager | |
include Celluloid | |
trap_exit :processor_died | |
def initialize | |
@ready = 2.times.map { Processor.new_link } | |
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
def recalculate_score | |
reload | |
user_ids = users.collect{|u| u.id } | |
self.score_cache = 0 | |
Category.all(:conditions => {:calculated => true}).each do |c| | |
self.score_cache += category.category_scores.all(:conditions => ["user_id IN (?)", user_ids], :order => "score_cache DESC", :limit => 3).sum(&:score_cache) | |
end | |
save(false) | |
end |