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
$ irb | |
## ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] | |
>> require './github_style_titles.rb' | |
true | |
>> gh = Redcarpet::Render::GithubStyleTitles.new | |
#<Redcarpet::Render::GithubStyleTitles:0x00000001cc3a48> | |
>> puts Redcarpet::Markdown.new(gh).render "test\n\n# test 1\n\n# test 2\n\n# test 1\n\n# test 1" | |
<a name="test-1" href="#test-1" class="anchor"><span class="anchor-icon"></span></a><h1 id="test-1">test 1</h1> |
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 self.valid_time?(time) | |
(0 .. 2359).include? Integer(time) | |
rescue ArgumentError # invalid integer | |
false | |
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
def quoted_date(value) | |
base = value.respond_to?(:getutc) ? value.getutc.to_s(:db) : super | |
usec = sprintf(".%06d", value.usec) if value.respond_to?(:usec) | |
zone = " #{value.formatted_offset}" if value.respond_to?(:formatted_offset) | |
"#{base}#{usec}#{zone}" | |
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
require 'ember' | |
module ActionView | |
module TemplateHandlers | |
## | |
# @example Pass template processing options to Ember | |
# | |
# ActionView::TemplateHandlers::Ember.options = { | |
# :unindent => true, | |
# :shorthand => true, |