This file contains hidden or 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 ApplicationController < ActionController::Base | |
# ... | |
around_action :with_timezone | |
private | |
def with_timezone | |
timezone = Time.find_zone(cookies[:timezone]) | |
Time.use_zone(timezone) { yield } |
This file contains hidden or 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
$(document).pjax('a', '#pjax-container'); |
This file contains hidden or 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 ApplicationController < ActionController::Base | |
layout :determine_layout | |
private | |
def determine_layout | |
request.headers['X-PJAX'] ? false : "application" | |
end | |
end |
This file contains hidden or 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 App.Router extends Backbone.Router | |
initialize: (options) -> | |
# keep track of the first route event so that | |
# loadNormally doesn't get stuck in an infinite | |
# redirect loop | |
@isFirstRoute = true | |
@once 'route', => | |
@isFirstRoute = false |
This file contains hidden or 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
$(document).on 'click', 'a', (e) -> | |
$link = $(e.currentTarget) | |
href = $link.attr('href') | |
# we only care about links with http protocol | |
isHttp = $link.prop('protocol').indexOf('http') == 0 | |
# we only care about links to html pages | |
allowedFormats = ['html'] | |
format = getFormatFromUrl(href) |
This file contains hidden or 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 GildedRose | |
def self.new(name:, days_remaining:, quality:) | |
item_class = case name | |
when "Aged Brie" | |
AgedItem | |
when "Sulfuras, Hand of Ragnaros" | |
LegendaryItem | |
when "Backstage passes to a TAFKAL80ETC concert" | |
BackstagePass | |
when "Conjured Mana Cake" |
OlderNewer