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
#simulating a worker running every X | |
#a user will ahve to receive a msg every Y interval | |
#user msg is sent sometime between now and now+X | |
#next_message_time will have to be set to current_time += Y | |
#Goal: determine if during a time window of a working processing, if a user is receiving fewer messages than it could because of the offset between 0..X | |
class SendProcess | |
RUN_INTERVAL = 60.0 #1 minute in seconds |
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
<div class="row"> | |
<div class="col-md-6 col-md-offset-3"></div> | |
</div> |
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
(12-6)/2 |
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
ENV['DISABLE_INITIALIZER_FROM_RAKE'] || Application.model_call_setters |
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
task :environment => :disable_initializer | |
task :disable_initializer do | |
ENV['DISABLE_INITIALIZER_FROM_RAKE'] = 'true' | |
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 Application < ActiveRecord::Base | |
def self.model_call_setters | |
Agency.call_solo_payments | |
Agency.call_group_payments | |
Agency.set_sum_payments | |
Lobbyist.call_team_payments | |
Lobbyist.call_my_payments | |
Lobbyist.set_sum_payments |
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
#source https://github.com/rails/rails/issues/10894 | |
module ActiveSupport | |
module Cache | |
class FileStore < Store | |
private | |
# Patch this so we don't have long paths | |
def key_file_path(key) | |
fname = URI.encode_www_form_component(key) | |
hash = Zlib.adler32(fname) |
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
<% @agency.actions.sort_by { |action| -action.payment }.each do |action| %> | |
<% cache [action, action.lobbyist_actions, action.lobbyists, action.agency_actions, action.agencies] do %> | |
<tr> | |
<td><%= action.purpose %></td> | |
<td valign="top"> <% action.lobbyists.each do |lobbyist| %> | |
<%= link_to lobbyist.name, lobbyist_path(lobbyist.slug) %> <br> | |
<%end%> | |
</td> | |
<td valign="top"> <%= link_to action.client.name, client_path(action.client.slug) %> </td> | |
<td valign="top">$<%= action.payment %></td> |
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 Store < ActiveRecord::Base | |
has_many :employees | |
end | |
class Employee < ActiveRecord::Base | |
belongs_to :store, touch: true | |
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
<% # app/views/stores/show.html.erb %> | |
<% cache @store do%> | |
<h1>Store: <%= @store.name %></h1> | |
<%= render @store.employees %> | |
<% end %> | |
<% # app/views/employees/_employee.html.erb %> | |
<% cache employee do %> | |
<div class='employee'> |
NewerOlder