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
{ | |
"Id": "S3PolicyId1", | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "StackPathReadOnly", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, |
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
# JSONAPI_MEDIA_TYPE = 'application/vnd.api+json' | |
Mime::Type.register JSONAPI_MEDIA_TYPE, :jsonapi | |
ActionController::Renderers.add :jsonapi do |json, options| | |
json = json.to_json(options) unless json.is_a?(String) | |
self.content_type ||= Mime[:jsonapi] | |
self.response_body = json | |
end | |
ActionDispatch::Request.parameter_parsers[:jsonapi] = lambda do |body| |
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
# Include this concern in your ApplicationController | |
# Must implement links_object and paginate_collection | |
module RenderJsonapi | |
extend ActiveSupport::Concern | |
included do | |
def render_jsonapi(*args) | |
options = args.extract_options! | |
collection = args.first |
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 helmet_distance_from_the_left team, index | |
width_of_largest_sideline = 850 | |
midfield = width_of_largest_sideline / 2 | |
helmet_starting_line_offset = index*3.8 | |
distance_from_far_left_edge_to_one_yard_line = 130 | |
distance_from_left = distance_from_far_left_edge_to_one_yard_line + | |
((team.num_of_hashtag_shares / team.offset) / days_until_campaign_ends) | |
if distance_from_left >= midfield | |
distance_from_midfield_to_current_position = distance_from_left - midfield | |
divisor = midfield / distance_from_midfield_to_current_position |
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
athlete_ids = {} | |
PreferredCollege.all.each do |pc| | |
athlete_ids[pc.athlete_id.to_s].blank? ? athlete_ids[pc.athlete_id.to_s] = [pc.college_id] : athlete_ids[pc.athlete_id.to_s] << pc.college_id end | |
end |