Skip to content

Commit

Permalink
Merge branch 'master' of heroku.juddl333:bulletin-board
Browse files Browse the repository at this point in the history
  • Loading branch information
JuddL333 committed Jun 24, 2013
2 parents 2d011dc + 343b45e commit 61c5f3c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 31 deletions.
10 changes: 1 addition & 9 deletions app/models/post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@ def self.sorted_by_most_votes
end

def self.ranked
# If you know a better way, please let me know.
case ActiveRecord::Base.connection.adapter_name
when 'SQLite'
# Nasty because SQLite does not have a ^ operator.
age_calculation = "((strftime('%s','now') - strftime('%s', tweeted_at)) / 60 / 60)"
order("(votes_count - 1) / (#{age_calculation} + 2) * #{age_calculation} * (#{age_calculation} * 1.8) DESC, tweeted_at DESC")
when 'Mysql2'
order('((votes_count - 1) / POW((((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(tweeted_at)) / 3600) + 2), 1.8)) DESC, tweeted_at DESC')
end
order("((votes_count - 1) / POW((((DATE_PART('epoch', NOW()) - DATE_PART('epoch', tweeted_at)) / 3600) + 2), 1.8)) DESC, tweeted_at DESC")
end

def self.within_past_week
Expand Down
1 change: 0 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
<div class="footer">
<p class="logos">
<%= link_to(image_tag(asset_path('lvrug_logo.png')), 'http://lvrug.org', target: '_blank') %>
<%= link_to(image_tag(asset_path('switch_logo.png')), 'http://innevation.com', target: '_blank') %>
</p>
<p>&copy; <%= Date.today.year %> - A Project by <%= link_to('The Las Vegas Ruby User Group', 'http://lvrug.org', target: '_blank') %> (<%= link_to('@LVRUG', 'http://twitter.com/lvrug', target: '_blank') %>). Hosted at the <%= link_to('Switch SuperNAP', 'http://www.switchlv.com', target: 'blank') %></p>
</div>
Expand Down
37 changes: 16 additions & 21 deletions config/unicorn.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
preload_app true

before_fork do |server, worker|
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end

Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
end

defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
end
after_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end

after_fork do |server, worker|

Signal.trap 'TERM' do
puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
end

defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
end

0 comments on commit 61c5f3c

Please sign in to comment.