[LOGO]
[ADDRESS]
[PHONE]
[CONTACT EMAIL]
[DATE]
| 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" |
| $(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) |
| 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 |
| class ApplicationController < ActionController::Base | |
| layout :determine_layout | |
| private | |
| def determine_layout | |
| request.headers['X-PJAX'] ? false : "application" | |
| end | |
| end |
| $(document).pjax('a', '#pjax-container'); |
| class ApplicationController < ActionController::Base | |
| # ... | |
| around_action :with_timezone | |
| private | |
| def with_timezone | |
| timezone = Time.find_zone(cookies[:timezone]) | |
| Time.use_zone(timezone) { yield } |
| var tz = jstz.determine(); | |
| tz.name(); // returns "America/Los Angeles" |
[LOGO]
[ADDRESS]
[PHONE]
[CONTACT EMAIL]
[DATE]
| require 'json' | |
| require 'csv' | |
| class SimpleJsonExport | |
| def initialize(filepath) | |
| @filepath = filepath | |
| end | |
| def transactions | |
| @transactions ||= data['transactions'].collect do |transaction| |